2008-01-10 22:05:59 +05:30
|
|
|
# Install rules for our scripts
|
2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2008-01-10 22:05:59 +05:30
|
|
|
|
2008-01-11 23:59:47 +05:30
|
|
|
include ${MK}/sys.mk
|
2008-01-10 22:05:59 +05:30
|
|
|
include ${MK}/os.mk
|
|
|
|
|
2008-03-03 18:04:51 +05:30
|
|
|
OBJS+= ${SRCS:.in=}
|
|
|
|
|
2008-03-20 23:22:07 +05:30
|
|
|
_PKG_SED_SH= if test "${PREFIX}" = "${PKG_PREFIX}"; then echo "-e 's:@PKG_PREFIX@::g'"; else echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; fi
|
2011-01-30 05:02:38 +05:30
|
|
|
_PKG_SED:= $(shell ${_PKG_SED_SH})
|
2008-03-20 23:22:07 +05:30
|
|
|
_LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi
|
2011-01-30 05:02:38 +05:30
|
|
|
_LCL_SED:= $(shell ${_LCL_SED_SH})
|
2008-03-20 23:22:07 +05:30
|
|
|
|
2011-03-05 06:38:08 +05:30
|
|
|
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}
|
2008-03-05 17:57:11 +05:30
|
|
|
|
2008-02-28 01:59:32 +05:30
|
|
|
# Tweak our shell scripts
|
2011-10-28 21:44:44 +05:30
|
|
|
%.sh: %.sh.in
|
2008-03-26 19:57:46 +05:30
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2008-02-28 01:59:32 +05:30
|
|
|
|
2011-10-28 21:44:44 +05:30
|
|
|
%: %.in
|
2008-03-26 19:57:46 +05:30
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2008-03-03 02:44:01 +05:30
|
|
|
|
2008-04-29 15:55:45 +05:30
|
|
|
all: ${OBJS} ${TARGETS}
|
2008-01-10 22:05:59 +05:30
|
|
|
|
2008-04-29 15:55:45 +05:30
|
|
|
realinstall: ${BIN} ${CONF} ${INC}
|
2008-03-25 19:36:05 +05:30
|
|
|
@if test -n "${DIR}"; then \
|
2008-03-25 22:29:26 +05:30
|
|
|
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
|
|
|
|
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
|
2008-03-25 19:36:05 +05:30
|
|
|
fi
|
|
|
|
@if test -n "${BIN}"; then \
|
2008-03-25 22:29:26 +05:30
|
|
|
${ECHO} ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${DIR}; \
|
|
|
|
${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${DIR} || exit $$?; \
|
2008-03-25 19:36:05 +05:30
|
|
|
fi
|
|
|
|
@if test -n "${INC}"; then \
|
2008-03-25 22:29:26 +05:30
|
|
|
${ECHO} ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${DIR}; \
|
|
|
|
${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${DIR} || exit $$?; \
|
2008-03-25 19:36:05 +05:30
|
|
|
fi
|
|
|
|
@for x in ${CONF}; do \
|
|
|
|
if ! test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
2008-03-25 22:29:26 +05:30
|
|
|
${ECHO} ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${DIR}; \
|
|
|
|
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${DIR} || exit $$?; \
|
2008-01-10 22:05:59 +05:30
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
|
2008-01-13 19:44:47 +05:30
|
|
|
install: all realinstall ${INSTALLAFTER}
|
2008-01-10 22:05:59 +05:30
|
|
|
|
2008-03-24 11:40:40 +05:30
|
|
|
check test::
|
2008-03-24 12:47:05 +05:30
|
|
|
@if test -e runtests.sh ; then ./runtests.sh || exit $$? ; fi
|
2008-03-24 11:40:40 +05:30
|
|
|
|
2008-01-11 22:51:21 +05:30
|
|
|
# A lot of scripts don't have anything to clean
|
|
|
|
# Also, some rm implentation require a file argument regardless of error
|
|
|
|
# so we ensure that it has a bogus argument
|
2008-01-13 19:25:23 +05:30
|
|
|
CLEANFILES+= ${OBJS}
|
2008-01-10 22:05:59 +05:30
|
|
|
clean:
|
2012-01-22 05:47:42 +05:30
|
|
|
@if test -n "${CLEANFILES}"; then echo "rm -f ${CLEANFILES}"; rm -f ${CLEANFILES}; fi
|
2008-03-03 18:34:08 +05:30
|
|
|
|
2009-04-30 19:35:39 +05:30
|
|
|
include ${MK}/gitignore.mk
|