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.
This commit is contained in:
parent
f94e883633
commit
5066d40ac8
@ -5,7 +5,7 @@ INC= net.example
|
|||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
|
|
||||||
${SFX}:
|
%.example.in: %.example${SFX}
|
||||||
${CP} $< $@
|
${CP} $< $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
@ -37,7 +37,7 @@ SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
|||||||
# These are NetBSD specific
|
# These are NetBSD specific
|
||||||
SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in
|
SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in
|
||||||
|
|
||||||
${SFX}:
|
%.in: %${SFX}
|
||||||
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
@ -14,12 +14,10 @@ _LIBS= lib${LIB}.a ${SHLIB_NAME}
|
|||||||
|
|
||||||
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
||||||
|
|
||||||
.SUFFIXES: .So
|
%.o: %.c
|
||||||
|
|
||||||
.c.o:
|
|
||||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
.c.So:
|
%.So: %.c
|
||||||
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
||||||
|
|
||||||
all: depend ${_LIBS}
|
all: depend ${_LIBS}
|
||||||
|
3
mk/os.mk
3
mk/os.mk
@ -9,6 +9,3 @@ OS?= ${_OS}
|
|||||||
include ${MK}/os-${OS}.mk
|
include ${MK}/os-${OS}.mk
|
||||||
|
|
||||||
RC_LIB= /$(LIBNAME)/rc
|
RC_LIB= /$(LIBNAME)/rc
|
||||||
|
|
||||||
SFX:= ${SFX_PFX}${SFX}
|
|
||||||
.SUFFIXES: ${SFX}
|
|
||||||
|
@ -24,7 +24,7 @@ CLEANFILES+= ${OBJS} ${PROG}
|
|||||||
|
|
||||||
all: depend ${PROG}
|
all: depend ${PROG}
|
||||||
|
|
||||||
.c.o:
|
%.o: %.c
|
||||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
${PROG}: ${SCRIPTS} ${OBJS}
|
${PROG}: ${SCRIPTS} ${OBJS}
|
||||||
|
@ -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}
|
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
|
# Tweak our shell scripts
|
||||||
.SUFFIXES: .sh.in .in
|
%.sh: %.sh.in
|
||||||
.sh.in.sh:
|
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
.in:
|
%: %.in
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
all: ${OBJS} ${TARGETS}
|
all: ${OBJS} ${TARGETS}
|
||||||
|
@ -18,7 +18,7 @@ INC-Linux= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
|
|||||||
SRCS-NetBSD=
|
SRCS-NetBSD=
|
||||||
INC-NetBSD= ifwatchd.sh
|
INC-NetBSD= ifwatchd.sh
|
||||||
|
|
||||||
${SFX}.sh:
|
%.sh: %.sh${SFX}
|
||||||
${CP} $< $@
|
${CP} $< $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
@ -6,7 +6,6 @@ BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}}
|
|||||||
|
|
||||||
INSTALLAFTER= _installafter
|
INSTALLAFTER= _installafter
|
||||||
|
|
||||||
SFX_PFX= .sh
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh
|
|||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
${SFX}.sh:
|
%.sh: %.sh${SFX}
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
_installafter:
|
_installafter:
|
||||||
|
@ -39,8 +39,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
SED_CMD+= ${_LCL_PREFIX}
|
SED_CMD+= ${_LCL_PREFIX}
|
||||||
|
|
||||||
.SUFFIXES: .h.in .h
|
%.h: %.h.in
|
||||||
.h.in.h:
|
|
||||||
${SED} ${SED_CMD} $< > $@
|
${SED} ${SED_CMD} $< > $@
|
||||||
${SRCS}: rc.h
|
${SRCS}: rc.h
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user