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