ifupdown-ng/Makefile

114 lines
2.5 KiB
Makefile
Raw Normal View History

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-07-25 07:23:14 +00:00
PACKAGE_VERSION := 0.2.2
2020-07-19 01:09:08 +00:00
PACKAGE_BUGREPORT := https://github.com/kaniini/ifupdown-ng/issues/new
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
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 = \
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-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-07-25 08:55:09 +00:00
EXECUTOR_SCRIPTS = dhcp
2020-07-24 09:07:19 +00:00
CMD_OBJ = ${MULTICALL_OBJ} ${IFQUERY_OBJ} ${IFUPDOWN_OBJ}
CMDS = ifup ifdown ifquery
LIBS = ${LIBIFUPDOWN_LIB}
LIBS += ${LIBBSD_LIBS}
2020-07-24 09:07:19 +00:00
all: libifupdown.a ${MULTICALL} ${CMDS}
${CMDS}: ${MULTICALL}
ln -s ifupdown $@
${MULTICALL}: ${LIBS} ${CMD_OBJ}
${CC} -o $@ ${CMD_OBJ} ${LIBS}
2020-07-23 16:44:45 +00:00
2020-07-18 07:58:24 +00:00
libifupdown.a: ${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}
rm -f ${CMDS} ${MULTICALL}
2020-07-24 13:48:14 +00:00
rm -f ${MANPAGES}
2020-07-19 01:46:59 +00:00
2020-07-19 02:05:02 +00:00
check: libifupdown.a ${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 \
install -D -m755 executor-scripts/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
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 = \
doc/ifquery.8 \
doc/ifup.8 \
2020-07-24 14:32:58 +00:00
doc/ifdown.8
MANPAGES_5 = \
doc/interfaces.5
2020-07-24 13:48:14 +00:00
2020-07-24 14:32:58 +00:00
MANPAGES = ${MANPAGES_5} ${MANPAGES_8}
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_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