install correctly on NetBSD.

This commit is contained in:
Roy Marples 2008-01-09 23:47:15 +00:00
parent ddf25cbcb7
commit 5b30c5154d
3 changed files with 32 additions and 32 deletions

View File

@ -2,20 +2,20 @@
# We shouldn't use PREFIX as we need to install into / # We shouldn't use PREFIX as we need to install into /
_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac _LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
_LIBNAME != $(_LIB_SH) _LIBNAME!= ${_LIBNAME_SH}
LIBNAME = $(_LIBNAME)$(shell $(_LIBNAME_SH)) LIBNAME= ${_LIBNAME}$(shell ${_LIBNAME_SH})
RC_LIB = /$(LIBNAME)/rc RC_LIB= /${LIBNAME}/rc
INSTALL?= install INSTALL?= install
_OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac _OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac
_OS != $(_OS_SH) _OS!= ${_OS_SH}
OS ?= $(_OS)$(shell $(_OS_SH)) OS?= ${_OS}$(shell ${_OS_SH})
# We store the contents of the directory for ease of use in Makefiles # We store the contents of the directory for ease of use in Makefiles
_CONTENTS_SH= ls -1 | grep -v Makefile | xargs _CONTENTS_SH= ls -1 | grep -v Makefile | xargs
_CONTENTS != $(_CONTENTS_SH) _CONTENTS!= ${_CONTENTS_SH}
CONTENTS = $(_CONTENTS)$(shell $(_CONTENTS_SH)) CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
# Recursive rules # Recursive rules
# Adapted from FreeBSDs bsd.subdir.mk # Adapted from FreeBSDs bsd.subdir.mk
@ -37,28 +37,28 @@ _SUBDIR = @${_+_}for x in ${SUBDIR}; do \
done done
all: all:
$(_SUBDIR) ${_SUBDIR}
clean:: clean::
$(_SUBDIR) ${_SUBDIR}
depend:: depend::
$(_SUBDIR) ${_SUBDIR}
install:: install::
$(_SUBDIR) ${_SUBDIR}
install:: $(BIN) $(CONF) $(CONF_APPEND) install:: ${BIN} ${CONF} ${CONF_APPEND}
if test -n "$(DIR)"; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi 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 "${BIN}"; then ${INSTALL} ${BIN} ${DESTDIR}$(DIR} || exit $$?; fi
if test -n "$(INC)"; then $(INSTALL) -m 0644 $(INC) $(DESTDIR)$(DIR) || exit $$?; fi if test -n "${INC}"; then ${INSTALL} -m 0644 ${INC} ${DESTDIR}${DIR} || exit $$?; fi
for x in $(CONF); do \ for x in ${CONF}; do \
if ! test -e $(DESTDIR)$(DIR)/$$x; then \ if ! test -e ${DESTDIR}${DIR}/$$x; then \
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \ ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
fi; \ fi; \
done done
for x in $(CONF_APPEND); do \ for x in ${CONF_APPEND}; do \
if test -e $(DESTDIR)$(DIR)/$$x; then \ if test -e ${DESTDIR}${DIR}/$$x; then \
cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$?; \ cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \
else \ else \
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \ ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
fi; \ fi; \
done done

View File

@ -55,7 +55,7 @@ install: all
${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR} ${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR}
${INSTALL} -d ${DESTDIR}${SHLIBDIR} ${INSTALL} -d ${DESTDIR}${SHLIBDIR}
${INSTALL} -m ${LIBMODE} ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} ${INSTALL} -m ${LIBMODE} ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
ln -fs ${SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK} ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIBLINK}
${INSTALL} -d ${DESTDIR}${INCDIR} ${INSTALL} -d ${DESTDIR}${INCDIR}
for x in ${INCS}; do ${INSTALL} -m ${INCMODE} $$x ${DESTDIR}${INCDIR}; done for x in ${INCS}; do ${INSTALL} -m ${INCMODE} $$x ${DESTDIR}${INCDIR}; done

View File

@ -1,7 +1,7 @@
# Recursive rules # Recursive rules
# Adapted from FreeBSDs bsd.subdir.mk # Adapted from FreeBSDs bsd.subdir.mk
_+_ ?= + _+_ ?= +
ECHODIR ?= true ECHODIR ?= echo
_SUBDIR = @${_+_}for x in ${SUBDIR}; do \ _SUBDIR = @${_+_}for x in ${SUBDIR}; do \
if test -d $$x; then \ if test -d $$x; then \
${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \ ${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \
@ -18,10 +18,10 @@ _SUBDIR = @${_+_}for x in ${SUBDIR}; do \
done done
all: all:
$(_SUBDIR) ${_SUBDIR}
clean: clean:
$(_SUBDIR) ${_SUBDIR}
install: install:
$(_SUBDIR) ${_SUBDIR}
depend: depend:
$(_SUBDIR) ${_SUBDIR}