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