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.31 2004/11/30 17:12:28 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 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
88 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS)
93 SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
94 HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
95 DEFINES += -D__MacOSX__
96 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
98 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS)
103 SRCS += $(wildcard src/win32/*.c)
104 HDRS += $(wildcard src/win32/*.h)
105 INCLUDES += -Isrc/win32
107 CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
109 LIBS = -mno-cygwin -lws2_32 -liphlpapi
110 MAKEDEPEND = makedepend -f $(DEPFILE) $(INCLUDES) $(DEFINES) $(SRCS) >/dev/null 2>&1
112 olsr-${VERS}.zip: gui/win32/Main/Release/Switch.exe \
113 gui/win32/Shim/Release/Shim.exe \
115 src/cfgparser/olsrd_cfgparser.dll \
117 gui/win32/Inst/linux-manual.txt \
118 files/olsrd.conf.default.win32 \
119 gui/win32/Main/Default.olsr \
120 lib/dot_draw/olsrd_dot_draw.dll
121 rm -rf ${TEMP}/olsr-${VERS}
122 rm -f ${TEMP}/olsr-${VERS}.zip
123 rm -f olsr-${VERS}.zip
124 mkdir ${TEMP}/olsr-${VERS}
125 cp gui/win32/Main/Release/Switch.exe ${TEMP}/olsr-${VERS}
126 cp gui/win32/Shim/Release/Shim.exe ${TEMP}/olsr-${VERS}
127 cp olsrd.exe ${TEMP}/olsr-${VERS}
128 cp src/cfgparser/olsrd_cfgparser.dll ${TEMP}/olsr-${VERS}
129 cp README-WIN32.txt ${TEMP}/olsr-${VERS}
130 cp gui/win32/Inst/linux-manual.txt ${TEMP}/olsr-${VERS}
131 cp files/olsrd.conf.default.win32 ${TEMP}/olsr-${VERS}/olsrd.conf
132 cp gui/win32/Main/Default.olsr ${TEMP}/olsr-${VERS}
133 cp lib/dot_draw/olsrd_dot_draw.dll ${TEMP}/olsr-${VERS}
134 cd ${TEMP}; echo y | cacls olsr-${VERS} /T /G Everyone:F
135 cd ${TEMP}; zip -q -r olsr-${VERS}.zip olsr-${VERS}
136 cp ${TEMP}/olsr-${VERS}.zip .
137 rm -rf ${TEMP}/olsr-${VERS}
138 rm -f ${TEMP}/olsr-${VERS}.zip
140 olsr-${VERS}-setup.exe: gui/win32/Main/Release/Switch.exe \
141 gui/win32/Shim/Release/Shim.exe \
143 src/cfgparser/olsrd_cfgparser.dll \
145 gui/win32/Inst/linux-manual.txt \
146 files/olsrd.conf.default.win32 \
147 gui/win32/Main/Default.olsr \
148 lib/dot_draw/olsrd_dot_draw.dll \
149 gui/win32/Inst/installer.nsi
151 rm -f olsr-${VERS}-setup.exe
152 C:/Program\ Files/NSIS/makensis gui\win32\Inst\installer.nsi
153 mv olsr-setup.exe olsr-${VERS}-setup.exe
160 OBJS = $(patsubst %.c,%.o,$(SRCS))
161 override CFLAGS += $(INCLUDES) $(DEFINES)
165 olsrd: $(OBJS) $(CFGOBJS)
166 $(CC) -o $@ $(OBJS) $(CFGOBJS) $(LIBS)
168 $(DEPFILE): $(SRCS) $(HDRS)
170 @echo '# olsrd dependency file. AUTOGENERATED' > $(DEPFILE)
175 $(MAKE) -C src/cfgparser
178 .PHONY: help libs clean_libs clean uberclean install_libs install_bin install
182 @echo '***** olsr.org olsr daemon Make ****'
183 @echo ' You must provide a valid target OS '
184 @echo ' by setting the OS variable! Valid '
185 @echo ' target OSes are: '
186 @echo ' --------------------------------- '
187 @echo ' linux - GNU/Linux '
188 @echo ' win32 - MS Windows '
189 @echo ' fbsd - FreeBSD '
190 @echo ' osx - Mac OS X '
191 @echo ' --------------------------------- '
192 @echo ' Example - build for windows: '
193 @echo ' make OS=win32 '
194 @echo ' If you are developing olsrd code, '
195 @echo ' exporting the OS variable might '
196 @echo ' be a good idea :-) Have fun! '
197 @echo '************************************'
201 rm -f $(OBJS) olsrd olsrd.exe
202 $(MAKE) -C src/cfgparser clean
204 uberclean: clean clean_libs
205 rm -f $(DEPFILE) $(DEPFILE).bak
206 rm -f src/*[o~] src/linux/*[o~] src/unix/*[o~] src/win32/*[o~]
208 $(MAKE) -C src/cfgparser uberclean
212 mkdir -p $(INSTALL_PREFIX)/usr/sbin
213 install -m 755 olsrd $(INSTALL_PREFIX)/usr/sbin
216 @echo olsrd uses the configfile $(INSTALL_PREFIX)/etc/olsr.conf
217 @echo a default configfile. A sample configfile
218 @echo can be installed
219 mkdir -p $(INSTALL_PREFIX)/etc
220 cp -i files/olsrd.conf.default $(INSTALL_PREFIX)/etc/olsrd.conf
221 @echo -------------------------------------------
222 @echo Edit $(INSTALL_PREFIX)/etc/olsrd.conf before running olsrd!!
223 @echo -------------------------------------------
224 mkdir -p $(INSTALL_PREFIX)/usr/share/man/man8/
225 cp files/olsrd.8.gz $(INSTALL_PREFIX)/usr/share/man/man8/olsrd.8.gz
234 $(MAKE) -C $$i clean; \
239 $(MAKE) -C $$i LIBDIR=$(INSTALL_PREFIX)/usr/lib install; \