diff options
author | William Hubbs <williamh@gentoo.org> | 2011-10-28 11:14:44 -0500 |
---|---|---|
committer | William Hubbs <williamh@gentoo.org> | 2011-10-29 09:43:24 -0500 |
commit | 5066d40ac83fc9036843d670dbf816955b9f40a3 (patch) | |
tree | 9ca229a9816900f0c2864cf0a319a174c4cd36c4 | |
parent | f94e8836333f6dea142d9a7b29610fcc8d6b12a3 (diff) |
Use pattern rules instead of suffix rules
Rework the makefiles to use pattern rules instead of suffix rules.
This is the preferred way to write implicit rules according to the gnu
make manual.
-rw-r--r-- | doc/Makefile | 2 | ||||
-rw-r--r-- | init.d/Makefile | 2 | ||||
-rw-r--r-- | mk/lib.mk | 6 | ||||
-rw-r--r-- | mk/os.mk | 3 | ||||
-rw-r--r-- | mk/prog.mk | 2 | ||||
-rw-r--r-- | mk/scripts.mk | 5 | ||||
-rw-r--r-- | net/Makefile | 2 | ||||
-rw-r--r-- | sh/Makefile | 3 | ||||
-rw-r--r-- | src/librc/Makefile | 3 |
9 files changed, 10 insertions, 18 deletions
diff --git a/doc/Makefile b/doc/Makefile index 81e621ba..8fbf3e8b 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -5,7 +5,7 @@ INC= net.example MK= ../mk include ${MK}/os.mk -${SFX}: +%.example.in: %.example${SFX} ${CP} $< $@ include ${MK}/scripts.mk diff --git a/init.d/Makefile b/init.d/Makefile index db681549..de8428ab 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -37,7 +37,7 @@ SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ # These are NetBSD specific SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in -${SFX}: +%.in: %${SFX} sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ include ${MK}/scripts.mk @@ -14,12 +14,10 @@ _LIBS= lib${LIB}.a ${SHLIB_NAME} CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} -.SUFFIXES: .So - -.c.o: +%.o: %.c ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ -.c.So: +%.So: %.c ${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@ all: depend ${_LIBS} @@ -9,6 +9,3 @@ OS?= ${_OS} include ${MK}/os-${OS}.mk RC_LIB= /$(LIBNAME)/rc - -SFX:= ${SFX_PFX}${SFX} -.SUFFIXES: ${SFX} @@ -24,7 +24,7 @@ CLEANFILES+= ${OBJS} ${PROG} all: depend ${PROG} -.c.o: +%.o: %.c ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ ${PROG}: ${SCRIPTS} ${OBJS} diff --git a/mk/scripts.mk b/mk/scripts.mk index ce37a617..c0b44db0 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -15,11 +15,10 @@ _LCL_SED:= $(shell ${_LCL_SED_SH}) SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@RC_SYS_DEFAULT@:${MKRCSYS}:g' ${_PKG_SED} ${_LCL_SED} # Tweak our shell scripts -.SUFFIXES: .sh.in .in -.sh.in.sh: +%.sh: %.sh.in ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ -.in: +%: %.in ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ all: ${OBJS} ${TARGETS} diff --git a/net/Makefile b/net/Makefile index e87d3ddd..c2f37474 100644 --- a/net/Makefile +++ b/net/Makefile @@ -18,7 +18,7 @@ INC-Linux= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ SRCS-NetBSD= INC-NetBSD= ifwatchd.sh -${SFX}.sh: +%.sh: %.sh${SFX} ${CP} $< $@ include ${MK}/scripts.mk diff --git a/sh/Makefile b/sh/Makefile index c15c79e0..f7147802 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -6,7 +6,6 @@ BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}} INSTALLAFTER= _installafter -SFX_PFX= .sh MK= ../mk include ${MK}/os.mk @@ -21,7 +20,7 @@ BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh include ${MK}/scripts.mk -${SFX}.sh: +%.sh: %.sh${SFX} ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ _installafter: diff --git a/src/librc/Makefile b/src/librc/Makefile index 963fb415..0b4beb26 100644 --- a/src/librc/Makefile +++ b/src/librc/Makefile @@ -39,8 +39,7 @@ endif endif SED_CMD+= ${_LCL_PREFIX} -.SUFFIXES: .h.in .h -.h.in.h: +%.h: %.h.in ${SED} ${SED_CMD} $< > $@ ${SRCS}: rc.h |