It seems the attached Makefile will fail for a clean build.  I read
through the docs
and it seems that there is nothing that says this should not work.  The
problem
is a invalid assumption that if a implicit prerequisite's directory does
not
exist at the beginning then it must not be a candidate.  It fails to not
notice
that during the bulding of other rules the directory will in fact be
created.

This is an example Makefile that shows the problem.

firstly:
make setup # make some empty test files - assume these are source files
make  # fails !
make work.i686/file1.out # works - created work.i686 directory
make # works properly now.

If you patch version make-3.79.tar.gz's implicit.c (removing the
assumption
noted above) the Makefile builds without a hitch.

Question 1 : Is there a way with the current make to get around this ?
Question 2 : If the answer is no to Q1 can we introduce this fix in the
next make release ?

Doing this would be very useful for me so that I can make a generic
Makefile
that can enable a source tree to build with multiple kinds of builds
simultaneously.

I have developed a generic base Makefile that can do this but this
bug is really cramping.

Regards
G

------------------------- Patch to implicit.c -----------------
--- implicit.BAK        Fri Jan 21 21:43:03 2000
+++ implicit.c  Sat Jun 10 15:21:11 2000
@@ -398,8 +398,10 @@
                 directory (the one gotten by prepending FILENAME's
directory),
                 so it might actually exist.  */

-             if ((!dep->changed || check_lastslash)
-                 && (lookup_file (p) != 0 || file_exists_p (p)))
+/*           if ((!dep->changed || check_lastslash)
+                 && (lookup_file (p) != 0 || file_exists_p (p))) */
+
+             if ((lookup_file (p) != 0 || file_exists_p (p)))
                {
                  found_files[deps_found++] = xstrdup (p);
                  continue;


WORKDIR=work.i686

ifeq ($(wildcard $(WORKDIR)),)
DEPEND_DIR=$(WORKDIR)
else
DEPEND_DIR=
endif

# make some sample source files
ifeq ($(wildcard file*.in),)
XX:=$(shell touch file1.in file2.in )
endif

IN_FILES=$(wildcard *.in)

OUTFILES=$(IN_FILES:%.in=$(WORKDIR)/%.out)

all : /tmp/file.inst

$(WORKDIR)/file.inst : $(OUTFILES)
        cat $^ > $@

$(WORKDIR)/%.out : %.in $(DEPEND_DIR)
        cp $< $@

/tmp/% : $(WORKDIR)/%
        cp $< $@

workdir : $(DEPEND_DIR)

$(WORKDIR) :
        mkdir -p $(WORKDIR)

clean :
        rm -rf $(WORKDIR) /tmp/file.inst

Reply via email to