pud: include nmealib v1.0.0
[olsrd.git] / lib / pud / nmealib / Makefile
1 include ../Makefile.inc
2 OLSRD_PLUGIN = false
3
4 TOPDIR = ../../..
5 include $(TOPDIR)/Makefile.inc
6
7
8 include Makefile.inc
9
10 #
11 # Settings
12 #
13
14 LIBNAME = libnmea.so
15
16 DESTDIR ?=
17 USRDIR ?= $(DESTDIR)/usr
18 INCLUDEDIR ?= $(DESTDIR)/usr/include
19 LIBDIR ?= $(USRDIR)/lib
20
21
22 MODULES = context conversions generate generator gmath info parse parser sentence tok
23 OBJ = $(MODULES:%=build/%.o)
24
25 LIBRARIES = -lm
26 INCLUDES = -I ./include
27
28
29 #
30 # Targets
31 #
32
33 all: default_target
34
35 default_target: all-before lib/$(LIBNAME)
36
37 remake: clean all
38
39 lib/$(LIBNAME): $(OBJ)
40         @echo "[LD] $@"
41         @$(CC) -shared -Wl,-soname=$(LIBNAME) -o "$@" $(LIBRARIES) $(OBJ)
42
43 build/%.o: src/%.c Makefile Makefile.inc
44         @echo "[CC] $<"
45         @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
46
47 samples: all
48         @$(MAKE) -C samples all
49
50
51 #
52 # Phony Targets
53 #
54
55 .PHONY: all default_target all-before clean doc install install-headers uninstall uninstall-headers
56
57 all-before:
58         @mkdir -p build lib
59
60 clean:
61         @$(MAKE) -C doc clean
62         @$(MAKE) -C samples clean
63         @rm -frv build lib
64
65 doc:
66         @$(MAKE) -C doc all
67
68 doc-clean:
69         @$(MAKE) -C doc clean
70
71 install: all
72         @mkdir -v -p "$(LIBDIR)"
73         @cp -v "lib/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
74         @$(STRIP) "$(LIBDIR)/$(LIBNAME).$(VERSION)"
75         @ldconfig -n "$(LIBDIR)"
76
77 install-headers: all
78         @mkdir -v -p "$(INCLUDEDIR)"
79         @rm -fr "$(INCLUDEDIR)/nmea"
80         @cp -rv include/nmea "$(INCLUDEDIR)"
81
82 uninstall:
83         @rm -fv "$(LIBDIR)/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
84         @ldconfig -n "$(LIBDIR)"
85         @rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
86
87 uninstall-headers:
88         @rm -frv "$(INCLUDEDIR)/nmea"
89         @rmdir -v -p --ignore-fail-on-non-empty "$(INCLUDEDIR)"