forked from soutade/libgourou
Fix static build
This commit is contained in:
parent
1213b34250
commit
50bc16079f
20
Makefile
20
Makefile
|
@ -11,7 +11,7 @@ endif
|
||||||
UPDFPARSERLIB = ./lib/updfparser/libupdfparser.a
|
UPDFPARSERLIB = ./lib/updfparser/libupdfparser.a
|
||||||
|
|
||||||
CXXFLAGS += -Wall -fPIC -I./include -I./usr/include/pugixml -I./lib/updfparser/include
|
CXXFLAGS += -Wall -fPIC -I./include -I./usr/include/pugixml -I./lib/updfparser/include
|
||||||
LDFLAGS = $(UPDFPARSERLIB) -lpugixml
|
LDFLAGS = -lpugixml
|
||||||
|
|
||||||
VERSION := $(shell cat include/libgourou.h |grep LIBGOUROU_VERSION|cut -d '"' -f2)
|
VERSION := $(shell cat include/libgourou.h |grep LIBGOUROU_VERSION|cut -d '"' -f2)
|
||||||
|
|
||||||
|
@ -21,9 +21,13 @@ BUILD_UTILS ?= 1
|
||||||
|
|
||||||
TARGETS =
|
TARGETS =
|
||||||
TARGET_LIBRARIES =
|
TARGET_LIBRARIES =
|
||||||
|
ifneq ($(STATIC_UTILS),)
|
||||||
|
BUILD_STATIC=1
|
||||||
|
endif
|
||||||
ifneq ($(BUILD_STATIC), 0)
|
ifneq ($(BUILD_STATIC), 0)
|
||||||
TARGETS += libgourou.a
|
TARGETS += libgourou.a
|
||||||
TARGET_LIBRARIES += libgourou.a
|
TARGET_LIBRARIES += libgourou.a
|
||||||
|
STATIC_UTILS=1
|
||||||
endif
|
endif
|
||||||
ifneq ($(BUILD_SHARED), 0)
|
ifneq ($(BUILD_SHARED), 0)
|
||||||
TARGETS += libgourou.so
|
TARGETS += libgourou.so
|
||||||
|
@ -70,25 +74,25 @@ obj:
|
||||||
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
||||||
$(CXX) $(CXXFLAGS) -c $^ -o $@
|
$(CXX) $(CXXFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
libgourou: libgourou.a libgourou.so
|
libgourou: $(TARGET_LIBRARIES)
|
||||||
|
|
||||||
libgourou.a: $(OBJECTS) $(UPDFPARSERLIB)
|
libgourou.a: $(OBJECTS) $(UPDFPARSERLIB)
|
||||||
$(AR) crs $@ obj/*.o $(UPDFPARSERLIB)
|
$(AR) rcs --thin $@ $^
|
||||||
|
|
||||||
libgourou.so.$(VERSION): $(OBJECTS) $(UPDFPARSERLIB)
|
libgourou.so.$(VERSION): $(OBJECTS) $(UPDFPARSERLIB)
|
||||||
$(CXX) obj/*.o -Wl,-soname,$@ $(LDFLAGS) -o $@ -shared
|
$(CXX) $^ -Wl,-soname,$@ $(LDFLAGS) -o $@ -shared
|
||||||
|
|
||||||
libgourou.so: libgourou.so.$(VERSION)
|
libgourou.so: libgourou.so.$(VERSION)
|
||||||
ln -f -s $^ $@
|
ln -f -s $^ $@
|
||||||
|
|
||||||
build_utils: $(TARGET_LIBRARIES)
|
build_utils: $(TARGET_LIBRARIES)
|
||||||
make -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DEST_DIR=$(DEST_DIR) PREFIX=$(PREFIX)
|
$(MAKE) -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DEST_DIR=$(DEST_DIR) PREFIX=$(PREFIX)
|
||||||
|
|
||||||
install: $(TARGET_LIBRARIES)
|
install: $(TARGET_LIBRARIES)
|
||||||
install -d $(DESTDIR)$(PREFIX)$(LIBDIR)
|
install -d $(DESTDIR)$(PREFIX)$(LIBDIR)
|
||||||
# Use cp to preserver symlinks
|
# Use cp to preserver symlinks
|
||||||
cp --no-dereference $(TARGET_LIBRARIES) $(DESTDIR)$(PREFIX)$(LIBDIR)
|
cp --no-dereference $(TARGET_LIBRARIES) $(DESTDIR)$(PREFIX)$(LIBDIR)
|
||||||
make -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DEST_DIR=$(DEST_DIR) PREFIX=$(PREFIX) install
|
$(MAKE) -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DEST_DIR=$(DEST_DIR) PREFIX=$(PREFIX) install
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
cd $(DESTDIR)$(PREFIX)/$(LIBDIR)
|
cd $(DESTDIR)$(PREFIX)/$(LIBDIR)
|
||||||
|
@ -104,8 +108,8 @@ uninstall_headers:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf libgourou.a libgourou.so libgourou.so.$(VERSION)* obj
|
rm -rf libgourou.a libgourou.so libgourou.so.$(VERSION)* obj
|
||||||
make -C utils clean
|
$(MAKE) -C utils clean
|
||||||
|
|
||||||
ultraclean: clean
|
ultraclean: clean
|
||||||
rm -rf lib
|
rm -rf lib
|
||||||
make -C utils ultraclean
|
$(MAKE) -C utils ultraclean
|
||||||
|
|
|
@ -30,12 +30,12 @@ COMMON_LIB = utils.a
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
${COMMON_LIB}: ${COMMON_DEPS} ${STATIC_DEP}
|
${COMMON_LIB}: $(COMMON_DEPS)
|
||||||
$(CXX) $(CXXFLAGS) ${COMMON_DEPS} $(LDFLAGS) -c
|
$(CXX) $(CXXFLAGS) $(COMMON_DEPS) $(LDFLAGS) -c
|
||||||
$(AR) crs $@ ${COMMON_OBJECTS} $(STATIC_DEP)
|
$(AR) crs $@ $(COMMON_OBJECTS)
|
||||||
|
|
||||||
%: %.cpp ${COMMON_LIB}
|
%: %.cpp $(COMMON_LIB) $(STATIC_DEP)
|
||||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
$(CXX) $(CXXFLAGS) $^ $(STATIC_DEP) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
install: $(TARGET_BINARIES)
|
install: $(TARGET_BINARIES)
|
||||||
install -d $(DESTDIR)$(PREFIX)/$(BINDIR)
|
install -d $(DESTDIR)$(PREFIX)/$(BINDIR)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user