- Added some missing newlines at end of files
- Modified Makefiles to produce a shared library - Added SingletonDll Makefile git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@581 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
f13e5f58ef
commit
6152f9386f
9 changed files with 70 additions and 26 deletions
16
Makefile
16
Makefile
|
@ -1,14 +1,20 @@
|
||||||
.PHONY: build check install clean-tmp clean
|
.PHONY: build-static build-shared check install clean-tmp clean
|
||||||
build:
|
build-static:
|
||||||
$(MAKE) -C src
|
$(MAKE) -C src build-static
|
||||||
|
|
||||||
check: build
|
build-shared:
|
||||||
|
$(MAKE) -C src build-shared
|
||||||
|
|
||||||
|
check: build-static
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(MAKE) -C src install
|
$(MAKE) -C src install-static
|
||||||
$(MAKE) -C include install
|
$(MAKE) -C include install
|
||||||
|
|
||||||
|
install-shared:
|
||||||
|
$(MAKE) -C src install-shared
|
||||||
|
|
||||||
clean-tmp:
|
clean-tmp:
|
||||||
$(MAKE) -C src clean-tmp
|
$(MAKE) -C src clean-tmp
|
||||||
|
|
||||||
|
|
44
src/Makefile
44
src/Makefile
|
@ -1,24 +1,40 @@
|
||||||
OBJ = \
|
SRC = $(wildcard *.cpp)
|
||||||
OrderedStatic.o \
|
STATIC_OBJ = $(SRC:.cpp=.o)
|
||||||
SafeFormat.o \
|
SHARED_OBJ = $(SRC:.cpp=.lo)
|
||||||
Singleton.o \
|
|
||||||
SmallObj.o \
|
|
||||||
SmartPtr.o
|
|
||||||
|
|
||||||
BIN = ../lib/libloki.a
|
LOKI_VERSION = 0.1.4
|
||||||
|
|
||||||
|
STATIC_LIB = ../lib/libloki.a
|
||||||
|
SHARED_LIB = ../lib/libloki.so.$(LOKI_VERSION)
|
||||||
CXXFLAGS = -Wall -Wold-style-cast -Wundef -Wsign-compare -Wconversion -Wpointer-arith -pedantic -O2
|
CXXFLAGS = -Wall -Wold-style-cast -Wundef -Wsign-compare -Wconversion -Wpointer-arith -pedantic -O2
|
||||||
CPPFLAGS = -I../include -DNDEBUG
|
CPPFLAGS = -I../include -DNDEBUG
|
||||||
|
|
||||||
$(BIN): $(OBJ)
|
$(STATIC_LIB): $(STATIC_OBJ)
|
||||||
ar rs $(BIN) $(OBJ)
|
ar rs $(STATIC_LIB) $(STATIC_OBJ)
|
||||||
|
|
||||||
.PHONY: install clean-tmp clean
|
$(SHARED_LIB): $(SHARED_OBJ)
|
||||||
install: $(BIN)
|
g++ --shared -Wl,-soname=libloki.so.$(LOKI_VERSION) -o $(SHARED_LIB) $(SHARED_OBJ)
|
||||||
|
|
||||||
|
%.lo : %.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) -fPIC $(CPPFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
.PHONY: build-static build-shared install-static install-shared clean-tmp clean
|
||||||
|
build-static: $(STATIC_LIB)
|
||||||
|
build-shared: $(SHARED_LIB)
|
||||||
|
|
||||||
|
install-static: $(STATIC_LIB)
|
||||||
mkdir -p $(DESTDIR)/usr/lib
|
mkdir -p $(DESTDIR)/usr/lib
|
||||||
install $(BIN) $(DESTDIR)/usr/lib
|
install -m 644 $(STATIC_LIB) $(DESTDIR)/usr/lib
|
||||||
|
|
||||||
|
install-shared: $(SHARED_LIB)
|
||||||
|
mkdir -p $(DESTDIR)/usr/lib
|
||||||
|
install -m 644 -s $(SHARED_LIB) $(DESTDIR)/usr/lib
|
||||||
|
cd $(DESTDIR)/usr/lib/; ln -s libloki.so.$(LOKI_VERSION) libloki.so
|
||||||
|
|
||||||
clean-tmp:
|
clean-tmp:
|
||||||
rm -f $(OBJ)
|
rm -f $(STATIC_OBJ)
|
||||||
|
rm -f $(SHARED_OBJ)
|
||||||
|
|
||||||
clean: clean-tmp
|
clean: clean-tmp
|
||||||
rm -f $(BIN)
|
rm -f $(STATIC_LIB)
|
||||||
|
rm -f $(SHARED_LIB)
|
||||||
|
|
22
test/SingletonDll/Makefile
Executable file
22
test/SingletonDll/Makefile
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
BIN = client
|
||||||
|
LIB1 = libfoo.so
|
||||||
|
LIB2 = libsingletondll.so
|
||||||
|
CXXFLAGS = -Wall -Wold-style-cast -Wundef -Wsign-compare -Wconversion -Wpointer-arith -pedantic -O2
|
||||||
|
CPPFLAGS = -I../../include -DNDEBUG
|
||||||
|
LDFLAGS = -L../../lib
|
||||||
|
LDLIBS = -lloki
|
||||||
|
|
||||||
|
.PHONY: build clean
|
||||||
|
build: $(BIN)
|
||||||
|
|
||||||
|
$(BIN): $(LIB1) $(LIB2)
|
||||||
|
$(CXX) $(CXXFLAGS) -L. $(LDFLAGS) $(CPPFLAGS) -o $(BIN) client.cpp $(LDLIBS) -lfoo -lsingletondll
|
||||||
|
|
||||||
|
$(LIB1): foo.cpp
|
||||||
|
$(CXX) --shared $(CXXFLAGS) $(CPPFLAGS) -o $(LIB1) foo.cpp
|
||||||
|
|
||||||
|
$(LIB2): singletondll.cpp
|
||||||
|
$(CXX) --shared $(CXXFLAGS) $(CPPFLAGS) -o $(LIB2) foo.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BIN) $(LIB1) $(LIB2)
|
Loading…
Add table
Reference in a new issue