03345034c542850065d22de336c247078e708c9a
[olsrd.git] / lib / pud / Makefile
1 LIBRARY_PATH = wireformat
2 JAVA_PATH = wireformat-java
3 include $(LIBRARY_PATH)/Makefile.inc
4 LIBRARY_NAME := $(PROJECT)
5
6
7 include Makefile.inc
8
9 TOPDIR = ../..
10 include $(TOPDIR)/Makefile.inc
11
12
13 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_RX_NON_OLSR
14 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_OLSR
15 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_UPLINK
16 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_DOWNLINK
17
18 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_RX_OLSR
19 #CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_NON_OLSR
20
21 #CFLAGS += -DPUD_DUMP_AVERAGING
22 #CFLAGS += -DPUD_DUMP_DEDUP
23
24
25 CFLAGS += -Werror -D_GNU_SOURCE
26
27
28 VERSION_FILE = ./src/version.h
29 LIBRARY_INC = $(LIBRARY_PATH)/include
30 LIBRARY_LIB = $(LIBRARY_PATH)/lib
31
32 CFLAGS += -I $(LIBRARY_INC)
33 LIBS += -L $(LIBRARY_LIB) -lnmea -lm -l$(LIBRARY_NAME)
34
35 ifneq ($(OS),linux)
36
37 .PHONY: all default_target install clean
38
39 all: default_target
40
41 default_target install clean:
42         @echo "*** $(PLUGIN_NAME) plugin only supported on Linux, sorry!"
43
44 else
45
46 .PHONY: all default_target install uninstall clean doc doc-clean library java java-instal java-uninstall
47
48 all: default_target
49
50 default_target: library $(VERSION_FILE) $(PLUGIN_FULLNAME)
51
52 # repeat from toplevel Makefile.inc, and adjust: we need the library includes
53 %.d: %.c
54         @$(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' >"$@"
55
56 $(PLUGIN_FULLNAME): $(OBJS) version-script.txt
57         @echo "[LD] $@"
58         @$(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS)
59
60 $(VERSION_FILE): library scripts/makeVersionH
61         @./scripts/makeVersionH "$(VERSION_FILE)" "$(PLUGIN_VER)"
62
63 install: all
64         @$(MAKE) -C $(LIBRARY_PATH) DESTDIR=$(DESTDIR) install
65         $(INSTALL_LIB)
66         $(STRIP) "$(LIBDIR)/$(PLUGIN_FULLNAME)"
67
68 uninstall:
69         @$(MAKE) -C $(LIBRARY_PATH) DESTDIR=$(DESTDIR) uninstall
70         rm -f "$(LIBDIR)/lib$(PLUGIN_NAME).so" "$(LIBDIR)/$(PLUGIN_NAME)"
71         $(UNINSTALL_LIB)
72         rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
73
74 clean:
75         @echo "[$@]"
76         @rm -f $(OBJS) $(SRCS:%.c=%.d) "$(PLUGIN_FULLNAME)"
77         @$(MAKE) -C doc clean
78         @$(MAKE) -C $(LIBRARY_PATH) clean
79         @$(MAKE) -C $(JAVA_PATH) clean
80
81 doc:
82         @$(MAKE) -C doc all
83         @$(MAKE) -C $(LIBRARY_PATH) doc
84         @$(MAKE) -C $(JAVA_PATH) doc
85
86 doc-clean:
87         @$(MAKE) -C doc clean
88         @$(MAKE) -C $(LIBRARY_PATH) doc clean
89         @$(MAKE) -C $(JAVA_PATH) doc clean
90
91 library:
92         @$(MAKE) -C $(LIBRARY_PATH) all
93
94 java:
95         @$(MAKE) -C $(JAVA_PATH) all
96
97 java-install: java
98         @$(MAKE) -C $(JAVA_PATH) DESTDIR=$(DESTDIR) install
99
100 java-uninstall:
101         @$(MAKE) -C $(JAVA_PATH) DESTDIR=$(DESTDIR) uninstall
102
103 endif