1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
--- olsrd-0.4.9/lib/httpinfo/Makefile.orig 2005-03-31 19:11:52.000000000 +0200
+++ olsrd-0.4.9/lib/httpinfo/Makefile 2005-04-25 13:42:11.000000000 +0200
@@ -1,103 +1,223 @@
-#######################################
-# HTTPINFO PLUGIN BY ANDREAS TØNNESEN #
-#######################################
+# The olsr.org Optimized Link-State Routing daemon(olsrd)
+# Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of olsr.org, olsrd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Visit http://www.olsr.org for more information.
+#
+# If you find this software useful feel free to make a donation
+# to the project. For more information see the website or contact
+# the copyright holders.
+#
+# $Id$
+PLUGIN_NAME = olsrd_httpinfo
+PLUGIN_VER = 0.1
CC ?= gcc
STRIP ?= strip
-LIBDIR ?= $(INSTALL_PREFIX)/usr/lib
-PLUGINFLAGS = -fPIC -DOLSR_PLUGIN -I../../src
+
+# default CFLAGS and LDFLAGS, used if not externally set
+
+# used for compilation: yes
+# used for dependency file generation: no
+
+CFLAGS_SET = -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes
+LDFLAGS_SET = -g
+
+# always appended to default or externally set CFLAGS and LDFLAGS
+
+# used for compilation: yes
+# used for dependency file generation: yes
+
+CFLAGS_ADD = -DOLSR_PLUGIN -I../../src
+LDFLAGS_ADD = -Wall -shared -Wl,--version-script=version-script.txt
+
+# same as CFLAGS_ADD, but not used for dependency file generation
+
+# used for compilation: yes
+# used for dependency file generation: no
+
+CFLAGS_ADD2 = # nothing
+
+DEPFILE = .depend
+
+SRCS = $(wildcard src/*.c)
+OBJS = $(patsubst %.c,%.o,$(SRCS))
+HDRS = $(wildcard src/*.c)
+
+ifndef OS
+all: help
+install: help
+clean: help
+endif
ifeq ($(OS), linux)
-NAME ?= olsrd_httpinfo.so.0.1
-NAMEFLAGS ?= -Wl,-soname,$(NAME)
-CFLAGS ?= -g -O2 -fPIC -DOLSR_PLUGIN -Dlinux -Wall -Wmissing-prototypes -Wstrict-prototypes
-LDFLAGS ?= -g -fPIC -shared
+
+NAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
+
+CFLAGS_ADD += -Dlinux
+CFLAGS_ADD2 += -fPIC
+LDFLAGS_ADD += -fPIC -Wl,-soname,$(NAME)
+
+CFLAGS_SET += # nothing
+LDFLAGS_SET += # nothing
+
LIBS ?= -lc -lm
-INSTALL_LIB = install -D -m 755 $(NAME) $(LIBDIR)/$(NAME);\
+
+LIBDIR ?= $(INSTALL_PREFIX)/usr/lib
+
+INSTALL_LIB = install -D -m 755 $(NAME) $(LIBDIR)/$(NAME); \
/sbin/ldconfig -n $(LIBDIR)
-all: plugin
-install: install_olsrd
-else
-ifeq ($(OS), win32)
-NAME ?= olsrd_httpinfo.dll
-NAMEFLAGS ?= -o $(NAME)
-CFLAGS ?= -g -O2 -fPIC -DWIN32 -mno-cygwin -I../../src/win32 -Wall -Wmissing-prototypes -Wstrict-prototypes
-LDFLAGS ?= -mno-cygwin -shared
-LIBS ?= -lws2_32
-COMPATOBJ = ../../src/win32/compat.o
-INSTALL_LIB = cp $(NAME) ../..
-all: plugin
-install: install_olsrd
+
+EXTRA_OBJS = # nothing
+
+MAKEDEPEND = makedepend -f $(DEPFILE) $(CFLAGS_ADD) -Y $(INCLUDES) \
+ $(SRCS) >/dev/null 2>&1
+
+all: all2
+install: install2
+clean: clean2
+
else
ifeq ($(OS), fbsd)
-NAME ?= olsrd_httpinfo.so.0.1
-NAMEFLAGS ?= -Wl,-soname,$(NAME)
-CFLAGS ?= -g -O2 -fPIC -Wall -Wmissing-prototypes -Wstrict-prototypes
-LDFLAGS ?= -g -fPIC -shared
+
+NAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
+
+CFLAGS_ADD += # nothing
+CFLAGS_ADD2 += -fPIC
+LDFLAGS_ADD += -fPIC -Wl,-soname,$(NAME)
+
+CFLAGS_SET += # nothing
+LDFLAGS_SET += # nothing
+
LIBS ?= -lc -lm
-INSTALL_LIB = install -m 755 $(NAME) $(LIBDIR)/$(NAME);\
+
+LIBDIR ?= $(INSTALL_PREFIX)/usr/lib
+
+INSTALL_LIB = install -m 755 $(NAME) $(LIBDIR)/$(NAME); \
/sbin/ldconfig
-all: plugin
-install: install_olsrd
+
+EXTRA_OBJS = # nothing
+
+MAKEDEPEND = makedepend -f $(DEPFILE) $(CFLAGS_ADD) $(INCLUDES) $(SRCS)
+
+all: all2
+install: install2
+clean: clean2
+
else
+ifeq ($(OS), win32)
+
+NAME ?= $(PLUGIN_NAME).dll
+
+CFLAGS_ADD += -mno-cygwin -I../../src/win32 -DWIN32
+CFLAGS_ADD2 += # nothing
+LDFLAGS_ADD += -mno-cygwin -Wl,-soname,$(NAME)
+
+CFLAGS_SET += # nothing
+LDFLAGS_SET += # nothing
+
+LIBS ?= -lws2_32
+
+INSTALL_LIB = cp $(NAME) ../..
+
+EXTRA_OBJS = ../../src/win32/compat.o
+
+MAKEDEPEND = makedepend -f $(DEPFILE) $(CFLAGS_ADD) $(INCLUDES) $(SRCS)
+
+all: all2
+install: install2
+clean: clean2
+
+else
+
all: help
-install:help
+install: help
+clean: help
+
endif
endif
endif
+EXTRA_OBJS += ../../src/cfgparser/cfgfile_gen.o
+
ifneq ($(ADMIN_INTERFACE), )
@echo 'WARNING - BUILDING WITH ADMIN INTERFACE!'
-CFLAGS += -DADMIN_INTERFACE
+CFLAGS_ADD += -DADMIN_INTERFACE
endif
-CFLAGS += $(PLUGINFLAGS)
-
-#Sourcefiles
-SRCS= src/olsrd_plugin.c src/olsrd_httpinfo.c src/admin_interface.c \
- ../../src/cfgparser/cfgfile_gen.c
-
-#Objectfiles
-OBJS= src/olsrd_plugin.o src/olsrd_httpinfo.o src/admin_interface.o \
- ../../src/cfgparser/cfgfile_gen.o
+CFLAGS ?= $(CFLAGS_SET)
+LDFLAGS ?= $(LDFLAGS_SET)
-#Headerfiles
-HDRS= src/olsrd_plugin.h src/olsrd_httpinfo.h \
- src/gfx.h src/html.h src/admin_interface.h src/admin_html.h
+CFLAGS += $(CFLAGS_ADD) $(CFLAGS_ADD2)
+LDFLAGS += $(LDFLAGS_ADD)
+all2: $(NAME)
-plugin: $(OBJS)
- $(CC) $(LDFLAGS) $(NAMEFLAGS) \
- -Wl,--version-script=version-script.txt \
- -o $(NAME) $(OBJS) $(COMPATOBJ) $(LIBS)
+$(NAME): $(OBJS) $(EXTRA_OBJS)
+ $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(EXTRA_OBJS) $(LIBS)
-
-install_olsrd:
+install2: $(NAME)
$(STRIP) $(NAME)
$(INSTALL_LIB)
+clean2:
+ rm -f $(OBJS) $(NAME) $(DEPFILE)
+
+$(DEPFILE): $(SRCS) $(HDRS)
+ifdef MAKEDEPEND
+ echo "# Generated automatically. DO NOT EDIT." >$(DEPFILE)
+ $(MAKEDEPEND)
+endif
+
help:
@echo
- @echo '***** olsr.org HTTP plugin Make ****'
- @echo ' You must provide a valid target OS '
- @echo ' by setting the OS variable! Valid '
- @echo ' target OSes are: '
- @echo ' --------------------------------- '
- @echo ' linux - GNU/Linux '
- @echo ' win32 - MS Windows '
- @echo ' fbsd - FreeBSD '
- @echo ' --------------------------------- '
- @echo ' Example - build for windows: '
- @echo ' make OS=win32 '
- @echo '************************************'
+ @echo ' * * * * olsr.org Plugin Make * * * *'
+ @echo
+ @echo ' Plugin: $(PLUGIN_NAME), version $(PLUGIN_VER)'
+ @echo
+ @echo ' You must provide a valid target OS by setting the OS variable.'
+ @echo
+ @echo ' Valid settings are:'
+ @echo
+ @echo ' linux - GNU/Linux'
+ @echo ' win32 - Microsoft Windows'
+ @echo ' fbsd - FreeBSD'
+ @echo
+ @echo ' Example - Build on Windows:'
+ @echo
+ @echo ' make OS=win32'
+ @echo
+ @echo ' Example - Build and install on Linux:'
+ @echo
+ @echo ' make OS=linux install '
@echo
-clean:
- rm -f $(OBJS) $(NAME)
-
-src/olsrd_plugin.o: $(HDRS)
-
-src/olsrd_httpinfo.o: $(HDRS)
-
-src/admin_interface.o: $(HDRS)
+sinclude $(DEPFILE)
|