dhcpcd/Makefile

185 lines
5.1 KiB
Makefile
Raw Normal View History

# dhcpcd Makefile
PROG= dhcpcd
SRCS= common.c control.c dhcpcd.c duid.c eloop.c
SRCS+= if.c if-options.c script.c
SRCS+= dhcp-common.c
CFLAGS?= -O2
2013-09-13 01:08:34 +08:00
MKDIRS=
TOP?= .
include ${TOP}/iconfig.mk
CSTD?= c99
2015-09-08 20:22:38 +08:00
CFLAGS+= -std=${CSTD}
SRCS+= ${DHCPCD_SRCS}
DHCPCD_DEFS?= dhcpcd-definitions.conf
OBJS+= ${SRCS:.c=.o} ${AUTH_SRCS:.c=.o} ${COMPAT_SRCS:.c=.o}
SCRIPT= ${LIBEXECDIR}/dhcpcd-run-hooks
HOOKDIR= ${LIBEXECDIR}/dhcpcd-hooks
MAN5= dhcpcd.conf.5
MAN8= dhcpcd.8 dhcpcd-run-hooks.8
CLEANFILES= dhcpcd.conf.5 dhcpcd.8 dhcpcd-run-hooks.8
SCRIPTS= dhcpcd-run-hooks
SCRIPTSDIR= ${LIBEXECDIR}
CLEANFILES+= dhcpcd-run-hooks
FILES= dhcpcd.conf
FILESDIR= ${SYSCONFDIR}
2013-09-13 01:08:34 +08:00
SUBDIRS= dhcpcd-hooks ${MKDIRS}
SED_RUNDIR= -e 's:@RUNDIR@:${RUNDIR}:g'
SED_DBDIR= -e 's:@DBDIR@:${DBDIR}:g'
SED_LIBDIR= -e 's:@LIBDIR@:${LIBDIR}:g'
SED_DATADIR= -e 's:@DATADIR@:${DATADIR}:g'
SED_HOOKDIR= -e 's:@HOOKDIR@:${HOOKDIR}:g'
SED_SERVICEEXISTS= -e 's:@SERVICEEXISTS@:${SERVICEEXISTS}:g'
SED_SERVICECMD= -e 's:@SERVICECMD@:${SERVICECMD}:g'
SED_SERVICESTATUS= -e 's:@SERVICESTATUS@:${SERVICESTATUS}:g'
SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g'
SED_SCRIPT= -e 's:@SCRIPT@:${SCRIPT}:g'
SED_SYS= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
DEPEND!= test -e .depend && echo ".depend" || echo ""
VERSION!= sed -n 's/\#define VERSION[[:space:]]*"\(.*\)".*/\1/p' defs.h
FOSSILID?= current
DISTPREFIX?= ${PROG}-${VERSION}
DISTFILEGZ?= ${DISTPREFIX}.tar.gz
DISTFILE?= ${DISTPREFIX}.tar.xz
HOST_SH?= /bin/sh
CLEANFILES+= *.tar.xz
.PHONY: import import-bsd dev test
.SUFFIXES: .in
.in: Makefile config.mk
${SED} ${SED_RUNDIR} ${SED_DBDIR} ${SED_LIBDIR} ${SED_HOOKDIR} \
${SED_SYS} ${SED_SCRIPT} ${SED_DATADIR} \
${SED_SERVICEEXISTS} ${SED_SERVICECMD} ${SED_SERVICESTATUS} \
${SED_STATUSARG} \
$< > $@
2009-11-20 20:40:59 +08:00
all: config.h ${PROG} ${SCRIPTS} ${MAN5} ${MAN8}
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
dev:
cd dev && ${MAKE}
.c.o: Makefile config.mk
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
CLEANFILES+= dhcpcd-embedded.h dhcpcd-embedded.c
dhcpcd-embedded.h: genembedh ${DHCPCD_DEFS} dhcpcd-embedded.h.in
${HOST_SH} ${.ALLSRC} $^ > $@
dhcpcd-embedded.c: genembedc ${DHCPCD_DEFS} dhcpcd-embedded.h
${HOST_SH} ${.ALLSRC} $^ > $@
if-options.c: dhcpcd-embedded.h
2014-07-31 08:57:47 +08:00
.depend: ${SRCS} ${COMPAT_SRCS} ${CRYPT_SRCS}
${CC} ${CPPFLAGS} -MM ${SRCS} ${COMPAT_SRCS} ${CRYPT_SRCS} > .depend
depend: .depend
${PROG}: ${DEPEND} ${OBJS}
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
test:
cd $@; ${MAKE} $@; ./$@
_embeddedinstall: ${DHCPCD_DEFS}
${INSTALL} -d ${DESTDIR}${SCRIPTSDIR}
${INSTALL} -m ${CONFMODE} ${DHCPCD_DEFS} ${DESTDIR}${SCRIPTSDIR}
_proginstall: ${PROG}
${INSTALL} -d ${DESTDIR}${SBINDIR}
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
${INSTALL} -d ${DESTDIR}${DBDIR}
_scriptsinstall: ${SCRIPTS}
${INSTALL} -d ${DESTDIR}${SCRIPTSDIR}
${INSTALL} -m ${BINMODE} ${SCRIPTS} ${DESTDIR}${SCRIPTSDIR}
proginstall: _proginstall _scriptsinstall ${EMBEDDEDINSTALL}
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
_maninstall: ${MAN5} ${MAN8}
${INSTALL} -d ${DESTDIR}${MANDIR}/man5
${INSTALL} -m ${MANMODE} ${MAN5} ${DESTDIR}${MANDIR}/man5
${INSTALL} -d ${DESTDIR}${MANDIR}/man8
${INSTALL} -m ${MANMODE} ${MAN8} ${DESTDIR}${MANDIR}/man8
_confinstall:
${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
test -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf || \
${INSTALL} -m ${CONFMODE} dhcpcd.conf ${DESTDIR}${SYSCONFDIR}
2015-12-23 07:46:17 +08:00
eginstall:
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
install: proginstall _maninstall _confinstall eginstall
clean:
rm -f ${OBJS} ${PROG} ${PROG}.core ${CLEANFILES}
for x in ${SUBDIRS} test; do cd $$x; ${MAKE} $@; cd ..; done
2010-06-10 05:16:04 +08:00
distclean: clean
rm -f .depend config.h config.mk config.log
2010-06-10 05:16:04 +08:00
dist:
fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
rm ${DISTFILEGZ}
2015-02-23 20:16:17 +08:00
snapshot:
rm -rf /tmp/${DISTPREFIX}
${INSTALL} -d /tmp/${DISTPREFIX}
cp -RPp * /tmp/${DISTPREFIX}
2016-02-15 22:23:51 +08:00
${MAKE} -C /tmp/${DISTPREFIX} distclean
tar cf - -C /tmp ${DISTPREFIX} | xz >${DISTFILE}
2015-02-23 20:16:17 +08:00
ls -l ${DISTFILE}
import: ${SRCS}
rm -rf /tmp/${DISTPREFIX}
${INSTALL} -d /tmp/${DISTPREFIX}
cp ${SRCS} dhcpcd.conf dhcpcd-definitions.conf *.in /tmp/${DISTPREFIX}
cp $$(${CC} ${CPPFLAGS} -DDEPGEN -MM ${SRCS} | \
2010-02-27 23:33:18 +08:00
sed -e 's/^.*\.c //g' -e 's/.*\.c$$//g' -e 's/\\//g' | \
tr ' ' '\n' | \
2009-11-20 20:40:59 +08:00
sed -e '/^compat\//d' | \
2014-01-31 23:55:16 +08:00
sed -e '/^crypt\//d' | \
sort -u) /tmp/${DISTPREFIX}; \
if test -n "${CRYPT_SRCS}"; then \
${INSTALL} -d /tmp/${DISTPREFIX}/crypt; \
cp ${CRYPT_SRCS} /tmp/${DISTPREFIX}/crypt; \
cp $$(${CC} ${CPPFLAGS} -DDEPGEN -MM ${CRYPT_SRCS} | \
2014-01-31 23:55:16 +08:00
sed -e 's/^.*c //g' -e 's/.*\.c$$//g' -e 's/\\//g' | \
tr ' ' '\n' | sed -e '/\/\.\.\//d' | \
2014-01-31 23:55:16 +08:00
sort -u) /tmp/${DISTPREFIX}/crypt; \
fi;
2009-10-09 04:21:23 +08:00
if test -n "${COMPAT_SRCS}"; then \
${INSTALL} -d /tmp/${DISTPREFIX}/compat; \
cp ${COMPAT_SRCS} /tmp/${DISTPREFIX}/compat; \
cp $$(${CC} ${CPPFLAGS} -DDEPGEN -MM ${COMPAT_SRCS} | \
2010-02-27 23:33:18 +08:00
sed -e 's/^.*c //g' -e 's/.*\.c$$//g' -e 's/\\//g' | \
tr ' ' '\n' | \
2009-10-09 04:21:23 +08:00
sort -u) /tmp/${DISTPREFIX}/compat; \
fi;
cd dhcpcd-hooks; ${MAKE} DISTPREFIX=${DISTPREFIX} $@
include Makefile.inc