]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add a dist mk stub and tweak the other mk's for style.
authorRoy Marples <roy@marples.name>
Tue, 8 Jan 2008 09:41:22 +0000 (09:41 +0000)
committerRoy Marples <roy@marples.name>
Tue, 8 Jan 2008 09:41:22 +0000 (09:41 +0000)
mk/cc.mk
mk/depend.mk
mk/dist.mk [new file with mode: 0644]
mk/os.mk
mk/prog.mk

index 5ba11b18f929010df6a7c9cefdb3bb1a3bee65d6..101d17c078ac6e647da3a7aaac75c1514902d958 100644 (file)
--- a/mk/cc.mk
+++ b/mk/cc.mk
@@ -6,12 +6,12 @@ CFLAGS?=      -O2 -pipe
 CSTD?=         c99
 
 # GNU Make way of detecting gcc flags we can use
-check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+check_gcc=$(shell if ${CC} $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
        then echo "$(1)"; else echo "$(2)"; fi)
 
 # pmake check for extra cflags 
 WEXTRA!= for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
-       if $(CC) $$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+       if ${CC} $$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
        then echo -n "$$x "; fi \
        done
 
@@ -23,5 +23,5 @@ CFLAGS+=      -pedantic -std=${CSTD} \
                -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
                $(call check_gcc, -Wdeclaration-after-statement) \
                $(call check_gcc, -Wsequence-point) \
-               $(call check_gcc, -Wextra) $(WEXTRA)
+               $(call check_gcc, -Wextra) ${WEXTRA}
 
index fbb965a95f69127ec04bea1cd97cf96b63b728ca..870d2ab797e025be633882a87ef79c758a166c6c 100644 (file)
@@ -3,10 +3,9 @@
 
 # Copyright 2008 Roy Marples
 
+CLEANFILES+=   .depend
+
 .depend: ${SCRIPTS} ${SRCS}
-       $(CC) $(CFLAGS) -MM ${SRCS} > .depend
+       ${CC} ${CFLAGS} -MM ${SRCS} > .depend
 
 depend: .depend
-
-_dependclean:
-       rm -f .depend
diff --git a/mk/dist.mk b/mk/dist.mk
new file mode 100644 (file)
index 0000000..01b0df2
--- /dev/null
@@ -0,0 +1,10 @@
+# rules to make a distribution tarball
+# Copyright 2008 Roy Marples
+
+GITREF?=       HEAD
+DISTFILE?=     ${PROG}-${VERSION}.tar.bz2
+
+CLEANFILES+=   ${DISTFILE}
+
+dist:
+       git archive ${GITREF} | bzip2 >${DISTFILE}
index ba7e868bbc0739b08f1efef5df248e769826a154..08a591967c68d1d197f3db0c155b0926dc6bfe49 100644 (file)
--- a/mk/os.mk
+++ b/mk/os.mk
@@ -3,9 +3,9 @@
 
 # Work out if we need -lresolv or not
 _LIBRESOLV_SH= printf '\#include <netinet/in.h>\n\#include <resolv.h>\nint main (void) { return (res_init ()); }\n' > .res_init.c; \
-       if $(CC) .res_init.c -o .res_init >/dev/null 2>&1; then \
+       if ${CC} .res_init.c -o .res_init >/dev/null 2>&1; then \
                echo ""; \
-       elif $(CC) .res_init.c -lresolv -o .res_init >/dev/null 2>&1; then \
+       elif ${CC} .res_init.c -lresolv -o .res_init >/dev/null 2>&1; then \
                echo "-lresolv"; \
        else \
                echo "Cannot work out how to get res_init to link" >&2; \
@@ -13,30 +13,30 @@ _LIBRESOLV_SH= printf '\#include <netinet/in.h>\n\#include <resolv.h>\nint main
                exit 1; \
        fi; \
        rm -f .res_init.c .res_init
-_LIBRESOLV!= $(_LIBRESOLV_SH)
-LIBRESOLV= $(_LIBRESOLV)$(shell $(_LIBRESOLV_SH))
+_LIBRESOLV!= ${_LIBRESOLV_SH}
+LIBRESOLV= ${_LIBRESOLV}$(shell ${_LIBRESOLV_SH})
 
 # Work out if we need -lrt or not
 _LIBRT_SH= printf '\#include <time.h>\n\#include <unistd.h>\n\nint main (void) { struct timespec ts;\n\#if defined(_POSIX_MONOTONIC_CLOCK) && defined(CLOCK_MONOTONIC)\nreturn (clock_gettime (CLOCK_MONOTONIC, &ts));\n\#else\nreturn -1;\n\#endif\n}\n' > .clock_gettime.c; \
