diff options
author | Jan Engelhardt <jengelh@inai.de> | 2018-06-27 11:50:41 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-07-02 18:07:13 +0200 |
commit | df0620e7ccb2026a3e18634632f4be5314075906 (patch) | |
tree | aa55ba4bf626cc35d43b3d9a15423c240030e263 /Makefile | |
parent | 4f3c04785c807623c483b184e534b935c7580153 (diff) |
extensions: use __attribute__((constructor)) for autoregistration
The ebtables initialization is easier, and, judging from the "static"
recipe in Makefile, that calling ebt_*_register ahead of main is
safe.
This means that a static build won't need the pseudomain hack,
and that -nostartfiles can also go away.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 34 |
1 files changed, 1 insertions, 33 deletions
@@ -116,39 +116,7 @@ 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) $(LDFLAGS) $(PROGSPECS) -o $@ $^ -I$(KERNEL_INCLUDES) -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 + $(CC) $(CFLAGS) $(LDFLAGS) $(PROGSPECS) -o $@ $^ -I$(KERNEL_INCLUDES) -Iinclude tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g') tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g') |