PUD: always use /usr/lib for libraries
[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 LIBS = -lm
19 INCS = -I ./include
20
21
22 #
23 # Targets
24 #
25
26 all: all-before lib/$(LIBNAME)
27
28 remake: clean all
29
30 lib/$(LIBNAME): $(OBJ)
31         @echo "[LD] $@"
32         @$(CC) -shared -Wl,-soname=$(LIBNAME) -o lib/$(LIBNAME) $(OBJ) -lc
33
34 build/%.o: src/%.c Makefile Makefile.inc
35         @echo "[CC] $<"
36         @$(CC) $(CCFLAGS) $(INCS) -c $< -o $@
37
38 samples: all
39         $(MAKE) -C samples all
40
41
42 #
43 # Phony Targets
44 #
45
46 .PHONY: all-before clean doc install install-headers uninstall uninstall-headers
47
48 all-before:
49         @mkdir -p build lib
50
51 clean:
52         $(MAKE) -C doc clean
53         $(MAKE) -C samples clean
54         rm -fr build lib
55
56 doc:
57         $(MAKE) -C doc all
58
59 install: all
60         @mkdir -v -p "$(DESTDIR)/$(LIBDIR_INSTALL)"
61         cp "lib/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
62         $(STRIP) "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
63         ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
64
65 install-headers: all
66         @mkdir -v -p "$(DESTDIR)/$(INCLUDEDIR)"
67         @rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
68         cp -r include/nmea "$(DESTDIR)/$(INCLUDEDIR)"
69
70 uninstall:
71         rm -f "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME)" "$(DESTDIR)/$(LIBDIR_INSTALL)/$(LIBNAME).$(VERSION)"
72         ldconfig -n "$(DESTDIR)/$(LIBDIR_INSTALL)"
73         @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(LIBDIR_INSTALL)"
74
75 uninstall-headers:
76         rm -fr "$(DESTDIR)/$(INCLUDEDIR)/nmea"
77         @rmdir -v -p --ignore-fail-on-non-empty "$(DESTDIR)/$(INCLUDEDIR)"