1 # The olsr.org Optimized Link-State Routing daemon(olsrd)
2 # Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in
13 # the documentation and/or other materials provided with the
15 # * Neither the name of olsr.org, olsrd nor the names of its
16 # contributors may be used to endorse or promote products derived
17 # from this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
32 # Visit http://www.olsr.org for more information.
34 # If you find this software useful feel free to make a donation
35 # to the project. For more information see the website or contact
36 # the copyright holders.
38 # $Id: Makefile,v 1.44 2004/12/12 17:53:38 kattemat Exp $
53 SRCS = $(wildcard src/*.c)
54 HDRS = $(wildcard src/*.h)
56 CFGDIR = src/cfgparser
57 CFGOBJS = $(CFGDIR)/oscan.o $(CFGDIR)/oparse.o $(CFGDIR)/olsrd_conf.o
58 CFGDEPS = $(wildcard $(CFGDIR)/*.c) $(wildcard $(CFGDIR)/*.h) $(CFGDIR)/oparse.y $(CFGDIR)/oscan.lex
69 ifeq ($(OS), Windows_NT)
75 SRCS += $(wildcard src/linux/*.c) $(wildcard src/unix/*.c)
76 HDRS += $(wildcard src/linux/*.h) $(wildcard src/unix/*.h)
78 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
79 -O2 -g #-pg -DDEBUG #-march=i686
81 MAKEDEPEND = makedepend -f $(DEPFILE) $(DEFINES) -Y $(INCLUDES) $(SRCS) >/dev/null 2>&1
86 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
87 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
88 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
90 MAKEDEPEND = makedepend -f $(DEPFILE) -D__FreeBSD__ $(INCLUDES) $(SRCS)
95 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
96 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
97 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
99 MAKEDEPEND = makedepend -f $(DEPFILE) -D__NetBSD__ $(INCLUDES) $(SRCS)
104 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
105 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
106 DEFINES = -D__MacOSX__
107 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
109 MAKEDEPEND = makedepend -f $(DEPFILE) $(DEFINES) $(INCLUDES) $(SRCS)
114 SRCS += $(wildcard src/win32/*.c)
115 HDRS += $(wildcard src/win32/*.h)
116 INCLUDES += -Isrc/win32
118 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
120 LIBS = -mno-cygwin -lws2_32 -liphlpapi
121 MAKEDEPEND = makedepend -f $(DEPFILE) $(DEFINES) $(INCLUDES) $(SRCS)
123 olsr-${VERS}.zip: gui/win32/Main/Release/Switch.exe \
124 gui/win32/Shim/Release/Shim.exe \
126 src/cfgparser/olsrd_cfgparser.dll \
128 README-Link-Quality.html \
129 gui/win32/Inst/linux-manual.txt \
130 files/olsrd.conf.default.win32 \
131 gui/win32/Main/Default.olsr \
132 lib/dot_draw/olsrd_dot_draw.dll
134 $(STRIP) src/cfgparser/olsrd_cfgparser.dll
135 $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
136 rm -rf ${TEMP}/olsr-${VERS}
137 rm -f ${TEMP}/olsr-${VERS}.zip
138 rm -f olsr-${VERS}.zip
139 mkdir ${TEMP}/olsr-${VERS}
140 cp gui/win32/Main/Release/Switch.exe ${TEMP}/olsr-${VERS}
141 cp gui/win32/Shim/Release/Shim.exe ${TEMP}/olsr-${VERS}
142 cp olsrd.exe ${TEMP}/olsr-${VERS}
143 cp src/cfgparser/olsrd_cfgparser.dll ${TEMP}/olsr-${VERS}
144 cp README ${TEMP}/olsr-${VERS}
145 cp README-Link-Quality.html ${TEMP}/olsr-${VERS}
146 cp gui/win32/Inst/linux-manual.txt ${TEMP}/olsr-${VERS}
147 cp files/olsrd.conf.default.win32 ${TEMP}/olsr-${VERS}/olsrd.conf
148 cp gui/win32/Main/Default.olsr ${TEMP}/olsr-${VERS}
149 cp lib/dot_draw/olsrd_dot_draw.dll ${TEMP}/olsr-${VERS}
150 cd ${TEMP}; echo y | cacls olsr-${VERS} /T /G Everyone:F
151 cd ${TEMP}; zip -q -r olsr-${VERS}.zip olsr-${VERS}
152 cp ${TEMP}/olsr-${VERS}.zip .
153 rm -rf ${TEMP}/olsr-${VERS}
154 rm -f ${TEMP}/olsr-${VERS}.zip
156 olsr-${VERS}-setup.exe: gui/win32/Main/Release/Switch.exe \
157 gui/win32/Shim/Release/Shim.exe \
159 src/cfgparser/olsrd_cfgparser.dll \
161 README-Link-Quality.html \
162 gui/win32/Inst/linux-manual.txt \
163 files/olsrd.conf.default.win32 \
164 gui/win32/Main/Default.olsr \
165 lib/dot_draw/olsrd_dot_draw.dll \
166 gui/win32/Inst/installer.nsi
168 $(STRIP) src/cfgparser/olsrd_cfgparser.dll
169 $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
171 rm -f olsr-${VERS}-setup.exe
172 C:/Program\ Files/NSIS/makensis gui\win32\Inst\installer.nsi
173 mv olsr-setup.exe olsr-${VERS}-setup.exe
185 OBJS = $(patsubst %.c,%.o,$(SRCS))
186 override CFLAGS += $(INCLUDES) $(DEFINES)
190 olsrd: $(OBJS) $(CFGOBJS)
191 $(CC) -o $@ $(OBJS) $(CFGOBJS) $(LIBS)
193 $(DEPFILE): $(SRCS) $(HDRS)
195 @echo '# olsrd dependency file. AUTOGENERATED' > $(DEPFILE)
199 cfgparser: $(CFGDEPS)
205 .PHONY: help libs clean_libs clean uberclean install_libs install_bin install
209 @echo '***** olsr.org olsr daemon Make ****'
210 @echo ' You must provide a valid target OS '
211 @echo ' by setting the OS variable! Valid '
212 @echo ' target OSes are: '
213 @echo ' --------------------------------- '
214 @echo ' linux - GNU/Linux '
215 @echo ' win32 - MS Windows '
216 @echo ' fbsd - FreeBSD '
217 @echo ' nbsd - NetBSD '
218 @echo ' osx - Mac OS X '
219 @echo ' --------------------------------- '
220 @echo ' Example - build for windows: '
221 @echo ' make OS=win32 '
222 @echo ' If you are developing olsrd code, '
223 @echo ' exporting the OS variable might '
224 @echo ' be a good idea :-) Have fun! '
225 @echo '************************************'
229 rm -f $(OBJS) olsrd olsrd.exe
230 $(MAKE) -C src/cfgparser clean
232 uberclean: clean clean_libs
233 rm -f $(DEPFILE) $(DEPFILE).bak *~
234 rm -f src/*[o~] src/linux/*[o~] src/unix/*[o~] src/win32/*[o~]
236 $(MAKE) -C src/cfgparser uberclean
240 mkdir -p $(INSTALL_PREFIX)/usr/sbin
241 install -m 755 olsrd $(INSTALL_PREFIX)/usr/sbin
244 @echo olsrd uses the configfile $(INSTALL_PREFIX)/etc/olsr.conf
245 @echo a default configfile. A sample configfile
246 @echo can be installed
247 mkdir -p $(INSTALL_PREFIX)/etc
248 cp -i files/olsrd.conf.default $(INSTALL_PREFIX)/etc/olsrd.conf
249 @echo -------------------------------------------
250 @echo Edit $(INSTALL_PREFIX)/etc/olsrd.conf before running olsrd!!
251 @echo -------------------------------------------
252 @echo Installing manpages olsrd\(8\) and olsrd.conf\(5\)
253 mkdir -p $(INSTALL_PREFIX)/usr/share/man/man8/
254 cp files/olsrd.8.gz $(INSTALL_PREFIX)/usr/share/man/man8/olsrd.8.gz
255 mkdir -p $(INSTALL_PREFIX)/usr/share/man/man5/
256 cp files/olsrd.conf.5.gz $(INSTALL_PREFIX)/usr/share/man/man5/olsrd.conf.5.gz
265 $(MAKE) -C $$i clean; \
270 $(MAKE) -C $$i LIBDIR=$(INSTALL_PREFIX)/usr/lib install; \
274 $(TAGCMD) -o $(TAGFILE) $(SRCS) $(HDRS) $(wildcard src/cfgparser/*.c) $(wildcard src/cfgparser/*.h)