1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Fix out-of-tree build when srcdir has no Makefile.config

By recursively 'bootstrapping' the builddir specific Makefiles we no longer
depend on running make in the srcdir.

The problem was pointed out by zas.
This commit is contained in:
Jonas Fonseca 2005-10-26 00:34:13 +02:00 committed by Jonas Fonseca
parent 1c8f2a3d19
commit 44cf54f0fc
2 changed files with 12 additions and 13 deletions

View File

@ -76,7 +76,9 @@ ifneq ($(findstring cleanall,$(MAKECMDGOALS)),)
INCLUDE_ALL=1
endif
ifneq ($(findstring list,$(MAKECMDGOALS)),)
ifneq ($(findstring init,$(MAKECMDGOALS)),)
# FIXME: Detect when $(subdir)/Makefile is $(srcdir)/$(subdir)/Makefile
# and error out so the user won't overwrite the 'master' Makefiles.
INCLUDE_ALL=1
endif
@ -103,8 +105,10 @@ CLEAN += $(PROG)
all-default: $(LIB_O) $(PROGS) $(MAN1) $(MAN5)
list-default:
@echo '$(RELPATH)Makefile'
init-default:
@$(foreach subdir,$(sort $(SUBDIRS)), \
$(MKINSTALLDIRS) $(subdir) >/dev/null; \
echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;)
clean-default:
-test -z "$(CLEAN)" || $(RM) $(CLEAN)
@ -130,9 +134,9 @@ endif
# Recursion:
.PHONY: all-recursive install-recursive clean-recursive cleanall-recursive list-recursive
.PHONY: all-recursive install-recursive clean-recursive cleanall-recursive init-recursive
all-recursive install-recursive clean-recursive cleanall-recursive list-recursive:
all-recursive install-recursive clean-recursive cleanall-recursive init-recursive:
ifdef SUBDIRS
@$(foreach subdir,$(sort $(SUBDIRS)), \
$(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || exit 1;)
@ -143,7 +147,7 @@ install: install-recursive install-default install-local
clean: clean-recursive clean-default clean-local
cleanall: cleanall-recursive cleanall-default
list: list-recursive list-default
init: init-default init-recursive
all-local:
install-local:

View File

@ -1268,13 +1268,8 @@ AC_OUTPUT([ \
abs_srcdir="$(cd "$srcdir" && pwd)"
# builddir is always absolute!
if test "$abs_srcdir" != "$builddir"; then
MAKEFILES=$("$MAKE" -C "$abs_srcdir" list | grep Makefile)
for i in $MAKEFILES; do
echo "creating $i"
$MKINSTALLDIRS "$builddir/$(dirname $i)" >/dev/null
echo "include $abs_srcdir/$i" > "$builddir/$i"
done
echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
"$MAKE" "SRC=$abs_srcdir" init
fi