6 include $(TOPDIR
)/config.mk
8 VERSION
:= $(shell $(PERL
) src
/ferm
--version | awk
'{print $$2}' | head
-1 | tr
-d
',')
10 DISTDIR
= build
/ferm-
$(VERSION
)
12 TARFILE
= build
/ferm-
${VERSION}.
tar.gz
13 LSMFILE
= build
/ferm-
${VERSION}.lsm
17 all: doc
/ferm.txt doc
/ferm.html doc
/ferm
.1 doc
/import-ferm
.1
21 rm -f doc
/ferm.txt doc
/ferm.html doc
/{import-
,}ferm
.1 *.tmp
27 doc
/ferm.txt
: doc
/ferm.pod
30 doc
/ferm.html
: doc
/ferm.pod
31 pod2html
$< --netscape
--flush
> $@
33 doc
/ferm
.1: doc
/ferm.pod
34 pod2man
--section
=1 --release
="ferm $(VERSION)" \
35 --center
="FIREWALL RULES MADE EASY" \
38 doc
/import-ferm
.1: src
/import-ferm
39 pod2man
--section
=1 --release
="ferm $(VERSION)" \
40 --center
="FIREWALL RULES MADE EASY" \
47 STAMPDIR
= $(TOPDIR
)/build
/test
49 # a list of all ferm scripts which should be tested with iptables
50 FERM_SCRIPTS
= test/positive
/flush
test/positive
/multimod
test/positive
/policyorder
51 FERM_SCRIPTS
+= test/positive
/bug
test/positive
/iptables-targets
test/positive
/masqto
test/positive
/mod
test/params
/owner
test/positive
/state
test/positive
/tables2
test/positive
/TCPMSS
test/positive
/ttlset
test/positive
/ulog
test/positive
/varlists
52 FERM_SCRIPTS
+= $(wildcard test/modules
/*.ferm
) $(wildcard test/targets
/*.ferm
)
53 FERM_SCRIPTS
+= $(wildcard test/protocols
/*.ferm
) $(wildcard test/misc
/*.ferm
)
54 FERM_SCRIPTS
+= $(wildcard test/ipv6
/*.ferm
)
56 EXCLUDE_IMPORT
= test/misc
/subchain-domains.ferm
57 IMPORT_SCRIPTS
= $(filter-out $(EXCLUDE_IMPORT
),$(FERM_SCRIPTS
))
59 $(STAMPDIR
)/%.OLD
: PATCHFILE
= $(shell test -f
"test/patch/$(patsubst test/%,%,$(<)).iptables" && echo
"test/patch/$(patsubst test/%,%,$(<)).iptables" )
60 $(STAMPDIR
)/%.OLD
: % $(OLD_FERM
) test/canonical.pl
62 if
test -f
$(basename $<).result
; then cp
$(basename $<).result
$@.tmp1
; else $(PERL
) $(OLD_FERM
) $(OLD_OPTIONS
) $< >$@.tmp1
; fi
63 if
test -n
"$(PATCHFILE)"; then patch
-i
$(PATCHFILE
) $@.tmp1
; fi
64 $(PERL
) test/canonical.pl
<$@.tmp1
>$@.tmp2
67 $(STAMPDIR
)/%.NEW
: % $(NEW_FERM
) test/canonical.pl
69 $(PERL
) $(NEW_FERM
) $(NEW_OPTIONS
) $< >$@.tmp1
70 $(PERL
) test/canonical.pl
<$@.tmp1
>$@.tmp2
73 $(STAMPDIR
)/%.SAVE
: % $(NEW_FERM
)
75 $(PERL
) $(NEW_FERM
) $(NEW_OPTIONS
) --fast
$< |grep
-v
'^#' >$@
77 $(STAMPDIR
)/%.IMPORT
: $(STAMPDIR
)/%.SAVE src
/import-ferm
78 $(PERL
) src
/import-ferm
$< >$@
80 $(STAMPDIR
)/%.SAVE2
: $(STAMPDIR
)/%.IMPORT
$(NEW_FERM
)
81 $(PERL
) $(NEW_FERM
) $(NEW_OPTIONS
) --fast
$< |grep
-v
'^#' >$@
87 %.check-import
: %.SAVE
%.SAVE2
91 .PHONY
: check-ferm check-import
check
93 check-ferm
: $(patsubst %,$(STAMPDIR
)/%.
check,$(FERM_SCRIPTS
))
95 check-import
: $(patsubst %,$(STAMPDIR
)/%.check-import
,$(IMPORT_SCRIPTS
))
97 check: check-ferm check-import
103 build
/ferm-
$(VERSION
).
tar.gz
: all
105 install -d
-m
755 $(DISTDIR
) $(DISTDIR
)/src
$(DISTDIR
)/doc
$(DISTDIR
)/examples
106 install -m
755 src
/{import-
,}ferm
$(DISTDIR
)/src
107 install -m
644 doc
/ferm.pod doc
/ferm.txt doc
/ferm.html doc
/{import-
,}ferm
.1 $(DISTDIR
)/doc
108 install -m
644 config.mk Makefile AUTHORS COPYING NEWS README TODO
$(DISTDIR
)
109 install -m
644 $(wildcard examples
/*.ferm
) $(DISTDIR
)/examples
110 cd build
&& tar czf ferm-
$(VERSION
).
tar.gz ferm-
$(VERSION
)
112 dist: build
/ferm-
$(VERSION
).
tar.gz
118 .PHONY
: install uninstall
121 install -d
-m
755 $(DOCDIR
)/examples
$(PREFIX
)/sbin
122 install -m
644 AUTHORS COPYING NEWS README TODO
$(DOCDIR
)
123 install -m
644 examples
/*.ferm
$(DOCDIR
)/examples
124 install -m
755 src
/{import-
,}ferm
$(PREFIX
)/sbin
/
126 install -d
-m
755 $(DOCDIR
) $(MANDIR
)
127 install -m
644 doc
/ferm.txt doc
/ferm.html
$(DOCDIR
)
128 install -m
644 doc
/{import-
,}ferm
.1 $(MANDIR
)
129 gzip
-f9
$(MANDIR
)/{import-
,}ferm
.1
133 rm -f
$(MANDIR
)/{import-
,}ferm
.1{,.gz
}
134 rm -f
$(PREFIX
)/sbin
/{import-
,}ferm
141 @echo
"Publishing tarfiles in $(WEBDIR)..."
142 rm -f
$(WEBDIR
)/$(notdir $(TARFILE
))
143 cp
$(TARFILE
) $(WEBDIR
)
145 cp doc
/ferm.html
$(WEBDIR
)
146 echo
$(VERSION
) > $(WEBDIR
)/VERSION
147 ln
-s
$(notdir $(TARFILE
)) $(WEBDIR
)/ferm.
tar.gz
148 chmod ugo
+r
$(WEBDIR
)/$(notdir $(TARFILE
)) $(WEBDIR
)/ferm.
tar.gz \
149 $(WEBDIR
)/NEWS
$(WEBDIR
)/VERSION
$(WEBDIR
)/ferm.html
153 @echo
"Publishing tarfiles in $(FTPDIR)..."
154 rm -f
$(FTPDIR
)/$(notdir $(TARFILE
))
155 cp
$(TARFILE
) $(FTPDIR
)
157 echo
$(VERSION
) > $(FTPDIR
)/VERSION
158 ln
-s
$(notdir $(TARFILE
)) $(FTPDIR
)/ferm.
tar.gz
159 chmod ugo
+r
$(FTPDIR
)/$(notdir $(TARFILE
)) $(FTPDIR
)/ferm.
tar.gz \
160 $(FTPDIR
)/NEWS
$(FTPDIR
)/VERSION
165 $(LSMFILE
): DATE
= `date '+%Y-%m-%d'`
166 $(LSMFILE
): SIZE
= $(shell du
-h
-D
$(TARFILE
) | awk
'{print $$1}')
168 @echo
"Making lsm entry file..."
170 @echo
"Title: ferm" >> $@
171 @echo
"Version: $(VERSION)" >> $@
172 @echo
"Entered-date: $(DATE)" >> $@
173 @echo
"Description: A tool for structured firewall-rule making" >> $@
174 @echo
"Keywords: iptables ipchains ipfwadm firewall rules rule" >> $@
175 @echo
"Author: sofar@foo-projects.org (A. Kok)" >> $@
176 @echo
"Maintained-by: sofar@foo-projects.org (A. Kok)" >> $@
177 @echo
"Primary-site: ferm.foo-projects.org /" >> $@
178 @echo
" $(SIZE) $(TARFILE)" >> $@
179 @echo
"Alternate-site:" >> $@
180 @echo
"Original-site:" >> $@
181 @echo
"Platforms: perl linux>=2.4" >> $@
182 @echo
"Copying-policy: GPL" >> $@
184 # @echo "Sending lsm entry..."
185 # @mailx -s "add" lsm@execpc.com < $@