pud: specify conversion base in readULL
[olsrd.git] / lib / pud / wireformat / Makefile
1 include Makefile.inc
2
3 include ../Makefile.inc
4 OLSRD_PLUGIN = false
5
6 TOPDIR = ../../..
7 include $(TOPDIR)/Makefile.inc
8
9 LDFLAGS = -shared -Wl,--warn-common -fPIC
10
11 # 32/64 cross compilation
12 ifdef M32
13 CFLAGS +=       -m32
14 LDFLAGS +=      -m32
15 endif
16 ifdef M64
17 CFLAGS +=       -m64
18 LDFLAGS +=      -m64
19 endif
20
21 ######################
22 #
23 # Settings
24 #
25 ######################
26
27 DESTDIR ?=
28 USRDIR ?= $(DESTDIR)/usr
29 INCLUDEDIR ?= $(DESTDIR)/usr/include
30 LIBDIR ?= $(USRDIR)/lib
31
32 BUILD_DIR = build
33 LIBDIR_BUILD = lib
34
35
36 INC_DIR_BASE_C = ./include
37 INC_DIR_C = $(INC_DIR_BASE_C)/$(PROJECT)
38 INC_DIR_OLSRD = ../../../src
39
40 MODULES = nodeIdConversion wireFormat
41
42 SRC_DIR_C = src
43 OBJECTS_C = $(MODULES:%=$(BUILD_DIR)/%.o)
44
45 INCLUDES = -I "$(INC_DIR_BASE_C)" -I "$(INC_DIR_OLSRD)"
46 LIBRARIES = -lm
47
48
49 .PHONY: all default_target prepare clean doc doc-clean install install-headers uninstall uninstall-headers
50
51 #
52 # Targets
53 #
54
55 all: default_target
56
57 default_target: prepare $(LIBDIR_BUILD)/$(SONAME)
58
59 $(LIBDIR_BUILD)/$(SONAME): $(OBJECTS_C)
60 ifeq ($(VERBOSE),0)
61         @echo "[LD] $@"
62 endif
63         $(MAKECMDPREFIX)$(CC) $(LDFLAGS) -Wl,-soname=$(SONAME) $(LIBRARIES) -o "$@" $(OBJECTS_C)
64
65 $(BUILD_DIR)/%.o: $(SRC_DIR_C)/%.c $(INC_DIR_C)/compiler.h
66 ifeq ($(VERBOSE),0)
67         @echo "[CC] $<"
68 endif
69         $(MAKECMDPREFIX)$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o "$@" "$<"
70
71 .gitignore:
72 ifeq ($(VERBOSE),0)
73         @echo "[$@]"
74 endif
75         $(MAKECMDPREFIX)echo "/$(BUILD_DIR)/" > $@
76         $(MAKECMDPREFIX)echo "/$(LIBDIR_BUILD)/" >> $@
77         $(MAKECMDPREFIX)$(MAKE) -C doc $@
78
79
80 #
81 # Phony Targets
82 #
83
84 prepare:
85         $(MAKECMDPREFIX)mkdir -p "$(BUILD_DIR)" "$(LIBDIR_BUILD)"
86
87 clean: doc-clean
88 ifeq ($(VERBOSE),0)
89         @echo "[$@]"
90 endif
91         $(MAKECMDPREFIX)rm -fr "$(BUILD_DIR)" "$(LIBDIR_BUILD)" "$(SRC_DIR_C)/"*.d
92
93 doc:
94         $(MAKECMDPREFIX)$(MAKE) -C doc all
95
96 doc-clean:
97         $(MAKECMDPREFIX)$(MAKE) -C doc clean
98
99 install: all
100         mkdir -v -p "$(LIBDIR)"
101         cp "$(LIBDIR_BUILD)/$(SONAME)" "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
102         $(STRIP) "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
103         /sbin/ldconfig -n "$(LIBDIR)"
104
105 install-headers:
106         rm -fr "$(INCLUDEDIR)/$(PROJECT)"
107         mkdir -v -p "$(INCLUDEDIR)/$(PROJECT)"
108         cp -t "$(INCLUDEDIR)/$(PROJECT)" $(INC_DIR_C)/*.h
109
110 uninstall:
111         rm -f "$(LIBDIR)/$(SONAME)" \
112               "$(LIBDIR)/$(SONAME).$(PLUGIN_VER)"
113         /sbin/ldconfig -n "$(LIBDIR)"
114         rmdir -v -p --ignore-fail-on-non-empty \
115           "$(LIBDIR)"
116
117 uninstall-headers:
118         rm -fr "$(INCLUDEDIR)/$(PROJECT)/"*.h
119         rmdir -v -p --ignore-fail-on-non-empty \
120           "$(INCLUDEDIR)/$(PROJECT)"