2cbe920b8cefec4e3d1f84ad8a892235f0a27c8d
[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 samples: all
59         $(MAKECMDPREFIX)$(MAKE) -C samples all
60
61
62 #
63 # Phony Targets
64 #
65
66 .PHONY: all default_target all-before clean doc install install-headers uninstall uninstall-headers
67
68 all-before:
69         $(MAKECMDPREFIX)mkdir -p build lib
70
71 clean:
72         $(MAKECMDPREFIX)$(MAKE) -C doc clean
73         $(MAKECMDPREFIX)$(MAKE) -C samples clean
74         $(MAKECMDPREFIX)rm -frv build lib
75
76 doc:
77         $(MAKECMDPREFIX)$(MAKE) -C doc all
78
79 doc-clean:
80         $(MAKECMDPREFIX)$(MAKE) -C doc clean
81
82 install: all
83         $(MAKECMDPREFIX)mkdir -v -p "$(LIBDIR)"
84         $(MAKECMDPREFIX)cp -v "lib/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
85         $(MAKECMDPREFIX)$(STRIP) "$(LIBDIR)/$(LIBNAME).$(VERSION)"
86         $(MAKECMDPREFIX)/sbin/ldconfig -n "$(LIBDIR)"
87
88 install-headers: all
89         $(MAKECMDPREFIX)mkdir -v -p "$(INCLUDEDIR)"
90         $(MAKECMDPREFIX)rm -fr "$(INCLUDEDIR)/nmea"
91         $(MAKECMDPREFIX)cp -rv include/nmea "$(INCLUDEDIR)"
92
93 uninstall:
94         $(MAKECMDPREFIX)rm -fv "$(LIBDIR)/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
95         $(MAKECMDPREFIX)/sbin/ldconfig -n "$(LIBDIR)"
96         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
97
98 uninstall-headers:
99         $(MAKECMDPREFIX)rm -frv "$(INCLUDEDIR)/nmea"
100         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(INCLUDEDIR)"