ifupdown-ng/Makefile

220 lines
5.5 KiB
Makefile
Raw Permalink Normal View History

2020-07-26 09:16:52 +00:00
LAYOUT ?= linux
2020-07-24 13:48:14 +00:00
SCDOC := scdoc
LIBBSD_CFLAGS =
LIBBSD_LIBS =
2020-07-24 13:48:14 +00:00
2020-07-19 01:09:08 +00:00
PACKAGE_NAME := ifupdown-ng
2021-06-03 21:01:33 +00:00
PACKAGE_VERSION := 0.11.3
PACKAGE_BUGREPORT := https://github.com/ifupdown-ng/ifupdown-ng/issues/new
2020-07-19 01:09:08 +00:00
2020-07-18 23:44:58 +00:00
INTERFACES_FILE := /etc/network/interfaces
2020-07-20 13:42:16 +00:00
STATE_FILE := /run/ifstate
CONFIG_FILE := /etc/network/ifupdown-ng.conf
2020-07-25 08:02:28 +00:00
EXECUTOR_PATH := /usr/libexec/ifupdown-ng
CFLAGS ?= -ggdb3 -Os
CFLAGS += -Wall -Wextra -Werror
CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wcast-align -Wpointer-arith -Wreturn-type
CFLAGS += ${LIBBSD_CFLAGS}
2020-07-25 08:02:28 +00:00
CPPFLAGS = -I.
CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\"
CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\"
CPPFLAGS += -DCONFIG_FILE=\"${CONFIG_FILE}\"
2020-07-25 08:02:28 +00:00
CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\"
CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"
CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\"
CPPFLAGS += -DEXECUTOR_PATH=\"${EXECUTOR_PATH}\"
2020-07-18 07:58:24 +00:00
LIBIFUPDOWN_SRC = \
libifupdown/list.c \
libifupdown/dict.c \
2020-07-19 00:02:25 +00:00
libifupdown/interface.c \
2020-07-19 00:13:54 +00:00
libifupdown/interface-file.c \
2020-07-19 01:09:08 +00:00
libifupdown/fgetline.c \
2020-07-20 13:42:16 +00:00
libifupdown/version.c \
libifupdown/state.c \
2020-07-23 12:12:56 +00:00
libifupdown/environment.c \
2020-07-23 14:51:22 +00:00
libifupdown/execute.c \
libifupdown/lifecycle.c \
2020-09-14 23:15:18 +00:00
libifupdown/config-parser.c \
libifupdown/config-file.c \
libifupdown/compat.c
2020-07-18 07:58:24 +00:00
LIBIFUPDOWN_OBJ = ${LIBIFUPDOWN_SRC:.c=.o}
2020-07-18 10:49:22 +00:00
LIBIFUPDOWN_LIB = libifupdown.a
2020-07-18 07:58:24 +00:00
MULTICALL_SRC = \
cmd/multicall.c \
cmd/multicall-options.c \
cmd/multicall-exec-options.c \
cmd/multicall-match-options.c \
cmd/pretty-print-iface.c
2020-07-24 09:07:19 +00:00
MULTICALL_OBJ = ${MULTICALL_SRC:.c=.o}
MULTICALL = ifupdown
2020-07-23 16:44:45 +00:00
2020-08-12 23:09:14 +00:00
# enable ifup/ifdown applets (+16 KB)
CONFIG_IFUPDOWN ?= Y
2020-07-23 16:44:45 +00:00
IFUPDOWN_SRC = cmd/ifupdown.c
MULTICALL_${CONFIG_IFUPDOWN}_OBJ += ${IFUPDOWN_SRC:.c=.o}
CMDS_${CONFIG_IFUPDOWN} += ifup ifdown
CPPFLAGS_${CONFIG_IFUPDOWN} += -DCONFIG_IFUPDOWN
2020-08-12 23:09:14 +00:00
# enable ifquery applet (+4 KB)
# [+20 KB without ifup/ifdown]
CONFIG_IFQUERY ?= Y
IFQUERY_SRC = cmd/ifquery.c
MULTICALL_${CONFIG_IFQUERY}_OBJ += ${IFQUERY_SRC:.c=.o}
CMDS_${CONFIG_IFQUERY} += ifquery
CPPFLAGS_${CONFIG_IFQUERY} += -DCONFIG_IFQUERY
# enable ifctrstat applet (+1 KB)
CONFIG_IFCTRSTAT ?= Y
2020-08-14 15:17:01 +00:00
IFCTRSTAT_SRC = cmd/ifctrstat.c cmd/ifctrstat-${LAYOUT}.c
MULTICALL_${CONFIG_IFCTRSTAT}_OBJ += ${IFCTRSTAT_SRC:.c=.o}
CMDS_${CONFIG_IFCTRSTAT} += ifctrstat
CPPFLAGS_${CONFIG_IFCTRSTAT} += -DCONFIG_IFCTRSTAT
2020-11-11 03:02:07 +00:00
# enable ifparse applet (+1 KB)
CONFIG_IFPARSE ?= Y
IFPARSE_SRC = cmd/ifparse.c
MULTICALL_${CONFIG_IFPARSE}_OBJ += ${IFPARSE_SRC:.c=.o}
CMDS_${CONFIG_IFPARSE} += ifparse
CPPFLAGS_${CONFIG_IFPARSE} += -DCONFIG_IFPARSE
2020-11-11 10:25:54 +00:00
# enable YAML support (+2 KB)
2020-11-11 03:08:35 +00:00
CONFIG_YAML ?= Y
YAML_SRC = \
libifupdown/yaml-base.c \
libifupdown/yaml-writer.c
LIBIFUPDOWN_${CONFIG_YAML}_OBJ += ${YAML_SRC:.c=.o}
CPPFLAGS_${CONFIG_YAML} += -DCONFIG_YAML
LIBIFUPDOWN_OBJ += ${LIBIFUPDOWN_Y_OBJ}
MULTICALL_OBJ += ${MULTICALL_Y_OBJ}
CMDS += ${CMDS_Y}
CPPFLAGS += ${CPPFLAGS_Y}
2020-07-23 16:44:45 +00:00
EXECUTOR_SCRIPTS_CORE ?= \
dhcp \
2020-07-26 09:16:52 +00:00
ipv6-ra \
2020-07-26 09:36:31 +00:00
static \
link \
2020-12-16 13:13:29 +00:00
ppp \
forward
EXECUTOR_SCRIPTS_OPT ?= \
batman \
bond \
2020-08-18 22:10:48 +00:00
bridge \
ethtool \
gre \
mpls \
tunnel \
vrf \
vxlan \
wifi \
wireguard
2020-07-25 08:55:09 +00:00
EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT}
EXECUTOR_SCRIPTS_STUB ?=
2021-07-11 00:28:55 +00:00
EXECUTOR_SCRIPTS_NATIVE ?=
2020-08-12 02:40:22 +00:00
TARGET_LIBS = ${LIBIFUPDOWN_LIB}
LIBS += ${TARGET_LIBS} ${LIBBSD_LIBS}
2020-07-24 09:07:19 +00:00
2020-08-12 02:40:22 +00:00
all: ${MULTICALL} ${CMDS}
2020-07-24 09:07:19 +00:00
${CMDS}: ${MULTICALL}
ln -sf ifupdown $@
2020-07-24 09:07:19 +00:00
2020-08-12 23:09:14 +00:00
${MULTICALL}: ${TARGET_LIBS} ${MULTICALL_OBJ}
${CC} -o $@ ${MULTICALL_OBJ} ${LIBS}
2020-07-23 16:44:45 +00:00
2020-08-12 02:40:22 +00:00
${LIBIFUPDOWN_LIB}: ${LIBIFUPDOWN_OBJ}
2020-07-18 23:57:45 +00:00
${AR} -rcs $@ ${LIBIFUPDOWN_OBJ}
2020-07-18 07:58:24 +00:00
clean:
2020-08-12 23:09:14 +00:00
rm -f ${LIBIFUPDOWN_OBJ} ${MULTICALL_OBJ}
rm -f ${LIBIFUPDOWN_LIB}
2020-07-24 09:07:19 +00:00
rm -f ${CMDS} ${MULTICALL}
2020-07-24 13:48:14 +00:00
rm -f ${MANPAGES}
2020-07-19 01:46:59 +00:00
2020-08-12 02:40:22 +00:00
check: ${LIBIFUPDOWN_LIB} ${CMDS}
kyua test || (kyua report --verbose && exit 1)
2020-07-23 16:44:45 +00:00
2020-07-23 17:28:18 +00:00
install: all
2020-07-24 09:07:19 +00:00
install -D -m755 ${MULTICALL} ${DESTDIR}/sbin/${MULTICALL}
for i in ${CMDS}; do \
ln -s /sbin/${MULTICALL} ${DESTDIR}/sbin/$$i; \
done
2020-07-25 08:55:09 +00:00
for i in ${EXECUTOR_SCRIPTS}; do \
2020-07-26 09:16:52 +00:00
install -D -m755 executor-scripts/${LAYOUT}/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
done
for i in ${EXECUTOR_SCRIPTS_STUB}; do \
install -D -m755 executor-scripts/stub/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
2020-07-25 08:55:09 +00:00
done
2021-07-11 00:28:55 +00:00
for i in ${EXECUTOR_SCRIPTS_NATIVE}; do \
install -D -m755 executor-scripts/${LAYOUT}-native/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
done
install -D -m644 dist/ifupdown-ng.conf.example ${DESTDIR}${CONFIG_FILE}.example
2020-07-24 13:48:14 +00:00
.scd.1 .scd.2 .scd.3 .scd.4 .scd.5 .scd.6 .scd.7 .scd.8:
${SCDOC} < $< > $@
2020-07-24 14:32:58 +00:00
MANPAGES_5 = \
2020-10-24 15:00:26 +00:00
doc/ifstate.5 \
doc/ifupdown-ng.conf.5 \
doc/interfaces.5 \
doc/interfaces-bond.5 \
doc/interfaces-batman.5 \
doc/interfaces-bridge.5 \
doc/interfaces-forward.5 \
doc/interfaces-ppp.5 \
doc/interfaces-tunnel.5 \
doc/interfaces-vrf.5 \
doc/interfaces-vxlan.5 \
doc/interfaces-wifi.5 \
doc/interfaces-wireguard.5
2020-07-24 13:48:14 +00:00
MANPAGES_7 = \
doc/ifupdown-executor.7
MANPAGES_8 = \
doc/ifquery.8 \
doc/ifup.8 \
doc/ifdown.8 \
2020-11-12 09:28:02 +00:00
doc/ifctrstat.8 \
doc/ifparse.8
MANPAGES = ${MANPAGES_5} ${MANPAGES_7} ${MANPAGES_8}
2020-07-24 14:32:58 +00:00
2020-07-24 13:48:14 +00:00
docs: ${MANPAGES}
2020-07-24 14:32:58 +00:00
install_docs: docs
for i in ${MANPAGES_5}; do \
target=$$(basename $$i); \
install -D -m644 $$i ${DESTDIR}/usr/share/man/man5/$$target; \
done
for i in ${MANPAGES_7}; do \
target=$$(basename $$i); \
install -D -m644 $$i ${DESTDIR}/usr/share/man/man7/$$target; \
done
2020-07-24 14:32:58 +00:00
for i in ${MANPAGES_8}; do \
target=$$(basename $$i); \
install -D -m644 $$i ${DESTDIR}/usr/share/man/man8/$$target; \
done
2020-07-24 13:48:14 +00:00
.SUFFIXES: .scd .1 .2 .3 .4 .5 .6 .7 .8
2020-07-25 09:18:15 +00:00
DIST_NAME = ${PACKAGE_NAME}-${PACKAGE_VERSION}
DIST_TARBALL = ${DIST_NAME}.tar.xz
distcheck: check dist
dist: ${DIST_TARBALL}
${DIST_TARBALL}:
git archive --format=tar --prefix=${DIST_NAME}/ -o ${DIST_NAME}.tar ${DIST_NAME}
xz ${DIST_NAME}.tar