From 7d9e3eb933ca0f1d4f2ff933f8f3b76cb894657a Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Mon, 6 Feb 2006 21:24:02 +0000 Subject: add make target for a static ebtables binary --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'Makefile') 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/*~ -- cgit v1.2.3