]> git.ipfire.org Git - people/ms/network.git/blob - Makefile.am
Add recipe to set network settings
[people/ms/network.git] / Makefile.am
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 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
22 AM_MAKEFLAGS = --no-print-directory
23 AUTOMAKE_OPTIONS = color-tests
24
25 # remove target it the command fails
26 .DELETE_ON_ERROR:
27
28 # keep itermediate files
29 .SECONDARY:
30
31 configdir = $(sysconfdir)/network
32 bashcompletiondir= $(datadir)/bash-completion/completions
33 libexecdir = $(prefix)/lib
34 pkgconfigdir = $(libdir)/pkgconfig
35 pppdir = $(sysconfdir)/ppp
36 systemconfigdir = $(datadir)/network
37 sysctldir = $(prefix)/lib/sysctl.d
38 tmpfilesdir = $(prefix)/lib/tmpfiles.d
39 udevrulesdir = $(udevdir)/rules.d
40
41 networkdir = $(libexecdir)/network
42 helpersdir = $(networkdir)/helpers
43
44 macrosdir = $(libexecdir)/firewall/macros
45
46 hooksdir = $(networkdir)/hooks
47 hooks_configsdir = $(hooksdir)/configs
48 hooks_portsdir = $(hooksdir)/ports
49 hooks_zonesdir = $(hooksdir)/zones
50
51 triggersdir = $(networkdir)/triggers
52
53 logdir = $(localestatedir)/log/network
54 utildir = $(networkdir)
55
56 CLEANFILES =
57 DISTCLEANFILES =
58 EXTRA_DIST =
59 INSTALL_DIRS =
60 INSTALL_EXEC_HOOKS =
61 UNINSTALL_EXEC_HOOKS =
62 noinst_DATA =
63
64 AM_CPPFLAGS = \
65 $(OUR_CPPFLAGS) \
66 -include $(top_builddir)/config.h \
67 -I${top_srcdir}/src/libnetwork
68
69 AM_CFLAGS = \
70 $(OUR_CFLAGS) \
71 -fvisibility=hidden \
72 -ffunction-sections \
73 -fdata-sections
74
75 AM_LDFLAGS = \
76 $(OUR_LDFLAGS) \
77 -Wl,--gc-sections \
78 -Wl,--as-needed
79
80 DISTCHECK_CONFIGURE_FLAGS = \
81 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
82 --with-udevdir=$$dc_install_base/$(udevdir)
83
84 install-directories-hook:
85 $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS))
86
87 INSTALL_EXEC_HOOKS += \
88 install-directories-hook
89
90 # ------------------------------------------------------------------------------
91
92 AM_V_DOWNLOAD = $(AM_V_DOWNLOAD_$(V))
93 AM_V_DOWNLOAD_ = $(AM_V_DOWNLOAD_$(AM_DEFAULT_VERBOSITY))
94 AM_V_DOWNLOAD_0 = @echo " LOAD " $@;
95
96 AM_V_NITSI = $(AM_V_NITSI_$(V))
97 AM_V_NITSI_ = $(AM_V_NITSI_$(AM_DEFAULT_VERBOSITY))
98 AM_V_NITSI_0 = @echo " NITSI " $@;
99
100 AM_V_XSLT = $(AM_V_XSLT_$(V))
101 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
102 AM_V_XSLT_0 = @echo " XSLT " $@;
103
104 # ------------------------------------------------------------------------------
105
106 dist_doc_DATA = \
107 README \
108 docs/CODING_STYLE \
109 docs/COPYING
110
111 dist_sbin_SCRIPTS = \
112 src/dhclient-script \
113 src/firewall-config \
114 src/firewall4 \
115 src/firewall6 \
116 src/network
117
118 network_DATA = \
119 src/functions/functions
120
121 CLEANFILES += \
122 src/functions/functions
123
124 EXTRA_DIST += \
125 src/functions/functions.in
126
127 dist_network_DATA = \
128 src/functions/functions.at \
129 src/functions/functions.auth \
130 src/functions/functions.bonding \
131 src/functions/functions.bridge \
132 src/functions/functions.cli \
133 src/functions/functions.cli.firewall \
134 src/functions/functions.colors \
135 src/functions/functions.config \
136 src/functions/functions.conntrack \
137 src/functions/functions.constants \
138 src/functions/functions.constants-firewall \
139 src/functions/functions.db \
140 src/functions/functions.description \
141 src/functions/functions.device \
142 src/functions/functions.dhclient \
143 src/functions/functions.dhcpd \
144 src/functions/functions.distro \
145 src/functions/functions.dns \
146 src/functions/functions.dummy \
147 src/functions/functions.editor \
148 src/functions/functions.firewall \
149 src/functions/functions.firewall-policy \
150 src/functions/functions.firewall-zones \
151 src/functions/functions.he \
152 src/functions/functions.hook \
153 src/functions/functions.hostapd \
154 src/functions/functions.hotplug \
155 src/functions/functions.http \
156 src/functions/functions.interrupts \
157 src/functions/functions.ip \
158 src/functions/functions.ipsec \
159 src/functions/functions.ipsec-pool \
160 src/functions/functions.iptables \
161 src/functions/functions.ip-tunnel \
162 src/functions/functions.ipv4 \
163 src/functions/functions.ipv6 \
164 src/functions/functions.list \
165 src/functions/functions.lock \
166 src/functions/functions.logging \
167 src/functions/functions.macros \
168 src/functions/functions.modem \
169 src/functions/functions.phy \
170 src/functions/functions.ports \
171 src/functions/functions.ppp \
172 src/functions/functions.pppoe-server \
173 src/functions/functions.radvd \
174 src/functions/functions.route \
175 src/functions/functions.routing \
176 src/functions/functions.serial \
177 src/functions/functions.service \
178 src/functions/functions.settings \
179 src/functions/functions.stp \
180 src/functions/functions.sysctl \
181 src/functions/functions.system \
182 src/functions/functions.triggers \
183 src/functions/functions.usb \
184 src/functions/functions.util \
185 src/functions/functions.vlan \
186 src/functions/functions.vpn \
187 src/functions/functions.vpn-security-policies \
188 src/functions/functions.wireless \
189 src/functions/functions.wireless-mesh \
190 src/functions/functions.wireless-networks \
191 src/functions/functions.wpa_supplicant \
192 src/functions/functions.zone \
193 src/network-radvd-config \
194 src/dhclient-helper \
195 src/header-config \
196 src/header-port \
197 src/header-zone \
198 src/ppp/dialer \
199 src/ppp/pppoe-server
200
201 dist_helpers_SCRIPTS = \
202 src/helpers/dhcpd-config-helper \
203 src/helpers/firewall-kernel-init \
204 src/helpers/hostapd-config-helper \
205 src/helpers/ipsec-updown \
206 src/helpers/pppd-angel \
207 src/helpers/wpa_supplicant
208
209 bin_PROGRAMS = \
210 src/inetcalc
211
212 src_inetcalc_SOURCES = \
213 src/inetcalc.c
214
215 src_inetcalc_LDADD = \
216 src/libnetwork.la
217
218 dist_hooks_configs_SCRIPTS = \
219 src/hooks/configs/dhcp \
220 src/hooks/configs/ipv6-auto \
221 src/hooks/configs/pppoe-server \
222 src/hooks/configs/static
223
224 dist_hooks_ports_SCRIPTS = \
225 src/hooks/ports/bonding \
226 src/hooks/ports/dummy \
227 src/hooks/ports/ethernet \
228 src/hooks/ports/vlan \
229 src/hooks/ports/wireless-ap \
230 src/hooks/ports/wireless-mesh
231
232 dist_hooks_zones_SCRIPTS = \
233 src/hooks/zones/6to4-tunnel \
234 src/hooks/zones/bridge \
235 src/hooks/zones/modem \
236 src/hooks/zones/pppoe \
237 src/hooks/zones/wireless
238
239 INSTALL_DIRS += \
240 $(configdir) \
241 $(configdir)/ports \
242 $(configdir)/vpn \
243 $(configdir)/vpn/ipsec/connections \
244 $(configdir)/vpn/security-policies \
245 $(configdir)/wireless \
246 $(configdir)/wireless/networks \
247 $(configdir)/zones
248
249 # ------------------------------------------------------------------------------
250
251 LIBNETWORK_CURRENT=0
252 LIBNETWORK_REVISION=0
253 LIBNETWORK_AGE=0
254
255 pkginclude_HEADERS = \
256 src/libnetwork/network/interface.h \
257 src/libnetwork/network/libnetwork.h \
258 src/libnetwork/network/logging.h \
259 src/libnetwork/network/phy.h
260
261 lib_LTLIBRARIES = \
262 src/libnetwork.la
263
264 src_libnetwork_la_SOURCES = \
265 src/libnetwork/interface.c \
266 src/libnetwork/libnetwork-private.h \
267 src/libnetwork/libnetwork.c \
268 src/libnetwork/phy.c
269
270 src_libnetwork_la_LIBADD = \
271 $(LIBNL_LIBS)
272
273 src_libnetwork_la_CPPFLAGS = \
274 $(AM_CPPFLAGS) \
275 $(LIBNL_CPPFLAGS) \
276 -D_GNU_SOURCE \
277 -DNETWORK_PRIVATE
278
279 src_libnetwork_la_CFLAGS = \
280 $(AM_CFLAGS) \
281 $(LIBNL_CFLAGS)
282
283 src_libnetwork_la_LDFLAGS = \
284 $(AM_LDFLAGS) \
285 -version-info $(LIBNETWORK_CURRENT):$(LIBNETWORK_REVISION):$(LIBNETWORK_AGE) \
286 -Wl,--version-script=$(top_srcdir)/src/libnetwork/libnetwork.sym
287
288 src_libnetwork_la_DEPENDENCIES = \
289 src/libnetwork/libnetwork.sym
290
291 EXTRA_DIST += \
292 src/libnetwork/libnetwork.sym
293
294 # ------------------------------------------------------------------------------
295
296 util_PROGRAMS = \
297 src/utils/network-phy-list-ht-caps
298
299 src_utils_network_phy_list_ht_caps_SOURCES = \
300 src/utils/network-phy-list-ht-caps.c
301
302 src_utils_network_phy_list_ht_caps_LDADD = \
303 src/libnetwork.la
304
305 # ------------------------------------------------------------------------------
306
307 ppp_SCRIPTS = \
308 src/ppp/ip-updown
309
310 CLEANFILES += \
311 src/ppp/ip-updown
312
313 EXTRA_DIST += \
314 src/ppp/ip-updown.in
315
316 INSTALL_DIRS += \
317 $(pppdir) \
318 $(logdir)
319
320 ppp-install-hook:
321 ln -svf ip-updown $(DESTDIR)$(pppdir)/ip-pre-up
322 ln -svf ip-updown $(DESTDIR)$(pppdir)/ip-up
323 ln -svf ip-updown $(DESTDIR)$(pppdir)/ip-down
324 ln -svf ip-updown $(DESTDIR)$(pppdir)/ipv6-up
325 ln -svf ip-updown $(DESTDIR)$(pppdir)/ipv6-down
326
327 ppp-uninstall-hook:
328 rm -f $(DESTDIR)$(pppdir)/ip-{down,pre-up,up}
329 rm -f $(DESTDIR)$(pppdir)/ipv6-{down,up}
330
331 INSTALL_EXEC_HOOKS += ppp-install-hook
332 UNINSTALL_EXEC_HOOKS += ppp-uninstall-hook
333
334 # ------------------------------------------------------------------------------
335
336 if HAVE_SYSTEMD
337 systemdsystemunit_DATA = \
338 src/systemd/firewall4.service \
339 src/systemd/firewall6.service \
340 src/systemd/firewall-init.service \
341 src/systemd/network-init.service \
342 src/systemd/network@.service
343
344 CLEANFILES += \
345 $(systemdsystemunit_DATA)
346
347 INSTALL_DIRS += \
348 $(systemdsystemunitdir)
349 endif
350
351 EXTRA_DIST += \
352 src/systemd/firewall4.service.in \
353 src/systemd/firewall6.service.in \
354 src/systemd/firewall-init.service.in \
355 src/systemd/network-init.service.in \
356 src/systemd/network@.service.in
357
358 # ------------------------------------------------------------------------------
359
360 systemconfig_vpndir = $(systemconfigdir)/vpn
361
362 dist_systemconfig_vpn_security_policies_DATA = \
363 config/vpn/security-policies/performance \
364 config/vpn/security-policies/system
365
366 systemconfig_vpn_security_policiesdir = $(systemconfig_vpndir)/security-policies
367
368 # ------------------------------------------------------------------------------
369
370 dist_sysctl_DATA = \
371 src/sysctl/network.conf
372
373 # ------------------------------------------------------------------------------
374
375 dist_bashcompletion_SCRIPTS = \
376 src/bash-completion/network
377
378 # ------------------------------------------------------------------------------
379
380 dist_tmpfiles_DATA = \
381 src/tmpfiles/network.conf
382
383 # ------------------------------------------------------------------------------
384
385 if HAVE_UDEV
386 dist_udev_SCRIPTS = \
387 src/udev/network-hotplug \
388 src/udev/network-hotplug-rename \
389 src/udev/network-hotplug-serial
390
391 dist_udevrules_DATA = \
392 src/udev/rules.d/50-serial-whitelist.rules \
393 src/udev/rules.d/60-net.rules
394
395 INSTALL_DIRS += \
396 $(udevdir) \
397 $(udevrulesdir)
398 endif
399
400 # ------------------------------------------------------------------------------
401
402 pkgconfig_DATA = \
403 src/network.pc
404
405 CLEANFILES += \
406 $(pkgconfig_DATA)
407
408 EXTRA_DIST += \
409 src/network.pc.in
410
411 # ------------------------------------------------------------------------------
412
413 dist_macros_DATA = \
414 src/macros/DHCP \
415 src/macros/HTTP \
416 src/macros/HTTPS \
417 src/macros/WWW
418
419 # ------------------------------------------------------------------------------
420
421 INSTALL_DIRS += \
422 $(triggersdir)
423
424 # ------------------------------------------------------------------------------
425
426 MANPAGES = \
427 man/firewall-settings.8 \
428 man/network.8 \
429 man/network-color.8 \
430 man/network-description.8 \
431 man/network-device.8 \
432 man/network-dhcp.8 \
433 man/network-dns-server.8 \
434 man/network-performance-tuning.8 \
435 man/network-port.8 \
436 man/network-quick-start.8 \
437 man/network-route.8 \
438 man/network-route-static.8 \
439 man/network-settings.8 \
440 man/network-vpn.8 \
441 man/network-vpn-security-policies.8 \
442 man/network-zone.8 \
443 man/network-zone-6to4-tunnel.8 \
444 man/network-zone-bridge.8 \
445 man/network-zone-config-pppoe-server.8 \
446 man/network-zone-modem.8 \
447 man/network-zone-pppoe.8 \
448 man/network-zone-wireless.8
449
450 MANPAGES_XML = $(patsubst %.8,%.xml,$(MANPAGES))
451 MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
452
453 .PHONY: man
454 man: $(MANPAGES) $(MANPAGES_HTML)
455
456 man_MANS = \
457 $(MANPAGES)
458
459 noinst_DATA += \
460 $(MANPAGES_HTML)
461
462 CLEANFILES += \
463 $(man_MANS) \
464 $(MANPAGES_HTML)
465
466 EXTRA_DIST += \
467 $(MANPAGES_XML) \
468 man/custom-html.xsl
469
470 XSLTPROC_FLAGS = \
471 --nonet \
472 --stringparam man.output.quietly 1 \
473 --stringparam funcsynopsis.style ansi \
474 --stringparam man.th.extra1.suppress 1 \
475 --stringparam man.authors.section.enabled 1 \
476 --stringparam man.copyright.section.enabled 1
477
478 XSLTPROC_COMMAND_MAN = \
479 $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
480 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
481
482 XSLTPROC_COMMAND_HTML = \
483 $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
484
485 man/%.8: man/%.xml
486 $(XSLTPROC_COMMAND_MAN)
487
488 man/%.html: man/%.xml man/custom-html.xsl
489 $(XSLTPROC_COMMAND_HTML)
490
491 # ------------------------------------------------------------------------------
492
493 substitutions = \
494 '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
495 '|PACKAGE_URL=$(PACKAGE_URL)|' \
496 '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
497 '|builddir=$(abs_builddir)|' \
498 '|prefix=$(prefix)|' \
499 '|exec_prefix=$(exec_prefix)|' \
500 '|sbindir=$(sbindir)|' \
501 '|networkdir=$(networkdir)|' \
502 '|helpersdir=$(helpersdir)|' \
503 '|utildir=$(utildir)|' \
504 '|VIRTUAL_ENVIRONMENT_IMAGES_DIR=$(VIRTUAL_ENVIRONMENT_IMAGES_DIR)|'
505
506 SED_PROCESS = \
507 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
508 $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
509 < $< > $@
510
511 %: %.in Makefile
512 $(SED_PROCESS)
513
514 INSTALL_DIRS += \
515 $(sbindir)
516
517 install-exec-hook: $(INSTALL_EXEC_HOOKS)
518
519 uninstall-hook: $(UNINSTALL_EXEC_HOOKS)
520
521 # - testsuite ------------------------------------------------------------------
522
523 TESTS_ENVIRONMENT = \
524 LD_LIBRARY_PATH=$(top_builddir)/src/.libs:$(LD_LIBRARY_PATH) \
525 PATH=$(top_builddir)/src:$(PATH) \
526 functions=$(abs_builddir)/src/functions/functions \
527 networkdir=$(abs_srcdir)/src/functions \
528 testdir=$(top_srcdir)/test
529
530 dist_check_DATA = \
531 test/constants.sh \
532 test/test-functions
533
534 dist_check_SCRIPTS = \
535 $(TESTS)
536
537 TESTS = \
538 test/load-library \
539 test/functions/ip/ip_detect_protocol \
540 test/functions/ip/ip_get_prefix \
541 test/functions/ip/ip_net_is_valid \
542 test/functions/ip/ip_is_valid \
543 test/functions/ip/ip_network_is_subnet_of \
544 test/functions/ip/ip_prefix_is_valid \
545 test/functions/ip/ip_protocol_is_supported \
546 test/functions/ip/ip_split_prefix
547
548 # - NITSI tests ----------------------------------------------------------------
549
550 # Files for the virtual environment
551 VIRTUAL_ENVIRONMENT_FILES = \
552 test/nitsi/virtual-environment/basic/machines/alice/machine.xml \
553 test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml \
554 test/nitsi/virtual-environment/basic/machines/bob/machine.xml \
555 test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml \
556 test/nitsi/virtual-environment/basic/network/network1/network.xml \
557 test/nitsi/virtual-environment/basic/network/network2/network.xml \
558 test/nitsi/virtual-environment/basic/network/network3/network.xml \
559 test/nitsi/virtual-environment/basic/network/network4/network.xml \
560 test/nitsi/virtual-environment/basic/settings
561
562 EXTRA_DIST += \
563 test/nitsi/virtual-environment/basic/machines/alice/machine.xml.in \
564 test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml.in \
565 test/nitsi/virtual-environment/basic/machines/bob/machine.xml.in \
566 test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml.in \
567 test/nitsi/virtual-environment/basic/settings.in
568
569 CLEANFILES += \
570 test/nitsi/virtual-environment/basic/machines/alice/machine.xml \
571 test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml \
572 test/nitsi/virtual-environment/basic/machines/bob/machine.xml \
573 test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml \
574 test/nitsi/virtual-environment/basic/settings
575
576 # Virtual Machine Images
577 VIRTUAL_ENVIRONMENT_IMAGES = \
578 $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-alice-2.qcow2 \
579 $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-bob.qcow2
580
581 DISTCLEANFILES += \
582 $(VIRTUAL_ENVIRONMENT_IMAGES)
583
584 VIRTUAL_ENVIRONMENT_IMAGES_DIR = $(abs_builddir)/test/nitsi/virtual-environment/.images
585 VIRTUAL_ENVIRONMENT_IMAGES_DOWNLOAD_URL = \
586 https://people.ipfire.org/~jschlag/nitsi-ipfire/virtual-environment/basic/
587
588 NITSI_INCLUDE_RECIPES = \
589 test/nitsi/include/make-install \
590 test/nitsi/include/network-reset \
591 test/nitsi/include/network-settings
592
593 EXTRA_DIST += \
594 test/nitsi/include/make-install.in
595 test/nitsi/include/network-reset \
596 test/nitsi/include/network-settings
597
598 CLEANFILES += \
599 test/nitsi/include/make-install
600
601 NITSI_TESTS = \
602 test/nitsi/test/hello-world \
603 test/nitsi/test/make-check
604
605 EXTRA_DIST += \
606 test/nitsi/test/hello-world/recipe \
607 test/nitsi/test/hello-world/settings \
608 test/nitsi/test/make-check/recipe.in \
609 test/nitsi/test/make-check/settings.in
610
611 CLEANFILES += \
612 test/nitsi/test/make-check/recipe \
613 test/nitsi/test/make-check/settings
614
615 NITSI_ENVIRONMENT =
616
617 .PHONY: $(NITSI_TESTS)
618 $(NITSI_TESTS): % : %/recipe %/settings $(VIRTUAL_ENVIRONMENT_FILES) $(VIRTUAL_ENVIRONMENT_IMAGES) $(NITSI_INCLUDE_RECIPES)
619 $(AM_V_NITSI) $(NITSI_ENVIRONMENT) $(NITSI) --log-level error run-test -d $@
620
621 .PHONY: nitsi
622 nitsi: dist $(NITSI_TESTS)
623
624 # Downloads a virtual image file and extracts it
625 $(VIRTUAL_ENVIRONMENT_IMAGES):
626 $(AM_V_DOWNLOAD)$(MKDIR_P) $(dir $@) && \
627 $(WGET) -qO - $(VIRTUAL_ENVIRONMENT_IMAGES_DOWNLOAD_URL)/$(notdir $@).xz | xz -qd > $@