openrc/mk/scripts.mk

65 lines
2.4 KiB
Makefile
Raw Normal View History

# Install rules for our scripts
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
2008-01-11 23:59:47 +05:30
include ${MK}/sys.mk
include ${MK}/os.mk
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
_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
_LCL_SED:= $(shell ${_LCL_SED_SH})
2008-03-20 23:22:07 +05:30
SED_REPLACE= -e 's:@SHELL@:${SH}:' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED}
2008-03-05 17:57:11 +05:30
# Tweak our shell scripts
%.sh: %.sh.in
2008-03-26 19:57:46 +05:30
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
%: %.in
2008-03-26 19:57:46 +05:30
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
all: ${OBJS} ${TARGETS}
realinstall: ${BIN} ${CONF} ${INC}
@if test -n "${DIR}"; then \
2008-03-25 22:29:26 +05:30
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
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 $$?; \
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 $$?; \
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 $$?; \
fi; \
done
2008-01-13 19:44:47 +05:30
install: all realinstall ${INSTALLAFTER}
2008-03-24 11:40:40 +05:30
check test::
# 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
CLEANFILES+= ${OBJS}
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