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