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
|
2013-06-07 20:44:19 +08:00
|
|
|
SRCS+= if-options.c if-pref.c net.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
|
|
|
|
CSTD?= c99
|
2013-09-13 01:08:34 +08:00
|
|
|
MKDIRS=
|
2009-07-14 21:59:30 +08:00
|
|
|
include config.mk
|
2013-06-25 17:04:10 +08:00
|
|
|
CFLAGS+= -std=${CSTD}
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2009-10-09 04:21:23 +08:00
|
|
|
OBJS+= ${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
|
2009-07-14 21:59:30 +08:00
|
|
|
CLEANFILES+= .depend
|
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'
|
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'
|
|
|
|
SED_SCRIPT= -e 's:@SCRIPT@:${SCRIPT}:g'
|
|
|
|
SED_SYS= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
|
2008-05-20 20:23:29 +08:00
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
_DEPEND_SH= test -e .depend && echo ".depend" || echo ""
|
|
|
|
_DEPEND!= ${_DEPEND_SH}
|
|
|
|
DEPEND= ${_DEPEND}$(shell ${_DEPEND_SH})
|
|
|
|
|
|
|
|
_VERSION_SH= sed -n 's/\#define VERSION[[:space:]]*"\(.*\)".*/\1/p' defs.h
|
|
|
|
_VERSION!= ${_VERSION_SH}
|
|
|
|
VERSION= ${_VERSION}$(shell ${_VERSION_SH})
|
|
|
|
|
|
|
|
GITREF?= HEAD
|
|
|
|
DISTPREFIX?= ${PROG}-${VERSION}
|
|
|
|
DISTFILE?= ${DISTPREFIX}.tar.bz2
|
|
|
|
|
|
|
|
CLEANFILES+= *.tar.bz2
|
|
|
|
|
2013-09-12 23:43:20 +08:00
|
|
|
.PHONY: import import-bsd dev
|
2009-07-15 17:36:43 +08:00
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
.SUFFIXES: .in
|
|
|
|
|
2008-01-18 02:49:26 +08:00
|
|
|
.in:
|
2013-09-21 22:31:06 +08:00
|
|
|
${SED} ${SED_RUNDIR} ${SED_DBDIR} ${SED_LIBDIR} ${SED_HOOKDIR} \
|
|
|
|
${SED_SYS} ${SED_SCRIPT} \
|
2010-09-09 22:40:27 +08:00
|
|
|
${SED_SERVICEEXISTS} ${SED_SERVICECMD} ${SED_SERVICESTATUS} \
|
|
|
|
$< > $@
|
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
|
|
|
|
|
|
|
.c.o:
|
|
|
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
|
|
|
|
2009-10-09 04:21:23 +08:00
|
|
|
.depend: ${SRCS} ${COMPAT_SRCS}
|
|
|
|
${CC} ${CPPFLAGS} -MM ${SRCS} ${COMPAT_SRCS} > .depend
|
2009-07-14 21:59:30 +08:00
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
|
|
|
${PROG}: ${DEPEND} ${OBJS}
|
|
|
|
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
|
|
|
|
|
|
|
_proginstall: ${PROG}
|
|
|
|
${INSTALL} -d ${DESTDIR}${SBINDIR}
|
|
|
|
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
|
|
|
|
${INSTALL} -d ${DESTDIR}${DBDIR}
|
|
|
|
|
2013-09-12 23:43:20 +08:00
|
|
|
proginstall: _proginstall
|
|
|
|
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
|
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
_scriptsinstall: ${SCRIPTS}
|
|
|
|
${INSTALL} -d ${DESTDIR}${SCRIPTSDIR}
|
|
|
|
${INSTALL} -m ${BINMODE} ${SCRIPTS} ${DESTDIR}${SCRIPTSDIR}
|
|
|
|
|
|
|
|
_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}
|
|
|
|
|
|
|
|
install: _proginstall _scriptsinstall _maninstall _confinstall
|
|
|
|
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ${OBJS} ${PROG} ${PROG}.core ${CLEANFILES}
|
2013-09-12 23:43:20 +08:00
|
|
|
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2010-06-10 05:16:04 +08:00
|
|
|
distclean: clean
|
|
|
|
rm -f .depend config.h config.mk
|
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
dist:
|
|
|
|
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
|
|
|
|
|
2009-10-09 04:21:23 +08:00
|
|
|
import:
|
2009-07-15 17:36:43 +08:00
|
|
|
rm -rf /tmp/${DISTPREFIX}
|
|
|
|
${INSTALL} -d /tmp/${DISTPREFIX}
|
2009-10-09 04:21:23 +08:00
|
|
|
cp ${SRCS} dhcpcd.conf *.in /tmp/${DISTPREFIX}
|
2009-07-16 19:03:09 +08:00
|
|
|
cp $$(${CC} ${CPPFLAGS} -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' | \
|
2009-07-15 17:36:43 +08:00
|
|
|
sort -u) /tmp/${DISTPREFIX}
|
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} -MM ${COMPAT_SRCS} | \
|
2010-02-27 23:33:18 +08:00
|
|
|
sed -e 's/^.*c //g' -e 's/.*\.c$$//g' -e 's/\\//g' | \
|
2009-10-09 04:21:23 +08:00
|
|
|
tr ' ' '\n' | \
|
|
|
|
sort -u) /tmp/${DISTPREFIX}/compat; \
|
|
|
|
fi;
|
2013-06-20 18:35:16 +08:00
|
|
|
if test -n "${IMPORT_RCSID}"; then \
|
|
|
|
for x in \
|
|
|
|
/tmp/${DISTPREFIX}/*.c \
|
|
|
|
/tmp/${DISTPREFIX}/compat/*.c \
|
|
|
|
; do \
|
|
|
|
if test -e "$$x"; then \
|
|
|
|
printf "${IMPORT_RCSID}\n\n" >"$$x".new; \
|
|
|
|
cat "$$x" >>"$$x".new; \
|
|
|
|
mv "$$x".new "$$x"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi;
|
|
|
|
if test -n "${IMPORT_HID}"; then \
|
|
|
|
for x in \
|
|
|
|
/tmp/${DISTPREFIX}/*.h \
|
|
|
|
/tmp/${DISTPREFIX}/compat/*.h \
|
|
|
|
; do \
|
|
|
|
if test -e "$$x"; then \
|
|
|
|
printf "${IMPORT_HID}\n\n" >"$$x".new; \
|
|
|
|
cat "$$x" >>"$$x".new; \
|
|
|
|
mv "$$x".new "$$x"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi;
|
|
|
|
if test -n "${IMPORT_MANID}"; then \
|
|
|
|
for x in \
|
|
|
|
/tmp/${DISTPREFIX}/dhcpcd.8.in \
|
|
|
|
/tmp/${DISTPREFIX}/dhcpcd-run-hooks.8.in \
|
|
|
|
/tmp/${DISTPREFIX}/dhcpcd.conf.5.in \
|
|
|
|
; do \
|
|
|
|
if test -e "$$x"; then \
|
|
|
|
printf "${IMPORT_MANID}\n" >"$$x".new; \
|
|
|
|
cat "$$x" >>"$$x".new; \
|
|
|
|
mv "$$x".new "$$x"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi;
|
|
|
|
if test -n "${IMPORT_SHID}"; then \
|
|
|
|
for x in \
|
|
|
|
/tmp/${DISTPREFIX}/dhcpcd-run-hooks.in \
|
|
|
|
/tmp/${DISTPREFIX}/dhcpcd.conf \
|
|
|
|
; do \
|
|
|
|
if test -e "$$x"; then \
|
|
|
|
if test "$$(sed -ne 1p $$x)" = "#!/bin/sh" \
|
|
|
|
; then \
|
|
|
|
echo "#!/bin/sh" > "$$x".new; \
|
|
|
|
printf "${IMPORT_SHID}\n" >>"$$x".new; \
|
|
|
|
echo "" >>"$$x".new; \
|
|
|
|
sed 1d "$$x" >>"$$x".new; \
|
|
|
|
else \
|
|
|
|
printf "${IMPORT_SHID}\n" >>"$$x".new; \
|
|
|
|
echo "" >>"$$x".new; \
|
|
|
|
cat "$$x" >>"$$x".new; \
|
|
|
|
fi; \
|
|
|
|
mv "$$x".new "$$x"; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
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
|