* distribute information about (upstream) DNS servers
[olsrd.git] / Makefile
index a72d203..84f4c76 100644 (file)
--- a/Makefile
+++ b/Makefile
 # to the project. For more information see the website or contact
 # the copyright holders.
 #
-# $Id: Makefile,v 1.37 2004/12/01 21:15:49 kattemat Exp $
+# $Id: Makefile,v 1.51 2005/03/10 06:55:44 kattemat Exp $
 
-VERS =         0.4.8
+VERS =         0.4.9
 
 CC ?=          gcc
 STRIP ?=       strip
 BISON ?=       bison
 FLEX ?=                flex
 
+CCWARNINGS = -Wall -Wmissing-prototypes -Wstrict-prototypes \
+             -Wmissing-declarations -Wsign-compare
+
 INSTALL_PREFIX ?=
 
-DEFINES =      -DUSE_LINK_QUALITY
 INCLUDES =     -Isrc
 
 DEPFILE =      .depend
@@ -56,6 +58,7 @@ HDRS =                $(wildcard src/*.h)
 
 CFGDIR =       src/cfgparser
 CFGOBJS =      $(CFGDIR)/oscan.o $(CFGDIR)/oparse.o $(CFGDIR)/olsrd_conf.o
+CFGDEPS =      $(wildcard $(CFGDIR)/*.c) $(wildcard $(CFGDIR)/*.h) $(CFGDIR)/oparse.y $(CFGDIR)/oscan.lex
 
 TAGCMD ?=      etags   
 TAGFILE ?=     src/TAGS
@@ -63,17 +66,20 @@ TAGFILE ?=  src/TAGS
 ifndef OS
 all:           help
 else
-all:           olsrd
+all:           cfgparser olsrd
+endif
+
+ifeq ($(OS), Windows_NT)
+OS =           win32
 endif
 
 ifeq ($(OS), linux)
 
 SRCS +=        $(wildcard src/linux/*.c) $(wildcard src/unix/*.c)
 HDRS +=                $(wildcard src/linux/*.h) $(wildcard src/unix/*.h)
-DEFINES +=     -Dlinux
-CFLAGS ?=      -Wall -Wmissing-prototypes -Wstrict-prototypes \
-               -O2 -g #-pg -DDEBUG #-march=i686
-LIBS =         -lm -ldl
+DEFINES =      -Dlinux
+CFLAGS ?=      $(CCWARNINGS) -O2 -g #-DDEBUG #-pg #-march=i686
+LIBS =         -lm -ldl #-pg
 MAKEDEPEND =   makedepend -f $(DEPFILE) $(DEFINES) -Y $(INCLUDES) $(SRCS) >/dev/null 2>&1
 
 else
@@ -81,17 +87,35 @@ ifeq ($(OS), fbsd)
 
 SRCS +=                $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
 HDRS +=                $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
-CFLAGS ?=      -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
+CFLAGS ?=      $(CCWARNINGS) -O2 -g
 LIBS =         -lm
 MAKEDEPEND =   makedepend -f $(DEPFILE) -D__FreeBSD__ $(INCLUDES) $(SRCS)
 
+else
+ifeq ($(OS), fbsd-ll)
+
+SRCS +=                $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
+HDRS +=                $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
+CFLAGS ?=      -Wall -Wmissing-prototypes -O2 -g -DSPOOF -I/usr/local/include
+LIBS =         -lm -L/usr/local/lib -lnet
+MAKEDEPEND =   makedepend -f $(DEPFILE) -D__FreeBSD__ $(INCLUDES) $(SRCS)
+
+else
+ifeq ($(OS), nbsd)
+
+SRCS +=                $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
+HDRS +=                $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
+CFLAGS ?=      $(CCWARNINGS) -O2 -g
+LIBS =         -lm
+MAKEDEPEND =   makedepend -f $(DEPFILE) -D__NetBSD__ $(INCLUDES) $(SRCS)
+
 else
 ifeq ($(OS), osx)
 
 SRCS +=                $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
 HDRS +=                $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
-DEFINES +=     -D__MacOSX__
-CFLAGS ?=      -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g 
+DEFINES      -D__MacOSX__
+CFLAGS ?=      $(CCWARNINGS) -O2 -g 
 LIBS =         -lm -ldl
 MAKEDEPEND =   makedepend -f $(DEPFILE) $(DEFINES) $(INCLUDES) $(SRCS)
 
@@ -101,9 +125,8 @@ ifeq ($(OS), win32)
 SRCS +=                $(wildcard src/win32/*.c)
 HDRS +=                $(wildcard src/win32/*.h)
 INCLUDES +=    -Isrc/win32
-DEFINES +=     -DWIN32
-CFLAGS ?=      -Wall -Wmissing-prototypes -Wstrict-prototypes \
-               -mno-cygwin -O2 -g
+DEFINES =      -DWIN32
+CFLAGS ?=      $(CCWARNINGS) -mno-cygwin -O2 -g
 LIBS =         -mno-cygwin -lws2_32 -liphlpapi
 MAKEDEPEND =   makedepend -f $(DEPFILE) $(DEFINES) $(INCLUDES) $(SRCS)
 
@@ -111,14 +134,19 @@ olsr-${VERS}.zip: gui/win32/Main/Release/Switch.exe \
                gui/win32/Shim/Release/Shim.exe \
                olsrd.exe \
                src/cfgparser/olsrd_cfgparser.dll \
-               README-WIN32.txt \
+               README \
+               README-Link-Quality.html \
                gui/win32/Inst/linux-manual.txt \
                files/olsrd.conf.default.win32 \
                gui/win32/Main/Default.olsr \
-               lib/dot_draw/olsrd_dot_draw.dll
+               lib/dot_draw/olsrd_dot_draw.dll \
+               lib/nameservice/olsrd_nameservice.dll \
+               lib/httpinfo/olsrd_httpinfo.dll
                $(STRIP) olsrd.exe
                $(STRIP) src/cfgparser/olsrd_cfgparser.dll
                $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
+               $(STRIP) lib/nameservice/olsrd_nameservice.dll
+               $(STRIP) lib/httpinfo/olsrd_httpinfo.dll
                rm -rf ${TEMP}/olsr-${VERS}
                rm -f ${TEMP}/olsr-${VERS}.zip
                rm -f olsr-${VERS}.zip
@@ -127,11 +155,14 @@ olsr-${VERS}.zip: gui/win32/Main/Release/Switch.exe \
                cp gui/win32/Shim/Release/Shim.exe ${TEMP}/olsr-${VERS}
                cp olsrd.exe ${TEMP}/olsr-${VERS}
                cp src/cfgparser/olsrd_cfgparser.dll ${TEMP}/olsr-${VERS}
-               cp README-WIN32.txt ${TEMP}/olsr-${VERS}
+               cp README ${TEMP}/olsr-${VERS}
+               cp README-Link-Quality.html ${TEMP}/olsr-${VERS}
                cp gui/win32/Inst/linux-manual.txt ${TEMP}/olsr-${VERS}
                cp files/olsrd.conf.default.win32 ${TEMP}/olsr-${VERS}/olsrd.conf
                cp gui/win32/Main/Default.olsr ${TEMP}/olsr-${VERS}
                cp lib/dot_draw/olsrd_dot_draw.dll ${TEMP}/olsr-${VERS}
+               cp lib/nameservice/olsrd_nameservice.dll ${TEMP}/olsr-${VERS}
+               cp lib/httpinfo/olsrd_httpinfo.dll ${TEMP}/olsr-${VERS}
                cd ${TEMP}; echo y | cacls olsr-${VERS} /T /G Everyone:F
                cd ${TEMP}; zip -q -r olsr-${VERS}.zip olsr-${VERS}
                cp ${TEMP}/olsr-${VERS}.zip .
@@ -142,25 +173,40 @@ olsr-${VERS}-setup.exe:   gui/win32/Main/Release/Switch.exe \
                gui/win32/Shim/Release/Shim.exe \
                olsrd.exe \
                src/cfgparser/olsrd_cfgparser.dll \
-               README-WIN32.txt \
+               README \
+               README-Link-Quality.html \
                gui/win32/Inst/linux-manual.txt \
                files/olsrd.conf.default.win32 \
                gui/win32/Main/Default.olsr \
                lib/dot_draw/olsrd_dot_draw.dll \
+               lib/nameservice/olsrd_nameservice.dll \
+               lib/httpinfo/olsrd_httpinfo.dll \
                gui/win32/Inst/installer.nsi
                $(STRIP) olsrd.exe
                $(STRIP) src/cfgparser/olsrd_cfgparser.dll
                $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
+               $(STRIP) lib/nameservice/olsrd_nameservice.dll
+               $(STRIP) lib/httpinfo/olsrd_httpinfo.dll
                rm -f olsr-setup.exe
                rm -f olsr-${VERS}-setup.exe
                C:/Program\ Files/NSIS/makensis gui\win32\Inst\installer.nsi
                mv olsr-setup.exe olsr-${VERS}-setup.exe
 
+else
+
+all:   help
+
+endif
+endif
 endif
 endif
 endif
 endif
 
+ifneq ($(NODEBUG), )
+CFLAGS += -DNODEBUG
+endif
+
 OBJS = $(patsubst %.c,%.o,$(SRCS))
 override CFLAGS += $(INCLUDES) $(DEFINES)
 export CFLAGS
@@ -175,9 +221,11 @@ ifdef MAKEDEPEND
                $(MAKEDEPEND)
 endif
 
-$(CFGOBJS):
-               $(MAKE) -C src/cfgparser
+cfgparser:     $(CFGDEPS)
+               $(MAKE) -C $(CFGDIR)
 
+$(CFGOBJS):
+               $(MAKE) -C $(CFGDIR)
 
 .PHONY: help libs clean_libs clean uberclean install_libs install_bin install
 
@@ -191,6 +239,7 @@ help:
        @echo ' linux - GNU/Linux                  '
        @echo ' win32 - MS Windows                 '
        @echo ' fbsd  - FreeBSD                    '
+       @echo ' nbsd  - NetBSD                     '
        @echo ' osx   - Mac OS X                   '
        @echo ' ---------------------------------  '
        @echo ' Example - build for windows:       '
@@ -206,7 +255,7 @@ clean:
                $(MAKE) -C src/cfgparser clean
 
 uberclean:     clean clean_libs
-               rm -f $(DEPFILE) $(DEPFILE).bak
+               rm -f $(DEPFILE) $(DEPFILE).bak *~
                rm -f src/*[o~] src/linux/*[o~] src/unix/*[o~] src/win32/*[o~]
                rm -f src/bsd/*[o~] 
                $(MAKE) -C src/cfgparser uberclean
@@ -231,6 +280,10 @@ install:   install_bin
                mkdir -p $(INSTALL_PREFIX)/usr/share/man/man5/
                cp files/olsrd.conf.5.gz $(INSTALL_PREFIX)/usr/share/man/man5/olsrd.conf.5.gz
 
+#
+# PLUGINS
+#
+
 libs: 
                for i in lib/*; do \
                        $(MAKE) -C $$i; \
@@ -246,7 +299,36 @@ install_libs:
                        $(MAKE) -C $$i LIBDIR=$(INSTALL_PREFIX)/usr/lib install; \
                done;   
 
+httpinfo:
+               $(MAKE) -C lib/httpinfo clean
+               $(MAKE) -C lib/httpinfo 
+               $(MAKE) -C lib/httpinfo install 
+
+dot_draw:
+               $(MAKE) -C lib/dot_draw clean
+               $(MAKE) -C lib/dot_draw install
+
+nameservice:
+               $(MAKE) -C lib/nameservice clean
+               $(MAKE) -C lib/nameservice install
+
+dyn_gw:
+               $(MAKE) -C lib/dyn_gw clean
+               $(MAKE) -C lib/dyn_gw
+               $(MAKE) -C lib/dyn_gw install
+
+powerinfo:
+               $(MAKE) -C lib/powerinfo clean
+               $(MAKE) -C lib/powerinfo 
+               $(MAKE) -C lib/powerinfo install
+
+secure:
+               $(MAKE) -C lib/secure clean
+               $(MAKE) -C lib/secure
+               $(MAKE) -C lib/secure install
+
+
 tags:
-               $(TAGCMD) -o $(TAGFILE) $(SRCS) $(HDRS)
+               $(TAGCMD) -o $(TAGFILE) $(SRCS) $(HDRS) $(wildcard src/cfgparser/*.c) $(wildcard src/cfgparser/*.h)
 
 sinclude       $(DEPFILE)