1 # $Id: Makefile 8654 2011-05-23 08:39:50Z marta $
3 # Top level makefile for building ipfw kernel and userspace.
4 # You can run it manually or also under the Planetlab build.
5 # Planetlab wants also the 'install' target.
7 # To build on system with non standard Kernel sources or userland files,
8 # you should run this with
10 # make KERNELPATH=/path/to/linux-2.x.y.z USRDIR=/path/to/usr
12 # We assume that $(USRDIR) contains include/ and lib/ used to build userland.
14 DATE ?= $(shell date +%Y%m%d)
15 SNAPSHOT_NAME=$(DATE)-ipfw3.tgz
16 BINDIST=$(DATE)-dummynet-linux.tgz
17 WINDIST=$(DATE)-dummynet-windows.zip
19 ###########################################
20 # windows x86 and x64 specific variables #
21 ###########################################
22 # DRIVE must be the hard drive letter where DDK is installed
23 # DDKDIR must be the path to the DDK root directory, without drive letter
24 # TARGETOS (x64 only) must be one of the following:
25 # wnet -> windows server 2003
26 # wlh -> windows vista and windows server 2008
28 # future version must be added here
33 DDKDIR = /WinDDK/7600.16385.1
34 DDK = $(DRIVE)$(DDKDIR)
42 (cd ipfw && $(MAKE) $(@) )
43 (cd dummynet2 && $(MAKE) $(@) )
51 (cd ipfw && $(MAKE) $(@) )
52 (cd dummynet2 && $(MAKE) $(@) )
54 - [ -f ipfw/ipfw.exe ] && cp ipfw/ipfw.exe binary/ipfw.exe
55 - [ -f dummynet2/objchk_wxp_x86/i386/ipfw.sys ] && \
56 cp dummynet2/objchk_wxp_x86/i386/ipfw.sys binary/ipfw.sys
60 (cd ..; tar cvzhf /tmp/$(SNAPSHOT_NAME) --exclude .svn \
61 --exclude README.openwrt --exclude tags --exclude NOTES \
62 --exclude tcc-0.9.25-bsd \
63 --exclude original_passthru \
64 --exclude ipfw3.diff --exclude add_rules \
65 --exclude test --exclude test_ \
71 tar cvzf /tmp/$(BINDIST) ipfw/ipfw ipfw/ipfw.8 dummynet2/ipfw_mod.ko
77 zip -r /tmp/$(WINDIST) binary -x \*.svn\*
80 (cd dummynet2 && $(MAKE) include_e)
82 echo "EXTRA_CFLAGS += -D_X64EMU" >> ipfw-64/Makefile
83 (cd ipfw-64 && $(MAKE) all)
84 cp -r dummynet2 dummynet2-64
85 rm -f dummynet2-64/Makefile
86 cp win64/sources dummynet2-64/sources
87 mkdir dummynet2-64/tmpbuild
89 win64/mysetenv.sh $(DRIVE) $(DDKDIR) $(TARGETOS)
90 cp binary/cygwin1.dll binary64/cygwin1.dll
91 cp ipfw-64/ipfw.exe binary64/ipfw.exe
92 cp win64/*.inf binary64
93 cp binary/testme.bat binary64/testme.bat
94 cp binary/wget.exe binary64/wget.exe
97 # clean and create a local working directory
99 mkdir -p /tmp/pl-tmp/pl
100 mkdir -p /tmp/pl-tmp/ol2
101 # get the trunk version of the PlanetLab repository
102 # to specify the sshkey use the .ssh/config file
103 (cd /tmp/pl-tmp/pl; \
104 svn co svn+ssh://svn.planet-lab.org/svn/ipfw/trunk)
105 # get an updated copy of the main ipfw repository
106 (cd /tmp/pl-tmp/ol2; \
107 svn export svn+ssh://onelab2.iet.unipi.it/home/svn/ports-luigi/dummynet-branches/ipfw3)
108 # copy the new version over the old one
109 (cd /tmp/pl-tmp; cp -rP ol2/ipfw3/* pl/trunk)
110 # files cleanup in the old version
111 (cd /tmp/pl-tmp; diff -r ol2/ipfw3 pl/trunk | \
112 grep -v "svn" | awk '{print $$3 $$4}' | \
113 sed 's/:/\//' | xargs rm -rf)
114 # local adjustmens here
115 rm -rf /tmp/pl-tmp/pl/trunk/planetlab/check_planetlab_sync
116 # commit to the remote repo
117 @echo "Please, revise the update with the commands:"
118 @echo "(cd /tmp/pl-tmp/pl/trunk; svn diff)"
119 @echo "(cd /tmp/pl-tmp/pl/trunk; svn status)"
120 @echo "and commit with:"
121 @echo "(cd /tmp/pl-tmp/pl/trunk; svn ci -m 'Update from the mail ipfw repo.')"
124 # create a temporary directory
125 $(eval TMPDIR := $(shell mktemp -d -p /tmp/ ipfw3_openwrt_XXXXX))
126 # create the source destination directory
127 $(eval IPFWDIR := ipfw3-$(DATE))
128 $(eval DSTDIR := $(TMPDIR)/$(IPFWDIR))
130 # copy the package, clean objects and svn info
131 cp -r ./ipfw ./dummynet2 glue.h Makefile ./configuration README $(DSTDIR)
132 (cd $(DSTDIR); make -s distclean; find . -name .svn | xargs rm -rf)
133 (cd $(TMPDIR); tar czf $(IPFWDIR).tar.gz $(IPFWDIR))
135 # create the port files in /tmp/ipfw3-port
136 $(eval PORTDIR := $(TMPDIR)/ipfw3)
137 mkdir -p $(PORTDIR)/patches
138 # generate the Makefile, PKG_VERSION and PKG_MD5SUM
139 md5sum $(DSTDIR).tar.gz | cut -d ' ' -f 1 > $(TMPDIR)/md5sum
140 cat ./OPENWRT/Makefile | \
141 sed s/PKG_VERSION:=/PKG_VERSION:=$(DATE)/ | \
142 sed s/PKG_MD5SUM:=/PKG_MD5SUM:=`cat $(TMPDIR)/md5sum`/ \
143 > $(PORTDIR)/Makefile
146 @echo "The openwrt port is in $(TMPDIR)/ipfw3-port"
147 @echo "The source file should be copied to the public server:"
148 @echo "scp $(DSTDIR).tar.gz marta@info.iet.unipi.it:~marta/public_html/dummynet"
149 @echo "after this the temporary directory $(TMPDIR) can be removed."