Makefie: Give the main build the silent treatment.
[firewall] / Makefile
CommitLineData
21a8d6ed
MW
1### -*-makefile-*-
2###
bfdc045d 3### Makefile for firewall scripts
21a8d6ed
MW
4###
5### (c) 2008 Mark Wooding
6###
bfdc045d 7
21a8d6ed
MW
8###----- Licensing notice ---------------------------------------------------
9###
10### This program is free software; you can redistribute it and/or modify
11### it under the terms of the GNU General Public License as published by
12### the Free Software Foundation; either version 2 of the License, or
13### (at your option) any later version.
14###
15### This program is distributed in the hope that it will be useful,
16### but WITHOUT ANY WARRANTY; without even the implied warranty of
17### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18### GNU General Public License for more details.
19###
20### You should have received a copy of the GNU General Public License
21### along with this program; if not, write to the Free Software Foundation,
22### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23### Makefile for firewall scripts
24
25###--------------------------------------------------------------------------
26### Preamble.
27
28## Extend these variables in `local.mk' to match your site.
bfdc045d
MW
29MAIN_M4_SOURCES =
30HOSTS =
31
83610d8a
MW
32SCRIPTS =
33
0850e508
MW
34default: all
35.PHONY: default
36
bfdc045d 37###--------------------------------------------------------------------------
5a4a2cde
MW
38### Clever silent-rules stuff.
39
40## Verbosity switch.
41V = 0
42
43## Suppressing command output.
44V_AT = $(V_AT_$V)
45V_AT_0 = @
46V_AT_1 =
47
48## Replacing them with messages.
49v_echo = $(call v_echo_$V,$1)
50v_echo_0 = @printf " %-6s %s\n" "$1" "$@";
51v_echo_1 =
52
53## Hacking.
54empty =
55space = $(empty) $(empty)
56
57## Specific commands.
58V_M4 = $(call v_echo,M4)m4 -P$(space)
59V_GEN = $(call v_echo,GEN)
60
61###--------------------------------------------------------------------------
bfdc045d
MW
62### Local configuration.
63
21a8d6ed
MW
64## Should set up HOSTS and add stuff to MAIN_M4_SOURCES if necessary. Feel
65## free to define additional targets here.
bfdc045d
MW
66include local.mk
67
68###--------------------------------------------------------------------------
69### Configuration.
70
71## The main m4 inputs which construct the firewall. These are read in last
72## to allow local configuration to change their environments.
73MAIN_M4_SOURCES += config.m4
74MAIN_M4_SOURCES += prologue.m4
75MAIN_M4_SOURCES += functions.m4
76MAIN_M4_SOURCES += numbers.m4
77MAIN_M4_SOURCES += bookends.m4
78MAIN_M4_SOURCES += classify.m4
79MAIN_M4_SOURCES += icmp.m4
80
81## All of our m4 inputs. The base gets read first to set things up.
82M4_SOURCES = base.m4
83M4_SOURCES += $(MAIN_M4_SOURCES)
84
85###--------------------------------------------------------------------------
86### Hosts.
87
88TARGETS = $(addsuffix .sh,$(HOSTS))
89
90###--------------------------------------------------------------------------
91### Building.
92
93all: $(TARGETS)
0850e508 94.PHONY: all
bfdc045d
MW
95
96%.sh: %.m4 $(M4_SOURCES)
5a4a2cde
MW
97 $(V_M4)base.m4 $*.m4 $(MAIN_M4_SOURCES) >$@.new
98 $(V_AT)chmod +x $@.new && mv $@.new $@
bfdc045d
MW
99
100clean:; rm -f $(TARGETS) *.new
0850e508 101.PHONY: clean
bfdc045d
MW
102
103###----- That's all, folks --------------------------------------------------