From dfb213bd4755ac176d01ade70f208ee73bf1611f Mon Sep 17 00:00:00 2001 From: psmith Date: Fri, 11 May 2007 20:57:21 +0000 Subject: [PATCH] Fix some documentation gitches. Fix an uninitialized variable. Add builtin rules for Objective C. Add a new debug line that shows where the commands that are about to be run were defined. --- ChangeLog | 16 +++++++++++++++ default.c | 23 ++++++++++++++++----- doc/make.texi | 64 ++++++++++++++++++++++++++--------------------------------- function.c | 2 +- job.c | 17 ++++++++++++---- remake.c | 2 +- 6 files changed, 77 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b68779..8575690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2007-05-11 Paul Smith + + * job.c (new_job): Add debug info to specify where make found the + command script it is running to build a target. + Fixes Savannah bug #18617. + + * default.c (default_suffixes,default_suffix_rules,default_variables): + Add support for Objective C. Fixes Savannah bug #16389. + Based on a patch provided by Peter O'Gorman . + + * function.c (func_lastword): Initialize p. + + * doc/make.texi (Eval Function, Implicit Variables, Special Targets): + Doc fixes noticed by Bob . Patch from + Dave Korn + 2007-05-08 Paul Smith Fix Savannah bug #19656: diff --git a/default.c b/default.c index 2d5480d..fbe6c1e 100644 --- a/default.c +++ b/default.c @@ -41,11 +41,11 @@ static char default_suffixes[] .s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ .w .ch .cweb .web .com .sh .elc .el"; #elif defined(__EMX__) - = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \ + = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \ .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ .w .ch .web .sh .elc .el .obj .exe .dll .lib"; #else - = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \ + = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \ .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ .w .ch .web .sh .elc .el"; #endif @@ -192,6 +192,8 @@ static char *default_suffix_rules[] = "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@", ".f", "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@", + ".m", + "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@", ".p", "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@", ".F", @@ -221,6 +223,8 @@ static char *default_suffix_rules[] = "$(COMPILE.cpp) $(OUTPUT_OPTION) $<", ".f.o", "$(COMPILE.f) $(OUTPUT_OPTION) $<", + ".m.o", + "$(COMPILE.m) $(OUTPUT_OPTION) $<", ".p.o", "$(COMPILE.p) $(OUTPUT_OPTION) $<", ".F.o", @@ -249,15 +253,18 @@ static char *default_suffix_rules[] = #endif ".l.c", "@$(RM) $@ \n $(LEX.l) $< > $@", + ".ym.m", + "$(YACC.m) $< \n mv -f y.tab.c $@", + ".lm.m", + "@$(RM) $@ \n $(LEX.m) $< > $@", ".F.f", "$(PREPROCESS.F) $(OUTPUT_OPTION) $<", ".r.f", "$(PREPROCESS.r) $(OUTPUT_OPTION) $<", - /* This might actually make lex.yy.c if there's no %R% - directive in $*.l, but in that case why were you - trying to make $*.r anyway? */ + /* This might actually make lex.yy.c if there's no %R% directive in $*.l, + but in that case why were you trying to make $*.r anyway? */ ".l.r", "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@", @@ -398,9 +405,11 @@ static const char *default_variables[] = # else "CXX", "gcc", # endif /* __MSDOS__ */ + "OBJC", "gcc", #else "CC", "cc", "CXX", "g++", + "OBJC", "cc", #endif /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist, @@ -468,6 +477,8 @@ static const char *default_variables[] = "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", + "COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", + "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "COMPILE.C", "$(COMPILE.cc)", "COMPILE.cpp", "$(COMPILE.cc)", @@ -476,6 +487,8 @@ static const char *default_variables[] = "LINK.cpp", "$(LINK.cc)", "YACC.y", "$(YACC) $(YFLAGS)", "LEX.l", "$(LEX) $(LFLAGS) -t", + "YACC.m", "$(YACC) $(YFLAGS)", + "LEX.m", "$(LEX) $(LFLAGS) -t", "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c", "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", diff --git a/doc/make.texi b/doc/make.texi index a4f84f4..72afb83 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -4,7 +4,7 @@ @include version.texi @set EDITION 0.70 -@set RCSID $Id: make.texi,v 1.46 2006/10/01 05:38:38 psmith Exp $ +@set RCSID $Id: make.texi,v 1.47 2007/05/11 20:57:21 psmith Exp $ @settitle GNU @code{make} @setchapternewpage odd @@ -2940,10 +2940,6 @@ makefile, then all prerequisite lists defined @emph{after} it appears will be expanded a second time after all makefiles have been read in. @xref{Secondary Expansion, ,Secondary Expansion}. -The prerequisites of the special target @code{.SUFFIXES} are the list -of suffixes to be used in checking for suffix rules. -@xref{Suffix Rules, , Old-Fashioned Suffix Rules}. - @findex .DELETE_ON_ERROR @item .DELETE_ON_ERROR @cindex removing targets on failure @@ -8390,17 +8386,18 @@ implemented in @code{make} as suffix rules, so which ones will be defined depends on the @dfn{suffix list} (the list of prerequisites of the special target @code{.SUFFIXES}). The default suffix list is: @code{.out}, @code{.a}, @code{.ln}, @code{.o}, @code{.c}, @code{.cc}, -@code{.C}, @code{.cpp}, @code{.p}, @code{.f}, @code{.F}, @code{.r}, @code{.y}, -@code{.l}, @code{.s}, @code{.S}, @code{.mod}, @code{.sym}, @code{.def}, -@code{.h}, @code{.info}, @code{.dvi}, @code{.tex}, @code{.texinfo}, -@code{.texi}, @code{.txinfo}, @code{.w}, @code{.ch} @code{.web}, -@code{.sh}, @code{.elc}, @code{.el}. All of the implicit rules -described below whose prerequisites have one of these suffixes are -actually suffix rules. If you modify the suffix list, the only -predefined suffix rules in effect will be those named by one or two of -the suffixes that are on the list you specify; rules whose suffixes fail -to be on the list are disabled. @xref{Suffix Rules, ,Old-Fashioned -Suffix Rules}, for full details on suffix rules. +@code{.C}, @code{.cpp}, @code{.p}, @code{.f}, @code{.F}, @code{.m}, +@code{.r}, @code{.y}, @code{.l}, @code{.ym}, @code{.lm}, @code{.s}, +@code{.S}, @code{.mod}, @code{.sym}, @code{.def}, @code{.h}, +@code{.info}, @code{.dvi}, @code{.tex}, @code{.texinfo}, @code{.texi}, +@code{.txinfo}, @code{.w}, @code{.ch} @code{.web}, @code{.sh}, +@code{.elc}, @code{.el}. All of the implicit rules described below +whose prerequisites have one of these suffixes are actually suffix +rules. If you modify the suffix list, the only predefined suffix +rules in effect will be those named by one or two of the suffixes that +are on the list you specify; rules whose suffixes fail to be on the +list are disabled. @xref{Suffix Rules, ,Old-Fashioned Suffix Rules}, +for full details on suffix rules. @table @asis @item Compiling C programs @@ -8731,21 +8728,11 @@ Program for compiling assembly files; default @samp{as}. Program for compiling C programs; default @samp{cc}. @pindex cc -@item CO -@vindex CO -Program for checking out files from RCS; default @samp{co}. -@pindex cc - @item CXX @vindex CXX Program for compiling C++ programs; default @samp{g++}. @pindex g++ -@item CO -@vindex CO -Program for extracting a file from RCS; default @samp{co}. -@pindex co - @item CPP @vindex CPP Program for running the C preprocessor, with results to standard output; @@ -8757,6 +8744,21 @@ Program for compiling or preprocessing Fortran and Ratfor programs; default @samp{f77}. @pindex f77 +@item M2C +@vindex M2C +Program to use to compile Modula-2 source code; default @samp{m2c}. +@pindex m2c + +@item PC +@vindex PC +Program for compiling Pascal programs; default @samp{pc}. +@pindex pc + +@item CO +@vindex CO +Program for extracting a file from RCS; default @samp{co}. +@pindex co + @item GET @vindex GET Program for extracting a file from SCCS; default @samp{get}. @@ -8777,16 +8779,6 @@ Program to use to turn Yacc grammars into source code; default @samp{yacc}. Program to use to run lint on source code; default @samp{lint}. @pindex lint -@item M2C -@vindex M2C -Program to use to compile Modula-2 source code; default @samp{m2c}. -@pindex m2c - -@item PC -@vindex PC -Program for compiling Pascal programs; default @samp{pc}. -@pindex pc - @item MAKEINFO @vindex MAKEINFO Program to convert a Texinfo source file into an Info file; default diff --git a/function.c b/function.c index caf87b9..e190647 100644 --- a/function.c +++ b/function.c @@ -693,7 +693,7 @@ func_lastword (char *o, char **argv, const char *funcname UNUSED) { unsigned int i; const char *words = argv[0]; /* Use a temp variable for find_next_token */ - const char *p; + const char *p = NULL; const char *t; while ((t = find_next_token (&words, &i))) diff --git a/job.c b/job.c index 52af31a..a05c356 100644 --- a/job.c +++ b/job.c @@ -1482,10 +1482,10 @@ start_waiting_job (struct child *c) void new_job (struct file *file) { - register struct commands *cmds = file->cmds; - register struct child *c; + struct commands *cmds = file->cmds; + struct child *c; char **lines; - register unsigned int i; + unsigned int i; /* Let any previously decided-upon jobs that are waiting for the load to go down start before this new one. */ @@ -1723,7 +1723,16 @@ new_job (struct file *file) /* The job is now primed. Start it running. (This will notice if there are in fact no commands.) */ - (void) start_waiting_job (c); + if (cmds->fileinfo.filenm) + DB (DB_BASIC, (_("Invoking commands from %s:%lu to update target `%s'.\n"), + cmds->fileinfo.filenm, cmds->fileinfo.lineno, + c->file->name)); + else + DB (DB_BASIC, (_("Invoking builtin commands to update target `%s'.\n"), + c->file->name)); + + + start_waiting_job (c); if (job_slots == 1 || not_parallel) /* Since there is only one job slot, make things run linearly. diff --git a/remake.c b/remake.c index ee8acf3..f494cf1 100644 --- a/remake.c +++ b/remake.c @@ -803,7 +803,7 @@ notice_finished_file (struct file *file) if (touch_flag /* The update status will be: - -1 if this target was not remade; + -1 if this target was not remade; 0 if 0 or more commands (+ or ${MAKE}) were run and won; 1 if some commands were run and lost. We touch the target if it has commands which either were not run -- 2.11.4.GIT