PUD: include nmealib v0.6.7
[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 ifeq ($(strip $(MACHINE)),x86_64)
14   LIB64DIR := $(shell test -d "/usr/lib64" && echo "YES")
15   ifeq ($(strip $(LIB64DIR)),YES)
16     LIBDIR_INSTALL = usr/lib64
17   endif
18 endif
19 INCLUDEDIR = usr/include
20
21 MODULES = context generate generator gmath info parse parser sentence time tok util
22 OBJ = $(MODULES:%=build/%.o)
23
24 LIBS = -lm
25 INCS = -I ./include
26
27
28 #
29 # Targets
30 #
31
32 all: all-before lib/$(LIBNAME)
33
34 remake: clean all
35
36 lib/$(LIBNAME): $(OBJ)
37         @echo "[LD] $@"
38         @$(CC) -shared -Wl,-soname=$(LIBNAME) -o lib/$(LIBNAME) $(OBJ) -lc
39
40 build/%.o: src/%.c Makefile Makefile.inc
41         @echo "[CC] $<"
42         @$(CC) $(CCFLAGS) $(INCS) -c $< -o $@
43
44 samples: all
45         $(MAKE) -C samples all
46
47
48 #
49 # Phony Targets
50 #
51
52 .PHONY: all-before clean doc install install-headers uninstall uninstall-headers
53
54 all-before:
55         @mkdir -p build lib
56
57 clean:
58         $(MAKE) -C doc clean
59         $(MAKE) -C samples clean
60         rm -fr build lib
61
62 doc:
63         $(MAKE) -C doc all
64
65 install: all
66         @mkdir -v -p "$(DESTDIR)/$(LIBDIR_INSTALL)"
67         cp "lib/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
68         $(STRIP) "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
69         ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
70
71 install-headers: all
72         @mkdir -v -p "$(DESTDIR)/$(INCLUDEDIR)"
73         @rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
74         cp -r include/nmea "$(DESTDIR)/$(INCLUDEDIR)"
75
76 uninstall:
77         rm -f "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
78         ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
79         @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(LIBDIR_INSTALL)"
80
81 uninstall-headers:
82         rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
83         @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(INCLUDEDIR)"