From: Roy Marples Date: Fri, 13 Sep 2019 11:37:59 +0000 (+0100) Subject: build: Put small and non small definitions in dhcpcd-embedded X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab1a544de34be83a87ae5b548ea1b2acec7d43d0;p=thirdparty%2Fdhcpcd.git build: Put small and non small definitions in dhcpcd-embedded This allows for easy source importing and the build can decide which variant they want. --- diff --git a/src/Makefile b/src/Makefile index 8581159b..03fa68b3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,8 @@ CFLAGS+= -std=${CSTD} CPPFLAGS+= -I${TOP} -I${TOP}/src -I./crypt SRCS+= ${DHCPCD_SRCS} -DHCPCD_DEFS?= dhcpcd-definitions.conf +DHCPCD_DEF?= dhcpcd-definitions.conf +DHCPCD_DEFS= dhcpcd-definitions.conf dhcpcd-definitions-small.conf PCOMPAT_SRCS= ${COMPAT_SRCS:compat/%=${TOP}/compat/%} PCRYPT_SRCS= ${CRYPT_SRCS:compat/%=${TOP}/compat/%} @@ -74,9 +75,9 @@ ${PROG}: ${DEPEND} ${OBJS} lint: ${LINT} -Suz ${CPPFLAGS} ${SRCS} ${PCRYPT_SRCS} ${PCOMPAT_SRCS} -_embeddedinstall: ${DHCPCD_DEFS} +_embeddedinstall: ${DHCPCD_DEF} ${INSTALL} -d ${DESTDIR}${LIBEXECDIR} - ${INSTALL} -m ${CONFMODE} ${DHCPCD_DEFS} ${DESTDIR}${LIBEXECDIR} + ${INSTALL} -m ${CONFMODE} ${DHCPCD_DEF} ${DESTDIR}${LIBEXECDIR} _proginstall: ${PROG} ${INSTALL} -d ${DESTDIR}${SBINDIR} diff --git a/src/dhcpcd-embedded.h.in b/src/dhcpcd-embedded.h.in index 883d53bd..aa1adbb8 100644 --- a/src/dhcpcd-embedded.h.in +++ b/src/dhcpcd-embedded.h.in @@ -25,8 +25,14 @@ * SUCH DAMAGE. */ +#ifdef SMALL +#define INITDEFINES @INITDEFINES_SMALL@ +#define INITDEFINENDS @INITDEFINENDS_SMALL@ +#define INITDEFINE6S @INITDEFINE6S_SMALL@ +#else #define INITDEFINES @INITDEFINES@ #define INITDEFINENDS @INITDEFINENDS@ #define INITDEFINE6S @INITDEFINE6S@ +#endif extern const char * const dhcpcd_embedded_conf[]; diff --git a/src/genembedc b/src/genembedc index 27b58539..36b9d75d 100755 --- a/src/genembedc +++ b/src/genembedc @@ -4,9 +4,20 @@ set -e : ${TOOL_CAT:=cat} : ${TOOL_SED:=sed} CONF=${1:-dhcpcd-definitions.conf} -C=${2:-dhcpcd-embedded.c.in} +CONF_SMALL=${2:-dhcpcd-definitions.conf} +C=${3:-dhcpcd-embedded.c.in} $TOOL_CAT $C +echo "#ifdef SMALL" +$TOOL_SED \ + -e 's/#.*$//' \ + -e '/^$/d' \ + -e 's/^/"/g' \ + -e 's/$/\",/g' \ + -e 's/ [ ]*/ /g' \ + -e 's/ [ ]*/ /g' \ + $CONF_SMALL +echo "#else" $TOOL_SED \ -e 's/#.*$//' \ -e '/^$/d' \ @@ -15,4 +26,5 @@ $TOOL_SED \ -e 's/ [ ]*/ /g' \ -e 's/ [ ]*/ /g' \ $CONF +echo "#endif" printf "%s\n%s\n" "NULL" "};" diff --git a/src/genembedh b/src/genembedh index cd97cbb4..1762a604 100755 --- a/src/genembedh +++ b/src/genembedh @@ -5,13 +5,20 @@ set -e : ${TOOL_GREP:=grep} : ${TOOL_WC:=wc} CONF=${1:-dhcpcd-definitions.conf} -H=${2:-dhcpcd-embedded.h.in} +CONF_SMALL=${2:-dhcpcd-definitions-small.conf} +H=${3:-dhcpcd-embedded.h.in} INITDEFINES=$($TOOL_GREP "^define " $CONF | $TOOL_WC -l) INITDEFINENDS=$($TOOL_GREP "^definend " $CONF | $TOOL_WC -l) INITDEFINE6S=$($TOOL_GREP "^define6 " $CONF | $TOOL_WC -l) +INITDEFINES_SMALL=$($TOOL_GREP "^define " $CONF_SMALL | $TOOL_WC -l) +INITDEFINENDS_SMALL=$($TOOL_GREP "^definend " $CONF_SMALL | $TOOL_WC -l) +INITDEFINE6S_SMALL=$($TOOL_GREP "^define6 " $CONF_SMALL | $TOOL_WC -l) $TOOL_SED \ -e "s/@INITDEFINES@/$INITDEFINES/" \ -e "s/@INITDEFINENDS@/$INITDEFINENDS/" \ -e "s/@INITDEFINE6S@/$INITDEFINE6S/" \ + -e "s/@INITDEFINES_SMALL@/$INITDEFINES_SMALL/" \ + -e "s/@INITDEFINENDS_SMALL@/$INITDEFINENDS_SMALL/" \ + -e "s/@INITDEFINE6S_SMALL@/$INITDEFINE6S_SMALL/" \ $H