2020-07-26 09:16:52 +00:00
|
|
|
LAYOUT ?= linux
|
2020-07-24 13:48:14 +00:00
|
|
|
SCDOC := scdoc
|
2020-07-25 07:16:01 +00:00
|
|
|
LIBBSD_CFLAGS =
|
|
|
|
LIBBSD_LIBS =
|
2020-07-24 13:48:14 +00:00
|
|
|
|
2020-07-19 01:09:08 +00:00
|
|
|
PACKAGE_NAME := ifupdown-ng
|
2020-09-11 08:46:28 +00:00
|
|
|
PACKAGE_VERSION := 0.9.0
|
2020-08-11 14:56:22 +00:00
|
|
|
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
|
2020-09-14 23:18:45 +00:00
|
|
|
CONFIG_FILE := /etc/network/ifupdown-ng.conf
|
2020-07-25 08:02:28 +00:00
|
|
|
EXECUTOR_PATH := /usr/libexec/ifupdown-ng
|
|
|
|
|
2020-07-25 07:16:01 +00:00
|
|
|
CFLAGS ?= -ggdb3 -Os
|
|
|
|
CFLAGS += -Wall -Wextra
|
|
|
|
CFLAGS += ${LIBBSD_CFLAGS}
|
2020-07-25 08:02:28 +00:00
|
|
|
CPPFLAGS = -I.
|
|
|
|
CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\"
|
|
|
|
CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\"
|
2020-09-14 23:18:45 +00:00
|
|
|
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 = \
|
2020-07-18 09:08:47 +00:00
|
|
|
libifupdown/list.c \
|
2020-07-18 10:24:53 +00:00
|
|
|
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 \
|
2020-07-23 11:30:25 +00:00
|
|
|
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 \
|
2020-09-14 23:01:42 +00:00
|
|
|
libifupdown/lifecycle.c \
|
2020-09-14 23:15:18 +00:00
|
|
|
libifupdown/config-parser.c \
|
|
|
|
libifupdown/config-file.c
|
2020-07-18 09:08:47 +00:00
|
|
|
|
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
|
|
|
|
2020-08-12 04:15:52 +00:00
|
|
|
MULTICALL_SRC = \
|
|
|
|
cmd/multicall.c \
|
2020-08-12 04:37:36 +00:00
|
|
|
cmd/multicall-options.c \
|
2020-08-12 04:51:53 +00:00
|
|
|
cmd/multicall-exec-options.c \
|
2020-08-12 04:37:36 +00:00
|
|
|
cmd/multicall-match-options.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)
|
2020-08-12 22:53:53 +00:00
|
|
|
CONFIG_IFUPDOWN ?= Y
|
2020-07-23 16:44:45 +00:00
|
|
|
IFUPDOWN_SRC = cmd/ifupdown.c
|
2020-08-12 22:53:53 +00:00
|
|
|
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
|
|
|
|
|
2020-08-17 19:13:16 +00:00
|
|
|
# enable ifctrstat applet (+1 KB)
|
2020-08-12 22:38:15 +00:00
|
|
|
CONFIG_IFCTRSTAT ?= Y
|
2020-08-14 15:17:01 +00:00
|
|
|
IFCTRSTAT_SRC = cmd/ifctrstat.c cmd/ifctrstat-${LAYOUT}.c
|
2020-08-12 22:38:15 +00:00
|
|
|
MULTICALL_${CONFIG_IFCTRSTAT}_OBJ += ${IFCTRSTAT_SRC:.c=.o}
|
|
|
|
CMDS_${CONFIG_IFCTRSTAT} += ifctrstat
|
|
|
|
CPPFLAGS_${CONFIG_IFCTRSTAT} += -DCONFIG_IFCTRSTAT
|
|
|
|
|
2020-08-12 22:53:53 +00:00
|
|
|
MULTICALL_OBJ += ${MULTICALL_Y_OBJ}
|
|
|
|
CMDS += ${CMDS_Y}
|
|
|
|
CPPFLAGS += ${CPPFLAGS_Y}
|
2020-07-23 16:44:45 +00:00
|
|
|
|
2020-08-04 19:14:06 +00:00
|
|
|
EXECUTOR_SCRIPTS_CORE ?= \
|
2020-07-26 07:24:06 +00:00
|
|
|
dhcp \
|
2020-07-26 09:16:52 +00:00
|
|
|
ipv6-ra \
|
2020-07-26 09:36:31 +00:00
|
|
|
static \
|
2020-07-28 14:34:20 +00:00
|
|
|
link \
|
2020-08-20 10:46:06 +00:00
|
|
|
ppp
|
2020-08-04 19:14:06 +00:00
|
|
|
|
|
|
|
EXECUTOR_SCRIPTS_OPT ?= \
|
2020-08-18 22:10:48 +00:00
|
|
|
bridge \
|
2020-08-19 08:56:02 +00:00
|
|
|
vrf \
|
2020-08-20 10:46:06 +00:00
|
|
|
tunnel \
|
2020-09-04 18:57:41 +00:00
|
|
|
gre \
|
2020-09-21 14:04:10 +00:00
|
|
|
wireguard \
|
2020-09-21 16:23:04 +00:00
|
|
|
ethtool \
|
2020-09-21 14:05:18 +00:00
|
|
|
batman
|
2020-07-25 08:55:09 +00:00
|
|
|
|
2020-08-04 19:14:06 +00:00
|
|
|
EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT}
|
|
|
|
|
|
|
|
EXECUTOR_SCRIPTS_STUB ?=
|
|
|
|
|
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}
|
2020-08-04 17:48:55 +00:00
|
|
|
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}
|
2020-08-11 15:21:02 +00:00
|
|
|
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}
|
2020-08-24 09:36:26 +00:00
|
|
|
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; \
|
2020-08-04 19:14:06 +00:00
|
|
|
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
|
2020-09-14 23:18:45 +00:00
|
|
|
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_8 = \
|
2020-07-24 14:28:29 +00:00
|
|
|
doc/ifquery.8 \
|
|
|
|
doc/ifup.8 \
|
2020-08-18 20:32:07 +00:00
|
|
|
doc/ifdown.8 \
|
|
|
|
doc/ifctrstat.8
|
2020-07-24 14:32:58 +00:00
|
|
|
|
|
|
|
MANPAGES_5 = \
|
2020-10-03 23:35:41 +00:00
|
|
|
doc/interfaces.5 \
|
|
|
|
doc/interfaces-bond.5
|
2020-07-24 13:48:14 +00:00
|
|
|
|
2020-07-29 08:09:28 +00:00
|
|
|
MANPAGES_7 = \
|
|
|
|
doc/ifupdown-executor.7
|
|
|
|
|
|
|
|
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
|
2020-07-29 09:51:57 +00:00
|
|
|
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
|