]> git.ipfire.org Git - people/stevee/network.git/blob - Makefile
5a6645ed68a295ff36e0b8f52fa6f82bd6b050fe
[people/stevee/network.git] / Makefile
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2012-2013 IPFire Network Development Team #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 PACKAGE_NAME = network
22 PACKAGE_VERSION = 006
23
24 DESTDIR=
25
26 # Export HTML documents to this directory.
27 HTML_DOCS_DIR = html
28
29 prefix=/usr
30 bindir=$(prefix)/bin
31 sbindir=$(prefix)/sbin
32 libdir=$(prefix)/lib
33 datadir=$(prefix)/share
34 mandir=$(datadir)/man
35 sysconfdir=/etc
36 localstatedir=/var
37 systemdunitdir=$(prefix)/lib/systemd/system
38 tmpfilesdir=$(prefix)/lib/tmpfiles.d
39
40 # File to store the version number in.
41 VERSION_FILE = $(DESTDIR)$(libdir)/network/version
42
43 # A list of files which should be removed on "make clean"
44 CLEANFILES =
45
46 # man pages
47 MAN_PAGES = \
48 man/network.8 \
49 man/network-config.8 \
50 man/network-device.8 \
51 man/network-dns-server.8 \
52 man/network-port-batman-adv.8 \
53 man/network-port-batman-adv-port.8 \
54 man/network-route.8 \
55 man/network-zone.8 \
56 man/network-zone-6to4-tunnel.8 \
57 man/network-zone-aiccu.8 \
58 man/network-zone-bridge.8 \
59 man/network-zone-config-pppoe-server.8 \
60 man/network-zone-pppoe.8
61
62 MAN_PAGES_HTML = $(patsubst %.xml,%.html,$(MAN_PAGES_XML))
63 MAN_PAGES_XML = $(patsubst %.8,%.xml,$(MAN_PAGES))
64 MAN_PAGES_8 = $(filter %.8,$(MAN_PAGES))
65
66 CLEANFILES += \
67 $(MAN_PAGES) \
68 $(MAN_PAGES_HTML)
69
70 XSLTPROC = xsltproc
71
72 XSLTPROC_FLAGS = \
73 --nonet \
74 --stringparam man.output.quietly 1 \
75 --stringparam funcsynopsis.style ansi \
76 --stringparam man.th.extra1.suppress 1 \
77 --stringparam man.authors.section.enabled 1 \
78 --stringparam man.copyright.section.enabled 1
79
80 XSLTPROC_COMMAND_MAN = \
81 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
82 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
83
84 XSLTPROC_COMMAND_HTML = \
85 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) man/custom-html.xsl $<
86
87 man/%.8: man/%.xml
88 $(XSLTPROC_COMMAND_MAN)
89
90 man/%.html: man/%.xml man/custom-html.xsl
91 $(XSLTPROC_COMMAND_HTML)
92
93 .PHONY: all
94 all: $(MAN_PAGES)
95
96 .PHONY: install
97 install: $(MAN_PAGES)
98 -mkdir -pv $(DESTDIR)$(sysconfdir)/{network/{ports,zones},ppp}
99 -mkdir -pv $(DESTDIR)$(libdir)/{network,sysctl.d,udev}
100 -mkdir -pv $(DESTDIR)$(localstatedir)/log/network
101 -mkdir -pv $(DESTDIR)$(sbindir)
102 -mkdir -pv $(DESTDIR)$(systemdunitdir)
103 -mkdir -pv $(DESTDIR)$(tmpfilesdir)
104 -mkdir -pv $(DESTDIR)$(datadir)/firewall
105
106 install -m 755 -v firewall6 $(DESTDIR)$(sbindir)
107 install -m 755 -v firewall4 $(DESTDIR)$(sbindir)
108 install -m 755 -v network $(DESTDIR)$(sbindir)
109
110 cp -rfv {hooks,header*,functions*} $(DESTDIR)$(libdir)/network/
111 cp -fv sysctl.d/* $(DESTDIR)$(libdir)/sysctl.d/
112 cp -rfv udev/* $(DESTDIR)$(libdir)/udev
113 cp -rfv network-* $(DESTDIR)$(libdir)/network/
114 cp -vf systemd/*.service $(DESTDIR)$(systemdunitdir)
115 cp -vf network.tmpfiles $(DESTDIR)$(tmpfilesdir)/network.conf
116
117 # Install the helper tools.
118 -mkdir -pv $(DESTDIR)$(libdir)/network/helpers
119 cp -vf helpers/* $(DESTDIR)$(libdir)/network/helpers
120
121 # Install bridge-stp.
122 ln -svf --relative \
123 $(DESTDIR)$(libdir)/network/helpers/bridge-stp \
124 $(DESTDIR)$(sbindir)/
125
126 # Install dhclient script and helper.
127 install -m 755 dhclient-helper $(DESTDIR)$(libdir)/network/
128 install -m 755 dhclient-script $(DESTDIR)$(sbindir)/
129
130 install -m 755 -v ppp/ip-updown $(DESTDIR)$(sysconfdir)/ppp
131 ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ip-pre-up
132 ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ip-up
133 ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ip-down
134 ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ipv6-up
135 ln -svf ip-updown $(DESTDIR)$(sysconfdir)/ppp/ipv6-down
136 install -m 755 -v ppp/dialer $(DESTDIR)$(libdir)/network/
137
138 # Install pppoe-server wrapper.
139 install -m 755 ppp/pppoe-server $(DESTDIR)$(libdir)/network/
140
141 # Install the firewall macros.
142 cp -av macros $(DESTDIR)$(datadir)/firewall/
143
144 # Create the version file.
145 : > $(VERSION_FILE)
146 echo "# This file is automatically generated." >> $(VERSION_FILE)
147 echo "NETWORK_VERSION=$(PACKAGE_VERSION)" >> $(VERSION_FILE)
148
149 # Install man pages.
150 -mkdir -pv $(DESTDIR)$(mandir)/man8
151 install -v -m 644 $(MAN_PAGES_8) $(DESTDIR)$(mandir)/man8
152
153 .PHONY: clean
154 clean:
155 rm -f $(CLEANFILES)
156
157 dist:
158 git archive --format tar --prefix $(PACKAGE_NAME)-$(PACKAGE_VERSION)/ HEAD | gzip -9 > \
159 $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
160
161 .PHONY: export-html-docs
162 export-html-docs: $(MAN_PAGES_HTML)
163 mkdir -pv $(HTML_DOCS_DIR)
164 cp -vf $^ $(HTML_DOCS_DIR)