summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2006-02-06 21:24:02 +0000
committerBart De Schuymer <bdschuym@pandora.be>2006-02-06 21:24:02 +0000
commit7d9e3eb933ca0f1d4f2ff933f8f3b76cb894657a (patch)
treeaa2b0b384567e4b18a8dda33d35cdd5fc8e3edcd
parent4cd1da629a1200776239bb624473c70952c72a69 (diff)
downloadebtables-7d9e3eb933ca0f1d4f2ff933f8f3b76cb894657a.tar.gz
ebtables-7d9e3eb933ca0f1d4f2ff933f8f3b76cb894657a.tar.bz2
ebtables-7d9e3eb933ca0f1d4f2ff933f8f3b76cb894657a.zip
add make target for a static ebtables binary
-rw-r--r--INSTALL5
-rw-r--r--Makefile41
2 files changed, 44 insertions, 2 deletions
diff --git a/INSTALL b/INSTALL
index 1ea3648..7e1c78a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,6 +10,11 @@ If you are using the CVS code or need your own kernel includes, do this
instead (change the include directory to the appropriate one):
%make install KERNEL_INCLUDES=/usr/src/linux/include
+If you want to make a static binary for ebtables, containing all the
+extensions, without shared libraries, do this (this will make a
+binary called 'static', which you can rename):
+%make static
+
WHAT GETS INSTALLED?
--------------------
diff --git a/Makefile b/Makefile
index ad7a663..61cc3f2 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ include extensions/Makefile
OBJECTS2:=getethertype.o communication.o libebtc.o \
useful_functions.o ebtables.o
-OBJECTS:=$(OBJECTS2) ebtables.o $(EXT_OBJS) $(EXT_LIBS)
+OBJECTS:=$(OBJECTS2) $(EXT_OBJS) $(EXT_LIBS)
KERNEL_INCLUDES?=include/
@@ -117,6 +117,43 @@ ebtables-restore: $(OBJECTS) ebtables-restore.o libebtc
.PHONY: daemon
daemon: ebtablesd ebtablesu
+# a little scripting for a static binary, making one for ebtables-restore
+# should be completely analogous
+static: extensions/ebt_*.c extensions/ebtable_*.c ebtables.c communication.c ebtables-standalone.c getethertype.c libebtc.c useful_functions.c
+ cp ebtables-standalone.c ebtables-standalone.c_ ; \
+ cp include/ebtables_u.h include/ebtables_u.h_ ; \
+ sed "s/ main(/ pseudomain(/" ebtables-standalone.c > ebtables-standalone.c__ ; \
+ mv ebtables-standalone.c__ ebtables-standalone.c ; \
+ printf "\nint main(int argc, char *argv[])\n{\n " >> ebtables-standalone.c ; \
+ for arg in $(EXT_FUNC) \
+ ; do \
+ sed s/_init/_$${arg}_init/ extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \
+ mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \
+ printf "\t%s();\n" _$${arg}_init >> ebtables-standalone.c ; \
+ printf "extern void %s();\n" _$${arg}_init >> include/ebtables_u.h ; \
+ done ; \
+ for arg in $(EXT_TABLES) \
+ ; do \
+ sed s/_init/_t_$${arg}_init/ extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \
+ mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \
+ printf "\t%s();\n" _t_$${arg}_init >> ebtables-standalone.c ; \
+ printf "extern void %s();\n" _t_$${arg}_init >> include/ebtables_u.h ; \
+ done ; \
+ printf "\n\tpseudomain(argc, argv);\n\treturn 0;\n}\n" >> ebtables-standalone.c ;\
+ $(CC) $(CFLAGS) $(PROGSPECS) -o $@ $^ -Iinclude/ ; \
+ for arg in $(EXT_FUNC) \
+ ; do \
+ sed "s/ .*_init/ _init/" extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \
+ mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \
+ done ; \
+ for arg in $(EXT_TABLES) \
+ ; do \
+ sed "s/ .*_init/ _init/" extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \
+ mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \
+ done ; \
+ mv ebtables-standalone.c_ ebtables-standalone.c ; \
+ mv include/ebtables_u.h_ include/ebtables_u.h
+
tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g')
tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g')
tmp3:=$(shell printf $(PIPE) | sed 's/\//\\\//g')
@@ -152,7 +189,7 @@ install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec scripts
.PHONY: clean
clean:
- rm -f ebtables ebtables-restore ebtablesd ebtablesu
+ rm -f ebtables ebtables-restore ebtablesd ebtablesu static
rm -f *.o *~ *.so
rm -f extensions/*.o extensions/*.c~ extensions/*.so include/*~