2007-04-05 16:48:42 +05:30
|
|
|
# Common makefile settings
|
2007-11-19 19:31:28 +05:30
|
|
|
# We shouldn't use PREFIX as we need to install into /
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2008-01-06 02:35:19 +05:30
|
|
|
_LIBNAME_SH = l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
|
|
|
|
_LIBNAME != $(_LIB_SH)
|
|
|
|
LIBNAME = $(_LIBNAME)$(shell $(_LIBNAME_SH))
|
|
|
|
RC_LIB = /$(LIBNAME)/rc
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-19 19:18:43 +05:30
|
|
|
INSTALL ?= install
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-19 19:18:43 +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))
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-20 23:07:15 +05:30
|
|
|
# We store the contents of the directory for ease of use in Makefiles
|
|
|
|
_CONTENTS_SH = ls -1 | grep -v Makefile | xargs
|
|
|
|
_CONTENTS != $(_CONTENTS_SH)
|
|
|
|
CONTENTS = $(_CONTENTS)$(shell $(_CONTENTS_SH))
|
|
|
|
|
2007-11-19 19:18:43 +05:30
|
|
|
# Recursive rules
|
|
|
|
# Adapted from FreeBSDs bsd.subdir.mk
|
2008-01-02 22:58:19 +05:30
|
|
|
_+_ ?= +
|
2007-11-19 19:18:43 +05:30
|
|
|
ECHODIR ?= true
|
2008-01-02 22:58:19 +05:30
|
|
|
_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
|
2008-01-06 02:13:32 +05:30
|
|
|
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
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-19 19:18:43 +05:30
|
|
|
all:
|
|
|
|
$(_SUBDIR)
|
|
|
|
clean::
|
|
|
|
$(_SUBDIR)
|
2008-01-02 22:58:19 +05:30
|
|
|
depend::
|
|
|
|
$(_SUBDIR)
|
2007-11-19 19:18:43 +05:30
|
|
|
install::
|
|
|
|
$(_SUBDIR)
|
|
|
|
|
2007-11-19 22:12:28 +05:30
|
|
|
install:: $(BIN) $(CONF) $(CONF_APPEND)
|
2007-11-28 21:15:03 +05:30
|
|
|
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
|
2007-11-19 22:12:28 +05:30
|
|
|
for x in $(CONF); do \
|
2007-11-19 19:18:43 +05:30
|
|
|
if ! test -e $(DESTDIR)$(DIR)/$$x; then \
|
|
|
|
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
|
|
|
fi; \
|
|
|
|
done
|
2007-11-19 22:12:28 +05:30
|
|
|
for x in $(CONF_APPEND); do \
|
2007-11-19 19:18:43 +05:30
|
|
|
if test -e $(DESTDIR)$(DIR)/$$x; then \
|
|
|
|
cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$?; \
|
|
|
|
else \
|
|
|
|
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
|
|
|
fi; \
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
2007-12-15 01:39:53 +05:30
|
|
|
|
|
|
|
# vim: set ts=4 :
|