ifupdown-ng/Makefile

178 lines
4.4 KiB
Makefile
Raw 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
2020-09-11 08:46:28 +00:00
PACKAGE_VERSION := 0.9.0
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
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
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
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
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 \
ppp
EXECUTOR_SCRIPTS_OPT ?= \
2020-08-18 22:10:48 +00:00
bridge \
vrf \
tunnel \
2020-09-04 18:57:41 +00:00
gre \
wireguard \
batman
2020-07-25 08:55:09 +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}
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
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 = \
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 = \
doc/interfaces.5
2020-07-24 13:48:14 +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
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