2008-01-10 22:05:59 +05:30
|
|
|
# Install rules for our scripts
|
|
|
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
|
|
|
|
2008-03-03 02:44:01 +05:30
|
|
|
_IN_SH= ls -1 | sed -n -e 's:\.in$$::p' | xargs; echo
|
2008-02-28 01:59:32 +05:30
|
|
|
_IN!= ${_IN_SH}
|
|
|
|
OBJS+= ${_IN}$(shell ${_IN_SH})
|
|
|
|
|
2008-01-10 22:05:59 +05:30
|
|
|
# We store the contents of the directory for ease of use in Makefiles
|
2008-03-03 02:44:01 +05:30
|
|
|
_CONTENTS_SH= ls -1 | grep -v Makefile | sed -e 's:\.in$$::g' | sort -u | xargs
|
2008-01-10 22:05:59 +05:30
|
|
|
_CONTENTS!= ${_CONTENTS_SH}
|
|
|
|
CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
|
|
|
|
|
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-02-28 01:59:32 +05:30
|
|
|
# Tweak our shell scripts
|
2008-03-03 02:44:01 +05:30
|
|
|
.SUFFIXES: .sh.in .in
|
2008-02-28 01:59:32 +05:30
|
|
|
.sh.in.sh:
|
2008-03-03 16:03:42 +05:30
|
|
|
sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' $< > $@
|
2008-02-28 01:59:32 +05:30
|
|
|
|
2008-03-03 02:44:01 +05:30
|
|
|
.in:
|
2008-03-03 16:03:42 +05:30
|
|
|
sed -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' $< > $@
|
2008-03-03 02:44:01 +05:30
|
|
|
|
2008-01-11 16:55:40 +05:30
|
|
|
all: ${OBJS}
|
2008-01-10 22:05:59 +05:30
|
|
|
|
|
|
|
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
|
2008-02-28 16:38:49 +05:30
|
|
|
if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
|
|
|
if test -n "${BIN}"; then ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
|
|
|
if test -n "${INC}"; then ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
2008-01-10 22:05:59 +05:30
|
|
|
for x in ${CONF}; do \
|
2008-02-28 16:38:49 +05:30
|
|
|
if ! test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
|
|
|
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${DIR} || exit $$?; \
|
2008-01-10 22:05:59 +05:30
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
for x in ${CONF_APPEND}; do \
|
2008-02-28 16:38:49 +05:30
|
|
|
if test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
|
|
|
cat $$x >> ${DESTDIR}/${PREFIX}${DIR}/$$x || exit $$?; \
|
2008-01-10 22:05:59 +05:30
|
|
|
else \
|
2008-02-28 16:38:49 +05:30
|
|
|
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${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-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:
|
2008-01-13 19:25:23 +05:30
|
|
|
if test -n "${CLEANFILES}"; then rm -f ${CLEANFILES}; fi
|