"Fossies" - the Fresh Open Source Software Archive

Member "ferm-2.6/Makefile" (30 Jan 2021, 5618 Bytes) of package /linux/privat/ferm-2.6.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile": 2.5.1_vs_2.6.

    1 #
    2 # Makefile for ferm
    3 #
    4 
    5 TOPDIR = .
    6 include $(TOPDIR)/config.mk
    7 
    8 VERSION := $(shell $(PERL) src/ferm --version | awk '{print $$2}' | head -1 | tr -d ',')
    9 
   10 DISTDIR = build/ferm-$(VERSION)
   11 
   12 .PHONY: all clean
   13 
   14 all: doc/ferm.txt doc/ferm.html doc/ferm.1 doc/import-ferm.1 ferm.service
   15 
   16 clean:
   17 	rm -rf build
   18 	rm -f doc/ferm.txt doc/ferm.html doc/ferm.1 doc/import-ferm.1 *.tmp
   19 	rm -f ferm.service
   20 
   21 ferm.service: ferm.service.in
   22 	sed 's|@prefix@|$(PREFIX)|g' $< > $@
   23 
   24 #
   25 # documentation
   26 #
   27 
   28 doc/ferm.txt: doc/ferm.pod
   29 	pod2text $< > $@
   30 
   31 doc/ferm.html: doc/ferm.pod
   32 	pod2html $< --title="ferm - Firewall rules made easy" --flush > $@
   33 
   34 doc/ferm.1: doc/ferm.pod
   35 	pod2man --section=1 --release="ferm $(VERSION)" \
   36 		--center="FIREWALL RULES MADE EASY" \
   37 		--official $< > $@
   38 
   39 doc/import-ferm.1: src/import-ferm
   40 	pod2man --section=1 --release="ferm $(VERSION)" \
   41 		--center="FIREWALL RULES MADE EASY" \
   42 		--official $< > $@
   43 
   44 #
   45 # test suite
   46 #
   47 
   48 STAMPDIR = $(TOPDIR)/build/test
   49 STAMPDIR_20 = $(TOPDIR)/build/test2
   50 
   51 # a list of all ferm scripts which should be tested with iptables
   52 FERM_SCRIPTS =
   53 FERM_SCRIPTS += $(wildcard test/modules/*.ferm) $(wildcard test/targets/*.ferm)
   54 FERM_SCRIPTS += $(wildcard test/protocols/*.ferm) $(wildcard test/misc/*.ferm)
   55 FERM_SCRIPTS += $(wildcard test/glob/*.ferm)
   56 FERM_SCRIPTS += $(wildcard test/ipv6/*.ferm)
   57 FERM_SCRIPTS += $(wildcard test/resolve/*.ferm)
   58 FERM_SCRIPTS += $(wildcard test/arptables/*.ferm) $(wildcard test/ebtables/*.ferm)
   59 
   60 EXCLUDE_IMPORT =
   61 IMPORT_SCRIPTS = $(filter-out $(EXCLUDE_IMPORT) test/arptables/% test/ebtables/%,$(FERM_SCRIPTS))
   62 
   63 PRESERVE_SCRIPTS += $(wildcard test/preserve/*.ferm)
   64 
   65 # just a hack
   66 RESULT_SED += -e 's,--protocol,-p,g'
   67 RESULT_SED += -e 's,--in-interface,-i,g'
   68 RESULT_SED += -e 's,--out-interface,-o,g'
   69 RESULT_SED += -e 's,--destination ,-d ,g'
   70 RESULT_SED += -e 's,--source ,-s ,g'
   71 RESULT_SED += -e 's,--match ,-m ,g'
   72 RESULT_SED += -e 's,--jump,-j,g'
   73 RESULT_SED += -e 's,--goto,-g,g'
   74 RESULT_SED += -e 's,--fragment,-f,g'
   75 RESULT_SED += -e '/^\#/d'
   76 
   77 EB_ARP_RESULT_SED = -e 's,--jump,-j,g'
   78 
   79 $(STAMPDIR)/test/arptables/%.result: test/arptables/%.ferm src/ferm
   80 	@mkdir -p $(dir $@)
   81 	$(PERL) src/ferm --test --slow $< |sed $(EB_ARP_RESULT_SED) >$@
   82 
   83 $(STAMPDIR)/test/ebtables/%.result: test/ebtables/%.ferm src/ferm
   84 	@mkdir -p $(dir $@)
   85 	$(PERL) src/ferm --test --slow $< |$(PERL) test/ebtables_tempfile_rename.pl |sed $(EB_ARP_RESULT_SED) >$@
   86 
   87 $(STAMPDIR)/%.result: %.ferm src/ferm test/sort.pl
   88 	@mkdir -p $(dir $@)
   89 	$(PERL) src/ferm --test --slow --noflush $< |$(PERL) test/sort.pl |sed $(RESULT_SED) >$@
   90 
   91 $(STAMPDIR)/%.SAVE: %.ferm src/ferm test/sort.pl
   92 	@mkdir -p $(dir $@)
   93 	$(PERL) src/ferm --test $< |$(PERL) test/sort.pl >$@
   94 
   95 $(STAMPDIR)/%.IMPORT: $(STAMPDIR)/%.SAVE src/import-ferm
   96 	$(PERL) src/import-ferm $< >$@
   97 
   98 $(STAMPDIR)/%.SAVE2: $(STAMPDIR)/%.IMPORT src/ferm test/sort.pl
   99 	$(PERL) src/ferm --test --fast $< |$(PERL) test/sort.pl >$@
  100 
  101 $(STAMPDIR)/%.sort: %.result test/sort.pl
  102 	@mkdir -p $(dir $@)
  103 	$(PERL) test/sort.pl <$< >$@
  104 
  105 $(STAMPDIR)/%.check: $(STAMPDIR)/%.sort $(STAMPDIR)/%.result
  106 	diff -u $^
  107 	@touch $@
  108 
  109 $(STAMPDIR)/%.check-import: $(STAMPDIR)/%.SAVE $(STAMPDIR)/%.SAVE2
  110 	diff -u $^
  111 	@touch $@
  112 
  113 $(STAMPDIR)/test/preserve/%.preserved: test/preserve/%.ferm src/ferm test/sort.pl $(STAMPDIR)/test/mock/preserve.SAVE2
  114 	@mkdir -p $(dir $@)
  115 	$(PERL) src/ferm --test --test-mock-previous=ip=$(STAMPDIR)/test/mock/preserve.SAVE2 $< |$(PERL) test/sort.pl |sed $(RESULT_SED) >$@
  116 
  117 $(STAMPDIR)/test/preserve/%.expected: test/preserve/%.result
  118 	@mkdir -p $(dir $@)
  119 	sed $(RESULT_SED) $< >$@
  120 
  121 $(STAMPDIR)/test/preserve/%.check-preserve: $(STAMPDIR)/test/preserve/%.preserved $(STAMPDIR)/test/preserve/%.expected
  122 	diff -u $^
  123 	@touch $@
  124 
  125 .PHONY : check-ferm check-import check
  126 
  127 check-ferm: $(patsubst %.ferm,$(STAMPDIR)/%.check,$(FERM_SCRIPTS))
  128 
  129 check-import: $(patsubst %.ferm,$(STAMPDIR)/%.check-import,$(IMPORT_SCRIPTS))
  130 
  131 check-preserve: $(patsubst %.ferm,$(STAMPDIR)/%.check-preserve,$(PRESERVE_SCRIPTS))
  132 
  133 check: check-ferm check-import check-preserve
  134 	@echo "All ferm unit tests finished successfully."
  135 
  136 #
  137 # distribution
  138 #
  139 
  140 .PHONY: dist
  141 
  142 build/ferm-$(VERSION).tar.gz: all
  143 	rm -rf $(DISTDIR)
  144 	install -d -m 755 $(DISTDIR) $(DISTDIR)/src $(DISTDIR)/doc $(DISTDIR)/examples
  145 	install -m 755 src/ferm src/import-ferm $(DISTDIR)/src
  146 	install -m 644 ferm.service $(DISTDIR)
  147 	install -m 644 doc/ferm.pod doc/ferm.txt doc/ferm.html doc/ferm.1 doc/import-ferm.1 $(DISTDIR)/doc
  148 	install -m 644 config.mk Makefile AUTHORS COPYING NEWS README.rst TODO $(DISTDIR)
  149 	install -m 644 $(wildcard examples/*.ferm) $(DISTDIR)/examples
  150 	cd build && tar czf ferm-$(VERSION).tar.gz ferm-$(VERSION)
  151 
  152 dist: build/ferm-$(VERSION).tar.gz
  153 
  154 #
  155 # installation
  156 #
  157 
  158 .PHONY: install uninstall
  159 
  160 install: all
  161 	install -d -m 755 $(DOCDIR)/examples $(PREFIX)/sbin $(SERVICEDIR)
  162 	install -m 644 AUTHORS COPYING NEWS README.rst TODO $(DOCDIR)
  163 	install -m 644 examples/*.ferm $(DOCDIR)/examples
  164 	install -m 755 src/ferm src/import-ferm $(PREFIX)/sbin/
  165 	install -m 644 ferm.service $(SERVICEDIR)
  166 
  167 	install -d -m 755 $(DOCDIR) $(MANDIR)
  168 	install -m 644 doc/ferm.txt doc/ferm.html $(DOCDIR)
  169 	install -m 644 doc/ferm.1 doc/import-ferm.1 $(MANDIR)
  170 	gzip -f9 $(MANDIR)/ferm.1 $(MANDIR)/import-ferm.1
  171 
  172 uninstall:
  173 	rm -rf $(DOCDIR)
  174 	rm -f $(MANDIR)/ferm.1 $(MANDIR)/import-ferm.1
  175 	rm -f $(SERVICEDIR)/ferm.service
  176 	rm -f $(PREFIX)/sbin/ferm $(PREFIX)/sbin/import-ferm
  177 
  178 #
  179 # misc targets
  180 #
  181 
  182 .PHONY: upload
  183 
  184 upload: doc/ferm.html
  185 	scp NEWS doc/ferm.html foo-projects.org:/var/www/ferm.foo-projects.org/download/2.5/
  186 	scp examples/*.ferm foo-projects.org:/var/www/ferm.foo-projects.org/download/examples/