PUD: add wireformat library to makefile
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 5 Aug 2011 14:51:14 +0000 (16:51 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Tue, 18 Oct 2011 10:08:27 +0000 (12:08 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/Makefile
lib/pud/doc/Makefile

index f46dbcc..91a764a 100644 (file)
@@ -1,3 +1,9 @@
+LIBRARY_PATH = wireformat
+JAVA_PATH = wireformat-java
+include $(LIBRARY_PATH)/Makefile.inc
+LIBRARY_NAME := $(PROJECT)
+
+
 include Makefile.inc
 
 TOPDIR = ../..
@@ -19,8 +25,16 @@ CFLAGS += -Werror -D_GNU_SOURCE
 
 
 VERSION_FILE = ./src/version.h
+LIBRARY_INC = $(LIBRARY_PATH)/include
+LIBRARY_LIB = $(LIBRARY_PATH)/lib
+
+CFLAGS += -I $(LIBRARY_INC)
+LIBS += -L $(LIBRARY_LIB) -lnmea -lm -l$(LIBRARY_NAME)
 
-LIBS += -lnmea -lm
+
+# repeat from toplevel Makefile.inc, and adjust: we need the library includes
+%.d: %.c
+       @$(filter-out $(CCACHE),$(CC)) -M $(strip $(CPPFLAGS)) -I $(LIBRARY_INC) "$<" | sed -e '1s/\($(call quote,$(*F))\.o\)[ :]*/$(call quote,$(*D)/\1 $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc) /g' >"$@"
 
 
 ifneq ($(OS),linux)
@@ -34,36 +48,55 @@ all: default_target
 
 default_target: version $(PLUGIN_FULLNAME)
 
-$(PLUGIN_FULLNAME): $(OBJS) version-script.txt
+$(PLUGIN_FULLNAME): library $(OBJS) version-script.txt
        @echo "[LD] $@"
        @$(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS)
 
 
-.PHONY:        version install uninstall clean dist distclean doc doc-clean
+.PHONY:        version install uninstall clean dist distclean doc doc-clean library library-clean library-doc library-doc-clean
 
 version: Makefile scripts/makeVersionH
        @echo "[$(VERSION_FILE)]"
        @./scripts/makeVersionH "$(VERSION_FILE)" "$(PLUGIN_VER)"
 
-install: $(PLUGIN_FULLNAME)
+install: all
+       @$(MAKE) -C $(LIBRARY_PATH) DESTDIR=$(DESTDIR) install
        $(INSTALL_LIB)
        $(STRIP) "$(LIBDIR)/$(PLUGIN_FULLNAME)"
 
 uninstall:
+       @$(MAKE) -C $(LIBRARY_PATH) DESTDIR=$(DESTDIR) uninstall
        rm -f "$(LIBDIR)/lib$(PLUGIN_NAME).so" "$(LIBDIR)/$(PLUGIN_NAME)"
        $(UNINSTALL_LIB)
+       rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
 
-clean: doc-clean
+clean:
        @echo "[$@]"
        @rm -f $(OBJS) $(SRCS:%.c=%.d) "$(PLUGIN_FULLNAME)"
+       @$(MAKE) -C doc clean
+       @$(MAKE) -C $(LIBRARY_PATH) clean
+       @$(MAKE) -C $(JAVA_PATH) clean
 
 dist:                          distclean
 distclean:                     clean
 
+
 doc:
        @$(MAKE) -C doc all
+       @$(MAKE) -C $(LIBRARY_PATH) doc
+       @$(MAKE) -C $(JAVA_PATH) doc
 
-doc-clean:
-       @$(MAKE) -C doc clean
+library:
+       @$(MAKE) -C $(LIBRARY_PATH) all
+
+
+java:
+       @$(MAKE) -C $(JAVA_PATH) all
+
+java-install: java
+       @$(MAKE) -C $(JAVA_PATH) DESTDIR=$(DESTDIR) install
+
+java-uninstall:
+       @$(MAKE) -C $(JAVA_PATH) DESTDIR=$(DESTDIR) uninstall
 
 endif
index 054abcc..262d89a 100644 (file)
@@ -19,7 +19,7 @@ TMP_DOX_FILE = $(DOX_FILE).temp
 
 clean:
        @echo "[$@] doc"
-       @rm -fr "$(HTML_DIR)" "$(LATEX_DIR)" "$(MAN_DIR)" "$(PDF_NAME)"
+       @rm -fr "$(TMP_DOX_FILE)" "$(HTML_DIR)" "$(LATEX_DIR)" "$(MAN_DIR)" "$(PDF_NAME)"
 
 all: clean $(DOX_FILE)
        @echo "[$@] doc"