From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: "Maciej Żenczykowski" <maze@google.com>
Cc: netfilter-devel@vger.kernel.org, "Maciej Żenczykowski" <maze@google.com>
Subject: [PATCH 2/3] Move common parts of libext{4,6}.a into libext.a
Date: Tue, 19 Apr 2011 18:44:45 -0700 [thread overview]
Message-ID: <1303263886-5665-2-git-send-email-zenczykowski@gmail.com> (raw)
In-Reply-To: <BANLkTimsGzmOnXR1otTvnKBYAS7m=91+uA@mail.gmail.com>
From: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Maciej Zenczykowski <maze@google.com>
---
.gitignore | 1 +
Makefile.am | 8 +++++-
extensions/GNUmakefile.in | 53 ++++++++++++++++++++++++++++++++++-----------
include/xtables.h.in | 1 +
ip6tables-restore.c | 1 +
ip6tables-save.c | 1 +
ip6tables-standalone.c | 1 +
iptables-restore.c | 1 +
iptables-save.c | 1 +
iptables-standalone.c | 1 +
10 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/.gitignore b/.gitignore
index e5d3099..9b59e6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ Makefile
Makefile.in
/extensions/GNUmakefile
+/extensions/initext.c
/extensions/initext?.c
/extensions/matches?.man
/extensions/targets?.man
diff --git a/Makefile.am b/Makefile.am
index fbed41f..6affcac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,7 +45,9 @@ if ENABLE_STATIC
iptables_multi_CFLAGS += -DALL_INCLUSIVE
endif
iptables_multi_LDFLAGS = -rdynamic
-iptables_multi_LDADD = libiptc/libip4tc.la extensions/libext4.a libxtables.la -lm
+iptables_multi_LDADD = libiptc/libip4tc.la \
+ extensions/libext.a extensions/libext4.a \
+ libxtables.la -lm
ip6tables_multi_SOURCES = ip6tables-multi.c ip6tables-save.c \
ip6tables-restore.c ip6tables-standalone.c \
@@ -55,7 +57,9 @@ if ENABLE_STATIC
ip6tables_multi_CFLAGS += -DALL_INCLUSIVE
endif
ip6tables_multi_LDFLAGS = -rdynamic
-ip6tables_multi_LDADD = libiptc/libip6tc.la extensions/libext6.a libxtables.la -lm
+ip6tables_multi_LDADD = libiptc/libip6tc.la \
+ extensions/libext.a extensions/libext6.a \
+ libxtables.la -lm
sbin_PROGRAMS =
man_MANS = iptables.8 iptables-restore.8 iptables-save.8 \
diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index 0e562fb..a511a39 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -51,11 +51,13 @@ pf6_solibs := $(patsubst %,libip6t_%.so,${pf6_build_mod})
#
# Building blocks
#
-targets := libext4.a libext6.a matches4.man matches6.man \
+targets := libext.a libext4.a libext6.a \
+ matches4.man matches6.man \
targets4.man targets6.man
targets_install :=
-@ENABLE_STATIC_TRUE@ libext4_objs := ${pfx_objs} ${pf4_objs}
-@ENABLE_STATIC_TRUE@ libext6_objs := ${pfx_objs} ${pf6_objs}
+@ENABLE_STATIC_TRUE@ libext_objs := ${pfx_objs}
+@ENABLE_STATIC_TRUE@ libext4_objs := ${pf4_objs}
+@ENABLE_STATIC_TRUE@ libext6_objs := ${pf6_objs}
@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
@ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
@@ -70,7 +72,7 @@ install: ${targets_install}
if test -n "${targets_install}"; then install -pm0755 $^ "${DESTDIR}${xtlibdir}/"; fi;
clean:
- rm -f *.o *.oo *.so *.a {matches,targets}[46].man initext4.c initext6.c;
+ rm -f *.o *.oo *.so *.a {matches,targets}[46].man initext.c initext4.c initext6.c;
distclean: clean
rm -f .*.d .*.dd;
@@ -101,36 +103,61 @@ lib%.oo: ${srcdir}/lib%.c
lib%.o: ${srcdir}/lib%.c
${AM_VERBOSE_CC} ${CC} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<;
+libext.a: initext.o ${libext_objs}
+ ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+
libext4.a: initext4.o ${libext4_objs}
${AM_VERBOSE_AR} ${AR} crs $@ $^;
libext6.a: initext6.o ${libext6_objs}
${AM_VERBOSE_AR} ${AR} crs $@ $^;
-initext_func := $(addprefix xt_,${pfx_build_mod}) $(addprefix ipt_,${pf4_build_mod})
-initext6_func := $(addprefix xt_,${pfx_build_mod}) $(addprefix ip6t_,${pf6_build_mod})
+initext_func := $(addprefix xt_,${pfx_build_mod})
+initext4_func := $(addprefix ipt_,${pf4_build_mod})
+initext6_func := $(addprefix ip6t_,${pf6_build_mod})
-.initext4.dd: FORCE
+.initext.dd: FORCE
@echo "${initext_func}" >$@.tmp; \
cmp -s $@ $@.tmp || mv $@.tmp $@; \
rm -f $@.tmp;
+.initext4.dd: FORCE
+ @echo "${initext4_func}" >$@.tmp; \
+ cmp -s $@ $@.tmp || mv $@.tmp $@; \
+ rm -f $@.tmp;
+
.initext6.dd: FORCE
@echo "${initext6_func}" >$@.tmp; \
cmp -s $@ $@.tmp || mv $@.tmp $@; \
rm -f $@.tmp;
-initext4.c: .initext4.dd
+initext.c: .initext.dd
${AM_VERBOSE_GEN}
@( \
echo "" >$@; \
for i in ${initext_func}; do \
echo "extern void lib$${i}_init(void);" >>$@; \
done; \
+ echo "void init_extensions(void);" >>$@; \
+ echo "void init_extensions(void)" >>$@; \
+ echo "{" >>$@; \
+ for i in ${initext_func}; do \
+ echo " ""lib$${i}_init();" >>$@; \
+ done; \
+ echo "}" >>$@; \
+ );
+
+initext4.c: .initext4.dd
+ ${AM_VERBOSE_GEN}
+ @( \
+ echo "" >$@; \
+ for i in ${initext4_func}; do \
+ echo "extern void lib$${i}_init(void);" >>$@; \
+ done; \
echo "void init_extensions4(void);" >>$@; \
echo "void init_extensions4(void)" >>$@; \
echo "{" >>$@; \
- for i in ${initext_func}; do \
+ for i in ${initext4_func}; do \
echo " ""lib$${i}_init();" >>$@; \
done; \
echo "}" >>$@; \
@@ -177,14 +204,14 @@ man_run = \
fi; \
done >$@;
-matches4.man: .initext4.dd $(wildcard ${srcdir}/lib*.man)
+matches4.man: .initext.dd .initext4.dd $(wildcard ${srcdir}/lib*.man)
$(call man_run,$(call ex_matches,${pfx_build_mod} ${pf4_build_mod}),ip,NFPROTO_IPV4)
-matches6.man: .initext6.dd $(wildcard ${srcdir}/lib*.man)
+matches6.man: .initext.dd .initext6.dd $(wildcard ${srcdir}/lib*.man)
$(call man_run,$(call ex_matches,${pfx_build_mod} ${pf6_build_mod}),ip6,NFPROTO_IPV6)
-targets4.man: .initext4.dd $(wildcard ${srcdir}/lib*.man)
+targets4.man: .initext.dd .initext4.dd $(wildcard ${srcdir}/lib*.man)
$(call man_run,$(call ex_targets,${pfx_build_mod} ${pf4_build_mod}),ip,NFPROTO_IPV4)
-targets6.man: .initext6.dd $(wildcard ${srcdir}/lib*.man)
+targets6.man: .initext.dd .initext6.dd $(wildcard ${srcdir}/lib*.man)
$(call man_run,$(call ex_targets,${pfx_build_mod} ${pf6_build_mod}),ip6,NFPROTO_IPV6)
diff --git a/include/xtables.h.in b/include/xtables.h.in
index b080285..1d91d4d 100644
--- a/include/xtables.h.in
+++ b/include/xtables.h.in
@@ -422,6 +422,7 @@ extern void xtables_save_string(const char *value);
# undef _init
# define _init _INIT
# endif
+ extern void init_extensions(void);
extern void init_extensions4(void);
extern void init_extensions6(void);
#else
diff --git a/ip6tables-restore.c b/ip6tables-restore.c
index 5531d6e..420bc52 100644
--- a/ip6tables-restore.c
+++ b/ip6tables-restore.c
@@ -137,6 +137,7 @@ int main(int argc, char *argv[])
exit(1);
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions6();
#endif
diff --git a/ip6tables-save.c b/ip6tables-save.c
index d9ecc62..39a3325 100644
--- a/ip6tables-save.c
+++ b/ip6tables-save.c
@@ -149,6 +149,7 @@ int main(int argc, char *argv[])
exit(1);
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions6();
#endif
diff --git a/ip6tables-standalone.c b/ip6tables-standalone.c
index 7d34684..9d8d5a0 100644
--- a/ip6tables-standalone.c
+++ b/ip6tables-standalone.c
@@ -59,6 +59,7 @@ main(int argc, char *argv[])
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions6();
#endif
diff --git a/iptables-restore.c b/iptables-restore.c
index e4f0604..2624599 100644
--- a/iptables-restore.c
+++ b/iptables-restore.c
@@ -140,6 +140,7 @@ main(int argc, char *argv[])
exit(1);
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions4();
#endif
diff --git a/iptables-save.c b/iptables-save.c
index dee1752..7542bdc 100644
--- a/iptables-save.c
+++ b/iptables-save.c
@@ -149,6 +149,7 @@ main(int argc, char *argv[])
exit(1);
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions4();
#endif
diff --git a/iptables-standalone.c b/iptables-standalone.c
index b085946..87f1d31 100644
--- a/iptables-standalone.c
+++ b/iptables-standalone.c
@@ -59,6 +59,7 @@ main(int argc, char *argv[])
exit(1);
}
#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
+ init_extensions();
init_extensions4();
#endif
--
1.7.3.1
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-04-20 1:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 1:22 Patches: don't call modprobe, ipv4/ipv6 flag support, xtables-multi unification Maciej Żenczykowski
2011-04-19 1:23 ` [PATCH 1/5] Don't load ip6?_tables module when already loaded Maciej Żenczykowski
2011-04-19 7:03 ` Patrick McHardy
2011-04-19 7:10 ` [PATCH] " Maciej Żenczykowski
2011-04-19 7:14 ` Patrick McHardy
2011-04-19 1:23 ` [PATCH 2/5] Add --ipv4/-4 and --ipv6/-6 support to ip6?tables{,-restore} Maciej Żenczykowski
2011-04-19 7:17 ` Patrick McHardy
2011-04-19 7:32 ` Maciej Żenczykowski
2011-04-19 7:33 ` Patrick McHardy
2011-04-19 1:23 ` [PATCH 3/5] Move common parts of libext{4,6}.a into libext.a Maciej Żenczykowski
2011-04-19 1:23 ` [PATCH 4/5] combine ip6?tables-multi into xtables-multi Maciej Żenczykowski
2011-04-19 1:23 ` [PATCH 5/5] add xtables-multi{32,64} recognition Maciej Żenczykowski
2011-04-19 7:18 ` Patrick McHardy
2011-04-19 7:29 ` Maciej Żenczykowski
2011-04-19 7:32 ` Patrick McHardy
2011-04-19 7:55 ` Jan Engelhardt
2011-04-19 8:55 ` Maciej Żenczykowski
2011-04-20 1:44 ` Patches: don't call modprobe, ipv4/ipv6 flag support, xtables-multi unification Maciej Żenczykowski
2011-04-20 1:44 ` [PATCH 1/3] Add --ipv4/-4 and --ipv6/-6 support to ip6?tables{,-restore} Maciej Żenczykowski
2011-04-20 1:44 ` Maciej Żenczykowski [this message]
2011-04-20 1:44 ` [PATCH 3/3] combine ip6?tables-multi into xtables-multi Maciej Żenczykowski
2011-04-21 9:16 ` Patches: don't call modprobe, ipv4/ipv6 flag support, xtables-multi unification Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303263886-5665-2-git-send-email-zenczykowski@gmail.com \
--to=zenczykowski@gmail.com \
--cc=maze@google.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).