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