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-08-04 19:20:26 +00:00
|
|
|
PACKAGE_VERSION := 0.7.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-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}\"
|
|
|
|
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 \
|
|
|
|
libifupdown/lifecycle.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-07-24 09:07:19 +00:00
|
|
|
MULTICALL_SRC = cmd/multicall.c
|
|
|
|
MULTICALL_OBJ = ${MULTICALL_SRC:.c=.o}
|
|
|
|
MULTICALL = ifupdown
|
2020-07-23 16:44:45 +00:00
|
|
|
|
2020-07-18 10:49:22 +00:00
|
|
|
IFQUERY_SRC = cmd/ifquery.c
|
|
|
|
IFQUERY_OBJ = ${IFQUERY_SRC:.c=.o}
|
|
|
|
|
2020-07-23 16:44:45 +00:00
|
|
|
IFUPDOWN_SRC = cmd/ifupdown.c
|
|
|
|
IFUPDOWN_OBJ = ${IFUPDOWN_SRC:.c=.o}
|
|
|
|
|
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-04 19:14:06 +00:00
|
|
|
|
|
|
|
EXECUTOR_SCRIPTS_OPT ?= \
|
2020-07-28 14:34:20 +00:00
|
|
|
bridge
|
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-07-24 09:07:19 +00:00
|
|
|
CMD_OBJ = ${MULTICALL_OBJ} ${IFQUERY_OBJ} ${IFUPDOWN_OBJ}
|
|
|
|
|
|
|
|
CMDS = ifup ifdown ifquery
|
|
|
|
|
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 02:40:22 +00:00
|
|
|
${MULTICALL}: ${TARGET_LIBS} ${CMD_OBJ}
|
2020-07-24 09:07:19 +00:00
|
|
|
${CC} -o $@ ${CMD_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-07-24 09:07:19 +00:00
|
|
|
rm -f ${LIBIFUPDOWN_OBJ} ${CMD_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-07-19 01:46:59 +00:00
|
|
|
kyua test
|
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-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-07-24 14:32:58 +00:00
|
|
|
doc/ifdown.8
|
|
|
|
|
|
|
|
MANPAGES_5 = \
|
2020-07-24 14:28:29 +00:00
|
|
|
doc/interfaces.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
|