-       if $(CC) .clock_gettime.c -o .clock_gettime >/dev/null 2>&1; then \
+       if ${CC} .clock_gettime.c -o .clock_gettime >/dev/null 2>&1; then \
                echo ""; \
-       elif $(CC) .clock_gettime.c -lrt -o .clock_gettime >/dev/null 2>&1; then \
+       elif ${CC} .clock_gettime.c -lrt -o .clock_gettime >/dev/null 2>&1; then \
                echo "-lrt"; \
        else \
                echo ""; \
        fi; \
        rm -f .clock_gettime.c .clock_gettime
-_LIBRT!= $(_LIBRT_SH)
-LIBRT= $(_LIBRT)$(shell $(_LIBRT_SH))
+_LIBRT!= ${_LIBRT_SH}
+LIBRT= ${_LIBRT}$(shell ${_LIBRT_SH})
 
 # Work out if our fork() works or not
-_HAVE_FORK_SH= if test "$(HAVE_FORK)" = "yes"; then \
+_HAVE_FORK_SH= if test "${HAVE_FORK}" = "yes"; then \
                echo ""; \
-       elif test -n "$(HAVE_FORK)"; then \
+       elif test -n "${HAVE_FORK}"; then \
                echo "-DTHERE_IS_NO_FORK"; \
        else \
                printf '\#include <stdlib.h>\n\#include <unistd.h>\nint main (void) { pid_t pid = fork(); if (pid == -1) exit (-1); exit (0); }\n' > .fork.c; \
-               $(CC) .fork.c -o .fork >/dev/null 2>&1; \
+               ${CC} .fork.c -o .fork >/dev/null 2>&1; \
                if ./.fork; then \
                        echo ""; \
                else \
@@ -44,8 +44,8 @@ _HAVE_FORK_SH= if test "$(HAVE_FORK)" = "yes"; then \
                fi; \
                rm -f .fork.c .fork; \
        fi;
-_HAVE_FORK!= $(_HAVE_FORK_SH)
-FORK= $(_HAVE_FORK)$(shell $(_HAVE_FORK_SH))
+_HAVE_FORK!= ${_HAVE_FORK_SH}
+FORK= ${_HAVE_FORK}$(shell ${_HAVE_FORK_SH})
 
 # info dir defaults to /var/lib/dhcpcd on Linux and /var/db elsewhere
 _INFODIR_SH= if test -n "${INFODIR}"; then \
@@ -57,16 +57,16 @@ _INFODIR_SH= if test -n "${INFODIR}"; then \
                          esac \
                          fi
 _INFODIR!= ${_INFODIR_SH}
-INFOD?= ${_INFODIR}$(shell $(_INFODIR_SH))
+INFOD?= ${_INFODIR}$(shell ${_INFODIR_SH})
 
 # Work out how to restart services 
-_RC_SH= if test -n "$(HAVE_INIT)"; then \
-                test "$(HAVE_INIT)" = "no" || echo "-DENABLE_$(HAVE_INIT)"; \
+_RC_SH= if test -n "${HAVE_INIT}"; then \
+                test "${HAVE_INIT}" = "no" || echo "-DENABLE_${HAVE_INIT}"; \
                 elif test -x /sbin/runscript; then echo "-DENABLE_OPENRC"; \
                 elif test -x /sbin/service; then echo "-DENABLE_SERVICE"; \
                 elif test -x /etc/rc.d/rc.S -a -x /etc/rc.d/rc.M; then echo "-DENABLE_SLACKRC"; \
                 elif test -d /etc/rc.d; then echo "-DENABLE_BSDRC"; \
                 elif test -d /etc/init.d; then echo "-DENABLE_SYSV"; \
                 fi
-_RC!= $(_RC_SH)
-RC= $(_RC)$(shell $(_RC_SH))
+_RC!= ${_RC_SH}
+RC= ${_RC}$(shell ${_RC_SH})
index abc3cf623d62de2632d67ffa9d553b79542b2e59..c36cfa41652a995dd2175149d6a9fa89e139ee98 100644 (file)
@@ -17,12 +17,11 @@ _proginstall: ${PROG}
        ${INSTALL} -d ${DESTDIR}${BINDIR}
        ${INSTALL} ${PROG} ${DESTDIR}${BINDIR}
 
-_progclean:
-       rm -f ${OBJS} ${PROG} ${CLEANFILES}
-
 include ${MK}/depend.mk
 include ${MK}/man.mk
+include ${MK}/dist.mk
 
 install: _proginstall maninstall
 
-clean: _progclean _dependclean
+clean:
+       rm -f ${OBJS} ${PROG} ${CLEANFILES}