aboutsummaryrefslogtreecommitdiff
path: root/mk/scripts.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/scripts.mk')
-rw-r--r--mk/scripts.mk8
1 files changed, 5 insertions, 3 deletions
diff --git a/mk/scripts.mk b/mk/scripts.mk
index a77e17e5..ce3b25aa 100644
--- a/mk/scripts.mk
+++ b/mk/scripts.mk
@@ -6,15 +6,17 @@ include ${MK}/os.mk
OBJS+= ${SRCS:.in=}
-_SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'
+_SED_PREFIX_SH= if test "${PREFIX}" = "${PKG_PREFIX}"; then echo "-e 's:@PKG_PREFIX@::g'"; else echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; fi
+_SED_PREFIX!= ${_SED_PREFIX_SH}
+SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' ${_SED_PREFIX}$(shell ${_SED_PREFIX_SH}) -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'
# Tweak our shell scripts
.SUFFIXES: .sh.in .in
.sh.in.sh:
- sed ${_SED_REPLACE} $< > $@
+ sed ${SED_REPLACE} $< > $@
.in:
- sed ${_SED_REPLACE} $< > $@
+ sed ${SED_REPLACE} $< > $@
all: ${OBJS}