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