]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
build: Put small and non small definitions in dhcpcd-embedded
authorRoy Marples <roy@marples.name>
Fri, 13 Sep 2019 11:37:59 +0000 (12:37 +0100)
committerRoy Marples <roy@marples.name>
Fri, 13 Sep 2019 11:37:59 +0000 (12:37 +0100)
This allows for easy source importing and the build can decide
which variant they want.

src/Makefile
src/dhcpcd-embedded.h.in
src/genembedc
src/genembedh

index 8581159bbdafee3feb2f7dfb454d1a9d9e33a137..03fa68b36d1868767c61d7b7d840cfcb883a90a4 100644 (file)
@@ -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}
index 883d53bdd2c13e668ff1a6936edc15a658600e75..aa1adbb8f65c85c82e6818ed52cc4c42f05c7726 100644 (file)
  * 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[];
index 27b585399453b4fc2153f056cd82e2bd1344d531..36b9d75db6fdd6883ffec87f9f13b25e84f60d42 100755 (executable)
@@ -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" "};"
index cd97cbb44d786a01e1553f52596a706f4f2117af..1762a60429098c4bb6bcb4d163957c1c30a11617 100755 (executable)
@@ -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