info: java: update workspace
[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 DESTDIR ?=
15 USRDIR ?= $(DESTDIR)/usr
16 INCLUDEDIR ?= $(DESTDIR)/usr/include
17 LIBDIR ?= $(USRDIR)/lib
18
19 H_FILES = $(sort $(wildcard include/nmealib/*.h))
20 C_FILES = $(sort $(wildcard src/*.c))
21
22 MODULES = $(C_FILES:src/%.c=%)
23
24 OBJ = $(MODULES:%=build/%.o)
25
26 LIBRARIES = -lm
27 INCLUDES = -I ./include
28
29
30 .PRECIOUS: $(OBJ)
31
32
33 #
34 # Targets
35 #
36
37 all: default_target
38
39 default_target: all-before lib/$(LIBNAMESTATIC) lib/$(LIBNAME)
40
41 remake: clean all
42
43 lib/$(LIBNAMESTATIC): $(OBJ)
44 ifeq ($(VERBOSE),0)
45         @echo "[AR] $@"
46 endif
47         $(MAKECMDPREFIX)ar rcs "$@" $(OBJ)
48
49 lib/$(LIBNAME): $(OBJ)
50 ifeq ($(VERBOSE),0)
51         @echo "[LD] $@"
52 endif
53         $(MAKECMDPREFIX)$(CC) $(LDFLAGS) -Wl,-soname=$(LIBNAME) -o "$@" $(LIBRARIES) $(OBJ)
54
55 build/%.o: src/%.c $(H_FILES) Makefile Makefile.inc
56 ifeq ($(VERBOSE),0)
57         @echo "[CC] $<"
58 endif
59         $(MAKECMDPREFIX)$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
60
61 full : all
62
63
64 #
65 # Phony Targets
66 #
67
68 .PHONY: all-before clean doc doc-pdf doc-all doc-clean install install-headers uninstall uninstall-headers
69
70 all-before:
71         $(MAKECMDPREFIX)mkdir -p build lib
72
73 clean:
74         $(MAKECMDPREFIX)$(MAKE) -C doc clean
75         $(MAKECMDPREFIX)rm -fr build lib
76
77 doc:
78         $(MAKECMDPREFIX)$(MAKE) -C doc doc
79
80 doc-pdf:
81         $(MAKECMDPREFIX)$(MAKE) -C doc doc-pdf
82
83 doc-all:
84         $(MAKECMDPREFIX)$(MAKE) -C doc all
85
86 doc-clean:
87         $(MAKECMDPREFIX)$(MAKE) -C doc clean
88
89 install: all
90         $(MAKECMDPREFIX)mkdir -v -p "$(LIBDIR)"
91         $(MAKECMDPREFIX)cp -v "lib/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
92         $(MAKECMDPREFIX)$(STRIP) "$(LIBDIR)/$(LIBNAME).$(VERSION)"
93         $(MAKECMDPREFIX)$(LDCONFIG) -n "$(LIBDIR)"
94
95 install-headers: all
96         $(MAKECMDPREFIX)mkdir -v -p "$(INCLUDEDIR)"
97         $(MAKECMDPREFIX)rm -fr "$(INCLUDEDIR)/nmealib"
98         $(MAKECMDPREFIX)cp -rv include/nmealib "$(INCLUDEDIR)"
99
100 uninstall:
101         $(MAKECMDPREFIX)rm -fv "$(LIBDIR)/$(LIBNAME)" "$(LIBDIR)/$(LIBNAME).$(VERSION)"
102         $(MAKECMDPREFIX)$(LDCONFIG) -n "$(LIBDIR)"
103         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(LIBDIR)"
104
105 uninstall-headers:
106         $(MAKECMDPREFIX)rm -frv "$(INCLUDEDIR)/nmealib"
107         $(MAKECMDPREFIX)rmdir -v -p --ignore-fail-on-non-empty "$(INCLUDEDIR)"
108