openrc/default.mk

66 lines
1.7 KiB
Makefile
Raw Normal View History

# Common makefile settings
2007-11-19 19:31:28 +05:30
# We shouldn't use PREFIX as we need to install into /
2008-01-10 05:17:15 +05:30
_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
_LIBNAME!= ${_LIBNAME_SH}
LIBNAME= ${_LIBNAME}$(shell ${_LIBNAME_SH})
RC_LIB= /${LIBNAME}/rc
2008-01-10 05:17:15 +05:30
INSTALL?= install
2008-01-10 05:17:15 +05:30
_OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac
_OS!= ${_OS_SH}
OS?= ${_OS}$(shell ${_OS_SH})
# We store the contents of the directory for ease of use in Makefiles
2008-01-10 05:17:15 +05:30
_CONTENTS_SH= ls -1 | grep -v Makefile | xargs
_CONTENTS!= ${_CONTENTS_SH}
CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
# Recursive rules
# Adapted from FreeBSDs bsd.subdir.mk
2008-01-02 22:58:19 +05:30
_+_ ?= +
ECHODIR ?= true
2008-01-02 22:58:19 +05:30
_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
if test -d $$x; then \
${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \
cd $$x; \
${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
cd ..; \
fi; \
if test -d $$x.${OS}; then \
${ECHODIR} "===> ${DIRPRFX}$$x.${OS} ($@)"; \
cd $$x.${OS}; \
${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
cd ..; \
fi; \
done
all:
2008-01-10 05:17:15 +05:30
${_SUBDIR}
clean::
2008-01-10 05:17:15 +05:30
${_SUBDIR}
2008-01-02 22:58:19 +05:30
depend::
2008-01-10 05:17:15 +05:30
${_SUBDIR}
install::
2008-01-10 05:17:15 +05:30
${_SUBDIR}
2008-01-10 05:17:15 +05:30
install:: ${BIN} ${CONF} ${CONF_APPEND}
if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}$(DIR} || exit $$?; fi
if test -n "${BIN}"; then ${INSTALL} ${BIN} ${DESTDIR}$(DIR} || exit $$?; fi
if test -n "${INC}"; then ${INSTALL} -m 0644 ${INC} ${DESTDIR}${DIR} || exit $$?; fi
for x in ${CONF}; do \
if ! test -e ${DESTDIR}${DIR}/$$x; then \
${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
fi; \
done
2008-01-10 05:17:15 +05:30
for x in ${CONF_APPEND}; do \
if test -e ${DESTDIR}${DIR}/$$x; then \
cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \
else \
2008-01-10 05:17:15 +05:30
${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
fi; \
done
# vim: set ts=4 :