pud: update nmealib to 2.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 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 ifeq ($(VERBOSE),0)
42         @echo "[AR] $@"
43 endif
44         $(MAKECMDPREFIX)ar rcs "$@" $(OBJ)
45
46 lib/$(LIBNAME): $(OBJ)
47 ifeq ($(VERBOSE),0)
48         @echo "[LD] $@"
49 endif
50         $(MAKECMDPREFIX)$(CC) $(LDFLAGS) -Wl,-soname=$(LIBNAME) -o "$@" $(LIBRARIES) $(OBJ)
51
52 build/%.o: src/%.c Makefile Makefile.inc
53 ifeq ($(VERBOSE),0)
54         @echo "[CC] $<"
55 endif
56         $(MAKECMDPREFIX)$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
57
58
59 #
60 # Phony Targets
61 #
62
63 .PHONY: all default_target all-before clean doc install install-headers uninstall uninstall-headers
64
65 all-before:
66         $(MAKECMDPREFIX)mkdir -p build lib
67
68 clean:
69         $(MAKECMDPREFIX)$(MAKE) -C doc clean
70         $(MAKECMDPREFIX)rm -frv build lib
71
72 doc:
73         $(MAKECMDPREFIX)$(MAKE) -C doc all
74
75 doc-clean:
76         $(MAKECMDPREFIX)$(MAKE) -C doc clean
77
78 install: all
79         $(MAKECMDPREFIX)mkdir -v -p "$(LIBDIR)"
80         $(MAKECMDPREFIX)cp -v "lib/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
81         $(MAKECMDPREFIX)$(STRIP) "$(LIBDIR)/$(LIBNAME).$(VERSION)"
82         $(MAKECMDPREFIX)/sbin/ldconfig -n "$(LIBDIR)"
83
84 install-headers: all
85         $(MAKECMDPREFIX)mkdir -v -p "$(INCLUDEDIR)"
86         $(MAKECMDPREFIX)rm -fr "$(INCLUDEDIR)/nmea"
87         $(MAKECMDPREFIX)cp -rv include/nmea "$(INCLUDEDIR)"
88
89 uninstall:
90         $(MAKECMDPREFIX)rm -fv "$(LIBDIR)/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
91         $(MAKECMDPREFIX)/sbin/ldconfig -n "$(LIBDIR)"
92         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
93
94 uninstall-headers:
95         $(MAKECMDPREFIX)rm -frv "$(INCLUDEDIR)/nmea"
96         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(INCLUDEDIR)"