d7e09dabce2cb27c543750e267839cc4d9a55ef3
[olsrd.git] / lib / pud / Makefile
1 NMEALIB_PATH = nmealib
2 LIBRARY_PATH = wireformat
3 JAVA_PATH = wireformat-java
4 include $(LIBRARY_PATH)/Makefile.inc
5 NMEALIB_NAME := nmea
6 LIBRARY_NAME := $(PROJECT)
7
8
9 include Makefile.inc
10
11 TOPDIR = ../..
12 include $(TOPDIR)/Makefile.inc
13
14
15 CFLAGS += -Werror -D_GNU_SOURCE
16
17
18 RESOURCESDIR = ./resources
19 NMEALIB_INC = $(NMEALIB_PATH)/include
20 NMEALIB_LIB = $(NMEALIB_PATH)/lib
21 LIBRARY_INC = $(LIBRARY_PATH)/include
22 LIBRARY_LIB = $(LIBRARY_PATH)/lib
23
24 CFLAGS += -I $(NMEALIB_INC) -I $(LIBRARY_INC)
25 LIBS += -L $(NMEALIB_LIB) -L $(LIBRARY_LIB) -l$(NMEALIB_NAME) -lm -l$(LIBRARY_NAME)
26
27 ifneq ($(OS),linux)
28
29 .PHONY: all default_target install clean
30
31 all: default_target
32
33 default_target install clean:
34         @echo "*** $(PLUGIN_NAME) plugin only supported on Linux, sorry!"
35
36 else
37
38 GIT_SHA = $(shell git describe 2> /dev/null || echo "Unknown")
39 CFLAGS += -DGIT_SHA=\"$(GIT_SHA)\" -DPLUGIN_VER=\"$(PLUGIN_VER)\"
40
41 .PHONY: all default_target install uninstall clean doc doc-clean nmealib library java java-instal java-uninstall
42
43 all: default_target
44
45 default_target: nmealib library $(PLUGIN_FULLNAME)
46
47 # repeat from toplevel Makefile.inc, and adjust: we need the library includes
48 %.d: %.c
49         @$(filter-out $(CCACHE),$(CC)) -M $(strip $(CPPFLAGS)) -I $(NMEALIB_INC) -I $(LIBRARY_INC) "$<" | sed -e '1s/\($(call quote,$(*F))\.o\)[ :]*/$(call quote,$(*D)/\1 $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc) /g' >"$@"
50
51 $(PLUGIN_FULLNAME): $(OBJS) version-script.txt
52         @echo "[LD] $@"
53         @$(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS)
54
55 install: all
56         @$(MAKE) -C "$(NMEALIB_PATH)" DESTDIR="$(DESTDIR)" install
57         @$(MAKE) -C "$(LIBRARY_PATH)" DESTDIR="$(DESTDIR)" install
58         $(INSTALL_LIB)
59         mkdir -p "$(DOCDIR_OLSRD)"
60         cp "$(RESOURCESDIR)/olsrd.pud.position.conf" "$(DOCDIR_OLSRD)"
61         $(STRIP) "$(LIBDIR)/$(PLUGIN_FULLNAME)"
62
63 uninstall:
64         @$(MAKE) -C "$(NMEALIB_PATH)" DESTDIR="$(DESTDIR)" uninstall
65         @$(MAKE) -C "$(LIBRARY_PATH)" DESTDIR="$(DESTDIR)" uninstall
66         rm -f "$(LIBDIR)/lib$(PLUGIN_NAME).so" "$(LIBDIR)/$(PLUGIN_NAME)" "$(DOCDIR_OLSRD)/olsrd.pud.position.conf"
67         $(UNINSTALL_LIB)
68         rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)" "$(DOCDIR_OLSRD)"
69
70 clean:
71         @echo "[$@]"
72         @rm -f $(OBJS) $(SRCS:%.c=%.d) "$(PLUGIN_FULLNAME)"
73         @$(MAKE) -C doc clean
74         @$(MAKE) -C "$(NMEALIB_PATH)" clean
75         @$(MAKE) -C "$(LIBRARY_PATH)" clean
76         @$(MAKE) -C "$(JAVA_PATH)" clean
77
78 doc:
79         @$(MAKE) -C doc all
80         @$(MAKE) -C "$(NMEALIB_PATH)" doc
81         @$(MAKE) -C "$(LIBRARY_PATH)" doc
82         @$(MAKE) -C "$(JAVA_PATH)" doc
83
84 doc-clean:
85         @$(MAKE) -C doc clean
86         @$(MAKE) -C "$(NMEALIB_PATH)" doc clean
87         @$(MAKE) -C "$(LIBRARY_PATH)" doc clean
88         @$(MAKE) -C "$(JAVA_PATH)" doc clean
89
90 nmealib:
91         @$(MAKE) -C "$(NMEALIB_PATH)" all
92
93 library:
94         @$(MAKE) -C "$(LIBRARY_PATH)" all
95
96 java:
97         @$(MAKE) -C "$(JAVA_PATH)" all
98
99 java-install: java
100         @$(MAKE) -C "$(JAVA_PATH)" DESTDIR="$(DESTDIR)" install
101
102 java-uninstall:
103         @$(MAKE) -C "$(JAVA_PATH)" DESTDIR="$(DESTDIR)" uninstall
104
105 endif