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.30 2004/11/30 17:05:05 tlopatic Exp $
54 DEFINES = -DUSE_LINK_QUALITY
59 SRCS = $(wildcard src/*.c)
60 HDRS = $(wildcard src/*.h)
62 CFGDIR = src/cfgparser
63 CFGOBJS = $(CFGDIR)/oscan.o $(CFGDIR)/oparse.o $(CFGDIR)/olsrd_conf.o
73 SRCS += $(wildcard src/linux/*.c) $(wildcard src/unix/*.c)
74 HDRS += $(wildcard src/linux/*.h) $(wildcard src/unix/*.h)
76 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
77 -O2 -g #-pg -DDEBUG #-march=i686
79 MAKEDEPEND = makedepend -f $(DEPFILE) -Y $(INCLUDES) $(DEFINES) $(SRCS) >/dev/null 2>&1
84 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
85 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
86 DEFINES += -D__FreeBSD__
87 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
89 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS)
94 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
95 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
96 DEFINES += -D__MacOSX__
97 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
99 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS)
104 SRCS += $(wildcard src/win32/*.c)
105 HDRS += $(wildcard src/win32/*.h)
106 INCLUDES += -Isrc/win32
108 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
110 LIBS = -mno-cygwin -lws2_32 -liphlpapi
111 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS) >/dev/null 2>&1
113 olsr-${VERS}.zip: gui/win32/Main/Release/Switch.exe \
114 gui/win32/Shim/Release/Shim.exe \
116 src/cfgparser/olsrd_cfgparser.dll \
118 gui/win32/Inst/linux-manual.txt \
119 files/olsrd.conf.default.win32 \
120 gui/win32/Main/Default.olsr \
121 lib/dot_draw/olsrd_dot_draw.dll
122 rm -rf ${TEMP}/olsr-${VERS}
123 rm -f ${TEMP}/olsr-${VERS}.zip
124 rm -f olsr-${VERS}.zip
125 mkdir ${TEMP}/olsr-${VERS}
126 cp gui/win32/Main/Release/Switch.exe ${TEMP}/olsr-${VERS}
127 cp gui/win32/Shim/Release/Shim.exe ${TEMP}/olsr-${VERS}
128 cp olsrd.exe ${TEMP}/olsr-${VERS}
129 cp src/cfgparser/olsrd_cfgparser.dll ${TEMP}/olsr-${VERS}
130 cp README-WIN32.txt ${TEMP}/olsr-${VERS}
131 cp gui/win32/Inst/linux-manual.txt ${TEMP}/olsr-${VERS}
132 cp files/olsrd.conf.default.win32 ${TEMP}/olsr-${VERS}/olsrd.conf
133 cp gui/win32/Main/Default.olsr ${TEMP}/olsr-${VERS}
134 cp lib/dot_draw/olsrd_dot_draw.dll ${TEMP}/olsr-${VERS}
135 cd ${TEMP}; echo y | cacls olsr-${VERS} /T /G Everyone:F
136 cd ${TEMP}; zip -q -r olsr-${VERS}.zip olsr-${VERS}
137 cp ${TEMP}/olsr-${VERS}.zip .
138 rm -rf ${TEMP}/olsr-${VERS}
139 rm -f ${TEMP}/olsr-${VERS}.zip
141 olsr-${VERS}-setup.exe: gui/win32/Main/Release/Switch.exe \
142 gui/win32/Shim/Release/Shim.exe \
144 src/cfgparser/olsrd_cfgparser.dll \
146 gui/win32/Inst/linux-manual.txt \
147 files/olsrd.conf.default.win32 \
148 gui/win32/Main/Default.olsr \
149 lib/dot_draw/olsrd_dot_draw.dll \
150 gui/win32/Inst/installer.nsi
152 rm -f olsr-${VERS}-setup.exe
153 C:/Program\ Files/NSIS/makensis gui\win32\Inst\installer.nsi
154 mv olsr-setup.exe olsr-${VERS}-setup.exe
161 OBJS = $(patsubst %.c,%.o,$(SRCS))
162 override CFLAGS += $(INCLUDES) $(DEFINES)
166 olsrd: $(OBJS) $(CFGOBJS)
167 $(CC) -o $@ $(OBJS) $(CFGOBJS) $(LIBS)
169 $(DEPFILE): $(SRCS) $(HDRS)
171 @echo '# olsrd dependency file. AUTOGENERATED' > $(DEPFILE)
176 $(MAKE) -C src/cfgparser
179 .PHONY: help libs clean_libs clean uberclean install_libs install_bin install
183 @echo '***** olsr.org olsr daemon Make ****'
184 @echo ' You must provide a valid target OS '
185 @echo ' by setting the OS variable! Valid '
186 @echo ' target OSes are: '
187 @echo ' --------------------------------- '
188 @echo ' linux - GNU/Linux '
189 @echo ' win32 - MS Windows '
190 @echo ' fbsd - FreeBSD '
191 @echo ' osx - Mac OS X '
192 @echo ' --------------------------------- '
193 @echo ' Example - build for windows: '
194 @echo ' make OS=win32 '
195 @echo ' If you are developing olsrd code, '
196 @echo ' exporting the OS variable might '
197 @echo ' be a good idea :-) Have fun! '
198 @echo '************************************'
202 rm -f $(OBJS) olsrd olsrd.exe
203 $(MAKE) -C src/cfgparser clean
205 uberclean: clean clean_libs
206 rm -f $(DEPFILE) $(DEPFILE).bak
207 rm -f src/*[o~] src/linux/*[o~] src/unix/*[o~] src/win32/*[o~]
209 $(MAKE) -C src/cfgparser uberclean
213 mkdir -p $(INSTALL_PREFIX)/usr/sbin
214 install -m 755 olsrd $(INSTALL_PREFIX)/usr/sbin
217 @echo olsrd uses the configfile $(INSTALL_PREFIX)/etc/olsr.conf
218 @echo a default configfile. A sample configfile
219 @echo can be installed
220 mkdir -p $(INSTALL_PREFIX)/etc
221 cp -i files/olsrd.conf.default $(INSTALL_PREFIX)/etc/olsrd.conf
222 @echo -------------------------------------------
223 @echo Edit $(INSTALL_PREFIX)/etc/olsrd.conf before running olsrd!!
224 @echo -------------------------------------------
225 mkdir -p $(INSTALL_PREFIX)/usr/share/man/man8/
226 cp files/olsrd.8.gz $(INSTALL_PREFIX)/usr/share/man/man8/olsrd.8.gz
235 $(MAKE) -C $$i clean; \
240 $(MAKE) -C $$i LIBDIR=$(INSTALL_PREFIX)/usr/lib install; \