]> granicus.if.org Git - ipset/blob - Makefile.am
ipset: Fix memory accounting for hash types on resize
[ipset] / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2
3 ACLOCAL_AMFLAGS = -I m4
4
5 include $(top_srcdir)/Make_global.am
6
7 if ! WITH_KBUILDDIR
8 KBUILD_OUTPUT=/lib/modules/`uname -r`/build
9 else
10 KBUILD_OUTPUT=$(KBUILDDIR)
11 endif
12 if ! WITH_MAXSETS
13 IP_SET_MAX=256
14 else
15 IP_SET_MAX=$(MAXSETS)
16 endif
17
18 SUBDIRS         = include/libipset lib src utils
19 INSTALL_MOD_PATH = /
20
21 sparse:
22         $(MAKE) -C lib sparse-check
23         $(MAKE) -C src sparse-check
24
25 modules_sparse:
26 if WITH_KMOD
27         ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net \
28                         V=$V W=1 C=2 CF="-D__CHECK_ENDIAN__ -Wsparse-all" \
29                         KCFLAGS="-DPACKAGE_VERSION=$(PACKAGE_VERSION) -DCHECK_KCONFIG -Wextra" \
30                         IP_SET_MAX=$(IP_SET_MAX) KDIR=$$PWD/kernel modules
31 else
32         @echo Skipping kernel modules due to --with-kmod=no
33 endif
34
35 modules:
36 if WITH_KMOD
37         ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net V=$V \
38                         KCFLAGS="-DPACKAGE_VERSION=$(PACKAGE_VERSION)" \
39                         IP_SET_MAX=$(IP_SET_MAX) KDIR=$$PWD/kernel modules
40 else
41         @echo Skipping kernel modules due to --with-kmod=no
42 endif
43
44 define DEPMOD_WARNING
45
46 !!! WARNING !!! WARNING !!! WARNING !!!
47
48 Your distribution seems to ignore the /lib/modules/<kernelrelease>/extra/
49 subdirectory, where the ipset kernel modules are installed.
50
51 Add the 'extra' directory to the search definition of your depmod
52 configuration (/etc/depmod.conf or /etc/depmod.d/) and re-run
53
54         depmod <kernelrelease>
55
56 otherwise the ipset kernel modules in the extra subdir will be ignored.
57
58 endef
59 export DEPMOD_WARNING
60
61 define MODULE_WARNING
62
63 !!! WARNING !!! WARNING !!! WARNING !!!
64
65 Your running system has got ipset related kernel modules loaded in.
66 You MUST rmmod the ip_set* kernel modules in order to make possible
67 for the system to load in the newly installed ones.
68 endef
69 export MODULE_WARNING
70
71 modules_install:
72 if WITH_KMOD
73         ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net \
74                         KDIR=$$PWD/kernel modules_install
75         @modinfo -b ${INSTALL_MOD_PATH} ip_set_hash_ip | ${GREP} /extra/ >/dev/null || echo "$$DEPMOD_WARNING"
76         @lsmod | ${GREP} '^ip_set' >/dev/null && echo "$$MODULE_WARNING"
77 else
78         @echo Skipping kernel modules due to --with-kmod=no
79 endif
80
81 modules_clean:
82 if WITH_KMOD
83         ${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net \
84                         KDIR=$$PWD/kernel clean
85 else
86         @echo Skipping kernel modules due to --with-kmod=no
87 endif
88
89 update_includes:
90         for x in ip_set.h ip_set_bitmap.h ip_set_hash.h ip_set_list.h; do \
91             sed -r -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
92                    -e 's@^#include <linux/netfilter/ipset/ip_set.h>@@' \
93                 kernel/include/uapi/linux/netfilter/ipset/$$x \
94                 > include/libipset/linux_$$x; \
95         done
96
97 update_utils:
98         wget -4 -O /tmp/ipset-bash-completion.tar.gz http://sourceforge.net/projects/ipset-bashcompl/files/latest/download
99         cd utils/ipset_bash_completion; tar xz --strip-components=1 -f /tmp/ipset-bash-completion.tar.gz
100         rm -f /tmp/ipset-bash-completion.tar.gz
101         wget -4 -O /tmp/ipset-list.tar.gz http://sourceforge.net/projects/ipset-list/files/latest/download
102         cd utils/ipset_list; tar xz --strip-components=1 -f /tmp/ipset-list.tar.gz
103         rm -f /tmp/ipset-list.tar.gz
104
105 check_libmap:
106         @./check_libmap.sh
107
108 tests:
109         cd tests; ./runtest.sh
110
111 cleanup_dirs := . include/libipset lib src tests
112
113 tidy: distclean modules_clean
114         rm -rf .deps $(foreach dir,$(cleanup_dirs),$(wildcard $(dir)/*~))
115         rm -rf aclocal.m4 autom4te.cache 
116         rm -rf config.* configure compile depcomp install-sh libtool ltmain.sh
117         rm -rf Makefile Makefile.in lib/Makefile lib/Makefile.in src/Makefile src/Makefile.in
118         rm -rf missing stamp-h1 m4/libtool.m4 m4/lt*.m4
119         rm -rf lib/ipset_settype_check lib/types_init.c
120         find . -name '*~' -delete
121
122 tarball:
123         rm -Rf /tmp/ipset-${PACKAGE_VERSION};
124         pushd ${top_srcdir} && git archive --prefix=ipset-${PACKAGE_VERSION}/ HEAD | tar -C /tmp -x && popd;
125         pushd /tmp/ipset-${PACKAGE_VERSION} && ./autogen.sh && popd;
126         tar -C /tmp -cjf ipset-${PACKAGE_VERSION}.tar.bz2 --owner=root --group=root ipset-${PACKAGE_VERSION}/;
127         rm -Rf /tmp/ipset-${PACKAGE_VERSION};
128
129 help:
130         @echo '  <nothing>              - Compile userspace'
131         @echo '  modules                - Compile kernel modules'
132         @echo '  install                - Install userspace'
133         @echo '  modules_install        - Install kernel modules'
134         @echo '  clean                  - Remove generated userspace files'
135         @echo '  modules_clean          - Remove generated kernelspace files'
136         @echo '  tidy                   - Tidy up the whole source tree'
137         @echo '  tests                  - Run testsuite'
138         @echo '  sparse                 - Check userspace with sparse'
139         @echo '  modules_sparse         - Check kernelspace with sparse'
140         @echo '  update_includes        - Update userspace include files'
141         @echo '  update_utils           - Update bash utilities'
142         @echo '  check_libmap           - Check libipset.map for missing symbols'
143         @echo '  tarball                - Create a tarball for a new release'
144
145 .PHONY: modules modules_instal modules_clean update_includes tests tarball
146
147 DISTCHECK_CONFIGURE_FLAGS = --with-kmod=no