norbert@rwthinf.UUCP (Norbert Kiesel) (12/23/89)
Hello, if have found a little bug in make-3.55. The Flags for the LINK.cc rule should be C++FLAGS and not CFLAGS. The first diff yo default.c corrects this. The second diff adds a new keyword to make: `dependation'. The word must be followed by a file name, just like `include'. The difference between `include' and `dependation' is that `dependation' acts exactly like a file pointed to by `MAKEFILES'. This means that it is no fault if the file does not exist and that the file (if it exists) can't set the default target. The primary usage of this directrive is to include optional existent dependency files which can be created by `gcc -MM *.c'. This enables a general makefile containing a rules like: depend: -$(CC) -MM *.c > .depend dependation .depend which is included in every makefile. This can neither be done by `include' (the default target could be modied if this general makefile is included at top of the other makefiles or is included using `MAKEFILES') nor by `MAKEFILES' (you must always modify `MAKEFILES' to point to the right dependency file). There stays one unsolved question: If I have just one .cc file and call make, the right link rule ($(C++) ...) is called. If I have more than one .cc file, first all files are compiled (g++ -c ...) resulting in .o files. But then the wrong link rule ($(CC) ...) is called i.e. make don't know that these .o files are derived from .cc files and that therefore the LINK.cc rule has to be executed. Is there a general solution to this problem? (I have solved it by overwriting the `%.o : %'-rule in the makefiles for C++ programs). Thanks a lot Norbert *** default.c~ Wed Jun 28 23:54:47 1989 --- default.c Wed Dec 13 16:01:27 1989 *************** *** 213,219 **** "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.cc", "$(C++) $(C++FLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", ! "LINK.cc", "$(C++) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "YACC.y", "$(YACC) $(YFLAGS)", "LEX.l", "$(LEX) $(LFLAGS) -t", "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c", --- 213,219 ---- "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.cc", "$(C++) $(C++FLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", ! "LINK.cc", "$(C++) $(C++FLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "YACC.y", "$(YACC) $(YFLAGS)", "LEX.l", "$(LEX) $(LFLAGS) -t", "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c", read.c~ Tue Aug 15 06:03:39 1989 --- read.c Wed Dec 13 16:28:48 1989 *************** *** 392,397 **** --- 394,433 ---- the default goal before those in the included makefile. */ record_waiting_files (); read_makefile (p, 2); + free (p); + conditionals = save; + reading_filename = filename; + reading_lineno_ptr = &lineno; + continue; + } + else if (word1eq ("dependation", 11)) + { + /* We have found an `dependation' line specifying a nested + makefile to be read at this point. This makefile + must not exist and can't set the default goal. Useful + for optional inclusion of `gcc -MM *.c' output. */ + struct conditionals *save = conditionals; + struct conditionals new_conditionals; + p = allocated_variable_expand (next_token (p + 8)); + if (*p == '\0') + { + error ("%s:%u: no filename for `dependation'", filename, lineno); + continue; + } + p2 = end_of_token (p); + if (*p2 != '\0') + { + *p2++ = '\0'; + if (*next_token (p2) != '\0') + error ("%s:%u: extraneous text after `dependation'", + filename, lineno); + } + bzero ((char *) &new_conditionals, sizeof new_conditionals); + conditionals = &new_conditionals; + /* Record the rules that are waiting so they will determine + the default goal before those in the included makefile. */ + record_waiting_files (); + read_makefile (p, 1); free (p); conditionals = save; reading_filename = filename; ******************************************************************************* * Norbert Kiesel NN NN KK KK * * Institut fuer Informatik III NNN NN KK KK * * RWTH Aachen NN N NN KK KK * * NN N NN KKKK * * Tel.: (0241) 80-7266 NN N NN KKKK * * NN N NN KK KK * * EUNET: norbert@rwthi3.uucp NN N NN KK KK * * ...!mcvax!unido!rwthi3!norbert NN NNN KK KK * *******************************************************************************