1 # Makefile for ModSecurity
3 MOD_SECURITY2 = mod_security2 apache2_config apache2_io apache2_util \
4 re re_operators re_actions re_tfns re_variables \
5 msc_logging msc_xml msc_multipart modsecurity msc_parsers msc_util msc_pcre \
6 persist_dbm msc_reqbody pdf_protect msc_geo acmp msc_lua msc_release
8 MSC_TEST = re re_operators re_actions re_tfns re_variables \
9 msc_logging msc_xml msc_multipart modsecurity \
10 msc_parsers msc_util msc_pcre persist_dbm \
11 msc_reqbody msc_geo acmp msc_lua msc_release
13 MOD_SECURITY2_H = re.h modsecurity.h msc_logging.h msc_multipart.h msc_parsers.h \
14 msc_pcre.h msc_util.h msc_xml.h persist_dbm.h apache2.h pdf_protect.h \
15 msc_geo.h acmp.h utf8tables.h msc_lua.h msc_release.h
18 LIBTOOL = @APXS_LIBTOOL@
20 EXTRA_CFLAGS = @EXTRA_CFLAGS@
21 MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@
23 ### Note: must be in APXS format: -Wc,-flag
24 APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@
25 MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@
28 APXS_WRAPPER = @APXS_WRAPPER@
29 APXS_INCLUDEDIR = @APXS_INCLUDEDIR@
30 APXS_INCLUDES = @APXS_INCLUDES@
31 APXS_CFLAGS = @APXS_CFLAGS@
32 APXS_LDFLAGS = @APXS_LDFLAGS@
33 APXS_LIBS = @APXS_LIBS@
35 PCRE_CFLAGS = @PCRE_CFLAGS@
36 PCRE_LIBS = @PCRE_LIBS@
38 LUA_CFLAGS = @LUA_CFLAGS@
41 LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
42 LIBXML2_LIBS = @LIBXML2_LIBS@
44 APR_CFLAGS = @APR_CFLAGS@
45 APR_LDFLAGS = @APR_LDFLAGS@
47 APR_LINK_LD = @APR_LINK_LD@
49 APU_CFLAGS = @APU_CFLAGS@
50 APU_LDFLAGS = @APU_LDFLAGS@
52 APU_LINK_LD = @APU_LINK_LD@
54 CPPFLAGS = @CPPFLAGS@ $(PCRE_CFLAGS) $(LIBXML2_CFLAGS) $(LUA_CFLAGS)
55 LIBS = @LIBS@ $(PCRE_LIBS) $(LIBXML2_LIBS) $(LUA_LIBS)
59 COMPILE_APACHE_MOD = $(APXS_WRAPPER) -c $(CPPFLAGS) $(LDFLAGS) $(LIBS)
61 INSTALL_MOD_SHARED = $(APXS_WRAPPER) -i
68 @for dir in mlogc-src; do \
69 if test -d $$dir; then \
70 (cd $$dir && $(MAKE) clean); \
73 @rm -rf ../tools/mlogc ../tools/mlogc-batch-load.pl
76 @rm -rf *.la *.lo *.loT *.o *.slo .libs msc_test msc-test-debug.log
79 @rm -rf Makefile mlogc-src/Makefile mlogc-src/mlogc-batch-load.pl ../tools/*.pl t/run-unit-tests.pl t/run-regression-tests.pl t/gen_rx-pm.pl t/csv_rx-pm.pl t/run-tests.pl t/regression/server_root/conf/httpd.conf t/regression/server_root/conf/*.t_*.conf t/regression/server_root/tmp/* t/regression/server_root/logs/*.log t/regression/server_root/logs/audit/* t/regression/server_root/upload/* t/regression/server_root/data/* config config.log config.status build/apxs-wrapper
81 maintainer-clean: distclean
82 @rm -rf config config.log config.status configure mod_security2_config.h autoscan.log configure.scan build/libtool.m4 build/config.guess build/config.sub build/ltmain.sh
84 install-mods: mod_security2.la
85 $(INSTALL_MOD_SHARED) mod_security2.la
87 ${MOD_SECURITY2:=.slo}: $(MOD_SECURITY2_H)
88 ${MOD_SECURITY2:=.lo}: $(MOD_SECURITY2_H)
89 ${MOD_SECURITY2:=.o}: $(MOD_SECURITY2_H})
91 mod_security2.la: $(MOD_SECURITY2_H) *.c
93 for f in $(MOD_SECURITY2); do \
96 rm -f msc_test msc_test.o msc_test.lo msc_test.slo; \
97 $(COMPILE_APACHE_MOD) $(APXS_EXTRA_CFLAGS) $(MODSEC_APXS_EXTRA_CFLAGS) $$src
101 @(cd mlogc-src && $(MAKE) mlogc) \
102 && cp -p mlogc-src/mlogc ../tools \
103 && cp -p mlogc-src/mlogc-batch-load.pl ../tools \
105 && echo "Successfully built \"mlogc\" in ../tools." \
106 && echo "See: mlogc-src/INSTALL" \
109 ### Experimental Test Framework (*NIX only right now)
110 msc_test.lo: msc_test.c
111 $(LIBTOOL) --mode=compile $(CC) $(APXS_INCLUDES) $(APXS_CFLAGS) $(CPPFLAGS) $(APR_CFLAGS) $(APU_CFLAGS) -o msc_test.lo -c msc_test.c
113 msc_test: $(TESTOBJS) $(MOD_SECURITY2_H}) msc_test.lo
115 for f in $(MSC_TEST); do \
116 objs="$$objs $$f.lo"; \
118 $(LIBTOOL) --mode=link $(CC) $$objs -o msc_test msc_test.lo $(LDFLAGS) $(LIBS) $(APR_LINK_LD) $(APU_LINK_LD)
120 test: t/run-unit-tests.pl msc_test
121 @rm -f msc-test-debug.log; \
122 $(PERL) t/run-unit-tests.pl
124 test-regression: t/run-regression-tests.pl
125 @$(PERL) t/run-regression-tests.pl
127 .PHONY: all install clean-extras clean maintainer-clean distclean install-mods test test-regression