Article View: gnu.utils.bug
Article #1131Re: (none)
From: Jason Merrill
Date: Sat, 21 Nov 1992 23:27
Date: Sat, 21 Nov 1992 23:27
72 lines
2661 bytes
2661 bytes
>>>> GSCOTT@manvm1.vnet.ibm.COM writes: >OBJS = lfan_main.o lfan_track.o lfan_bf.o tb_bf.o >SOURCES = lfan_main.c lfan_track.c lfan_bf.c tb_bf.c >$(OBJS): $(SOURCES) $(INCLUDES) > $(CC) $(CFLAGS) -c $< >$ /bin/make -n >gcc -g -Wall -c lfan_main.c >gcc -g -Wall -c lfan_track.c >... >$ /usr/local/gnu/make -n >gcc -g -Wall -c lfan_main.c >gcc -g -Wall -c lfan_main.c >... This is not a bug in gcc, but rather a documented feature :). If you look in the GNU Make manual (make.texi), you will see that $< is always set to the FIRST dependency, not to the dependency with the same name as the target. Consider the line >$(OBJS): $(SOURCES) $(INCLUDES) AIX make is interpreting it one of three ways: If there are multiple targets and multiple dependencies, then a given target depends on: 1) The dependency at the same index, plus all dependencies to which no target corresponds. 2) The dependency with the same name (minus extension) as the target, plus all dependencies to which no target corresponds. Try rearranging the SOURCES line in your makefile and see if AIX make still does the right thing; that will tell you which rule it is using. GNU make is interpreting it as follows: If there are multiple targets and multiple dependencies, then a given target depends on ALL of the dependencies. I think that the GNU behavior makes perfect sense. To make your Makefile work under GNU make, you must use an implicit rule. Change the lines >$(OBJS): $(SOURCES) $(INCLUDES) > $(CC) $(CFLAGS) -c $< to %.o: %.c $(INCLUDES) $(CC) $(CFLAGS) -c $< Of course, this won't work under AIX make. This will probably work under both: .c.o: $(INCLUDES) $(CC) $(CFLAGS) -c $< >Below is a script of what happens when the files must be retrieved >with RCS. Note, it retrieves all of the correct files, but still only >tries to compile the first file in OBJS Yes, because it is using an implicit rule to retrieve the files from RCS, but not to compile them. -- Jason Merrill jason@jarthur.claremont.edu This is a self-referential .sig which is not particularly interesting.
Technical Details
Message-ID:
<1992Nov21.232752.22875@muddcs.claremont.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jasonReferences:
<9211180517.AA15811@life.ai.mit.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jason From: jason@jarthur.claremont.edu (Jason Merrill) Subject: Re: (none) Message-ID: <1992Nov21.232752.22875@muddcs.claremont.edu> Sender: gnulists@ai.mit.edu Organization: Harvey Mudd College, Claremont, CA 91711 References: <9211180517.AA15811@life.ai.mit.edu> Distribution: gnu Date: Sat, 21 Nov 1992 23:27:52 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 73