diff options
author | Roy Marples <roy@marples.name> | 2008-02-28 11:08:49 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-02-28 11:08:49 +0000 |
commit | f092045650faad778d25d000d80b3128664d2e2a (patch) | |
tree | 89188e92a4d01423ee59e33e5eaf5355fa14d103 /mk | |
parent | aabf3976db5ffb41f8f8bbd47f5015b4158e095a (diff) |
Support the use of PREFIX and PKG_PREFIX.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/os.mk | 8 | ||||
-rw-r--r-- | mk/scripts.mk | 18 | ||||
-rw-r--r-- | mk/sys.mk | 15 |
3 files changed, 26 insertions, 15 deletions
@@ -29,3 +29,11 @@ LIBDL?= ${_LIBDL}$(shell ${_LIBDL_SH}) _LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac _LIBKVM!= ${_LIBKVM_SH} LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH}) + +_PREFIX_SH= if test -n "${PREFIX}" && test "${PREFIX}" != "/"; then echo "-DPREFIX=\\\"${PREFIX}\\\""; else echo ""; fi +_PREFIX!= ${_PREFIX_SH} +CFLAGS+= ${_PREFIX}$(shell ${_PREFIX_SH}) + +_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/"; then echo "-DPKG_PREFIX=\\\"${PKG_PREFIX}\\\""; else echo ""; fi +_PKG_PREFIX!= ${_PKG_PREFIX_SH} +CFLAGS+= ${_PKG_PREFIX}$(shell ${_PKG_PREFIX_SH}) diff --git a/mk/scripts.mk b/mk/scripts.mk index 114d5e2b..561545de 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -16,24 +16,24 @@ include ${MK}/os.mk # Tweak our shell scripts .SUFFIXES: .sh.in .sh.in.sh: - sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' $< > $@ + sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' $< > $@ all: ${OBJS} realinstall: ${BIN} ${CONF} ${CONF_APPEND} - if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}${DIR} || exit $$?; fi - if test -n "${BIN}"; then ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}${DIR} || exit $$?; fi - if test -n "${INC}"; then ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}${DIR} || exit $$?; fi + 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 for x in ${CONF}; do \ - if ! test -e ${DESTDIR}${DIR}/$$x; then \ - ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}${DIR} || exit $$?; \ + if ! test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \ + ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${DIR} || exit $$?; \ fi; \ done for x in ${CONF_APPEND}; do \ - if test -e ${DESTDIR}${DIR}/$$x; then \ - cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \ + if test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \ + cat $$x >> ${DESTDIR}/${PREFIX}${DIR}/$$x || exit $$?; \ else \ - ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}${DIR} || exit $$?; \ + ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${DIR} || exit $$?; \ fi; \ done @@ -7,23 +7,26 @@ INSTALL?= install RANLIB?= ranlib SH= /bin/sh +PREFIX= +PKG_PREFIX= /usr/local + PICFLAG?= -fPIC -BINDIR?= /sbin +BINDIR?= ${PREFIX}/sbin BINMODE?= 0755 -INCDIR?= /usr/include +INCDIR?= ${PREFIX}/usr/include INCMODE?= 0444 LIBNAME?= lib -LIBDIR?= /usr/${LIBNAME} +LIBDIR?= ${PREFIX}/usr/${LIBNAME} LIBMODE?= 0444 -SHLIBDIR?= /${LIBNAME} +SHLIBDIR?= ${PREFIX}/${LIBNAME} -MANDIR?= /usr/share/man/man +MANDIR?= ${PREFIX}/usr/share/man/man MANMODE?= 0444 -DOCDIR?= /usr/share/doc +DOCDIR?= ${PREFIX}/usr/share/doc DOCMODE?= 0644 CONFMODE?= 0644 |