Work on Makefile
This commit is contained in:
parent
84b01a5de3
commit
a66dcb959c
39
Makefile
39
Makefile
|
@ -1,3 +1,6 @@
|
|||
LIBDIR ?= /usr/lib
|
||||
INCDIR ?= /usr/include
|
||||
|
||||
AR ?= $(CROSS)ar
|
||||
CXX ?= $(CROSS)g++
|
||||
|
||||
|
@ -17,14 +20,14 @@ BUILD_SHARED ?= 1
|
|||
BUILD_UTILS ?= 1
|
||||
|
||||
TARGETS =
|
||||
TARGET_BINARIES =
|
||||
TARGET_LIBRARIES =
|
||||
ifneq ($(BUILD_STATIC), 0)
|
||||
TARGETS += libgourou.a
|
||||
TARGET_BINARIES += libgourou.a
|
||||
TARGET_LIBRARIES += libgourou.a
|
||||
endif
|
||||
ifneq ($(BUILD_SHARED), 0)
|
||||
TARGETS += libgourou.so
|
||||
TARGET_BINARIES += libgourou.so libgourou.so.$(VERSION)
|
||||
TARGET_LIBRARIES += libgourou.so libgourou.so.$(VERSION)
|
||||
endif
|
||||
ifneq ($(BUILD_UTILS), 0)
|
||||
TARGETS += build_utils
|
||||
|
@ -42,9 +45,7 @@ CXXFLAGS += -DSTATIC_NONCE=1
|
|||
endif
|
||||
|
||||
SRCDIR := src
|
||||
INCDIR := inc
|
||||
BUILDDIR := obj
|
||||
TARGETDIR := bin
|
||||
SRCEXT := cpp
|
||||
OBJEXT := o
|
||||
|
||||
|
@ -74,25 +75,33 @@ libgourou: libgourou.a libgourou.so
|
|||
libgourou.a: $(OBJECTS) $(UPDFPARSERLIB)
|
||||
$(AR) crs $@ obj/*.o $(UPDFPARSERLIB)
|
||||
|
||||
libgourou.so: $(OBJECTS) $(UPDFPARSERLIB)
|
||||
$(CXX) obj/*.o -Wl,-soname,$@.$(VERSION) $(LDFLAGS) -o $@.$(VERSION) -shared
|
||||
rm -f $@
|
||||
ln -s $@.$(VERSION) $@
|
||||
libgourou.so.$(VERSION): $(OBJECTS) $(UPDFPARSERLIB)
|
||||
$(CXX) obj/*.o -Wl,-soname,$@ $(LDFLAGS) -o $@ -shared
|
||||
|
||||
build_utils:
|
||||
libgourou.so: libgourou.so.$(VERSION)
|
||||
ln -f -s $^ $@
|
||||
|
||||
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)
|
||||
|
||||
install:
|
||||
install -d $(DESTDIR)$(PREFIX)/lib/
|
||||
install: $(TARGET_LIBRARIES)
|
||||
install -d $(DESTDIR)$(PREFIX)$(LIBDIR)
|
||||
# Use cp to preserver symlinks
|
||||
cp --no-dereference $(TARGET_BINARIES) $(DESTDIR)$(PREFIX)/lib/
|
||||
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
|
||||
|
||||
uninstall:
|
||||
cd $(DESTDIR)$(PREFIX)/lib/
|
||||
rm -f $(TARGET_BINARIES) libgourou.so.$(VERSION)
|
||||
cd $(DESTDIR)$(PREFIX)/$(LIBDIR)
|
||||
rm -f $(TARGET_LIBRARIES) libgourou.so.$(VERSION)
|
||||
cd -
|
||||
|
||||
install_headers:
|
||||
install -d $(DESTDIR)$(PREFIX)/$(INCDIR)/libgourou
|
||||
cp --no-dereference include/*.h $(DESTDIR)$(PREFIX)/$(INCDIR)/libgourou
|
||||
|
||||
uninstall_headers:
|
||||
rm -rf $(DESTDIR)$(PREFIX)/$(INCDIR)/libgourou
|
||||
|
||||
clean:
|
||||
rm -rf libgourou.a libgourou.so libgourou.so.$(VERSION)* obj
|
||||
make -C utils clean
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
BINDIR ?= /usr/bin
|
||||
MANDIR ?= /usr/share/man
|
||||
|
||||
TARGET_BINARIES=acsmdownloader adept_activate adept_remove adept_loan_mgt
|
||||
TARGETS=$(TARGET_BINARIES) launcher
|
||||
|
||||
MAN_PAGES=acsmdownloader adept_activate adept_remove adept_loan_mgt
|
||||
|
||||
CXXFLAGS=-Wall -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/
|
||||
|
||||
STATIC_DEP=
|
||||
|
@ -33,14 +37,18 @@ ${COMMON_LIB}: ${COMMON_DEPS} ${STATIC_DEP}
|
|||
%: %.cpp ${COMMON_LIB}
|
||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
||||
|
||||
install:
|
||||
install -d $(DESTDIR)$(PREFIX)/bin/
|
||||
install -m 644 $(TARGET_BINARIES) $(DESTDIR)$(PREFIX)/bin/
|
||||
install: $(TARGET_BINARIES)
|
||||
install -d $(DESTDIR)$(PREFIX)/$(BINDIR)
|
||||
install -m 755 $(TARGET_BINARIES) $(DESTDIR)$(PREFIX)/$(BINDIR)
|
||||
install -d $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
||||
install -m 644 man/*.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
||||
|
||||
uninstall:
|
||||
cd $(DESTDIR)$(PREFIX)/bin/
|
||||
cd $(DESTDIR)$(PREFIX)/$(BINDIR)
|
||||
rm -f $(TARGET_BINARIES)
|
||||
cd -
|
||||
cd $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
||||
rm -f $(addsuffix .1,$(TARGET_BINARIES)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS) $(COMMON_LIB)
|
||||
|
|
Loading…
Reference in New Issue
Block a user