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