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