public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* dmake, GNU make, gcc, and auto-dependencies
@ 1999-12-06  4:43 Stuart Summerville
  1999-12-06  7:19 ` Paul D. Smith
  1999-12-31 22:24 ` Stuart Summerville
  0 siblings, 2 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-06  4:43 UTC (permalink / raw)
  To: help-gcc

Hi there,

I'm trying to get auto dependencies working amongst gnu make (V3.76 or
so), dmake (4) and gcc (ver?). The gnu make manual (at www.gnu.org)
suggests creating a pattern rule that will create a .d makefile
(containing dependencies for that file) for each source file, & then
"including" that .d file into the main makefile before the source is
built.

Question: How does one stop 'make' from including the .d files if
they're not built yet? For a small 1 file test project (could it be
smaller?), I include the .d file, but its either an old one, or isn't
even built yet.

Another question: The gcc manpage states that the -MD switch will
generate the corresponding .d file, *and* compile the source file. In
doing so, does the contents of the .d file not affect the compilation
of the source file? If not, does that not put the auto-generation of
the dependency rule one step behind in the compilation process? ie.
Shouldn't the generation of the .d file be done in one step, for
subsequent use by make in determining whether to compile the source?

Thanks for any help,

sTu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06  4:43 dmake, GNU make, gcc, and auto-dependencies Stuart Summerville
@ 1999-12-06  7:19 ` Paul D. Smith
  1999-12-06 16:28   ` Stuart Summerville
  1999-12-31 22:24   ` Paul D. Smith
  1999-12-31 22:24 ` Stuart Summerville
  1 sibling, 2 replies; 10+ messages in thread
From: Paul D. Smith @ 1999-12-06  7:19 UTC (permalink / raw)
  To: help-gcc

%% stus@deimus.com.au (Stuart Summerville) writes:

  ss> I'm trying to get auto dependencies working amongst gnu make (V3.76 or
  ss> so), dmake (4) and gcc (ver?). The gnu make manual (at www.gnu.org)
  ss> suggests creating a pattern rule that will create a .d makefile
  ss> (containing dependencies for that file) for each source file, & then
  ss> "including" that .d file into the main makefile before the source is
  ss> built.

I don't know anything about dmake.  But for gmake and GCC, while the
version in the GNU make manual works, it's considered (by me, anyway :)
to be "old technology".  There is a much better way to handle
dependencies, invented by Tom Tromey for use in automake.  I did a
writeup of it; you can find it on my GNU make webpage below.

  ss> Question: How does one stop 'make' from including the .d files if
  ss> they're not built yet? For a small 1 file test project (could it be
  ss> smaller?), I include the .d file, but its either an old one, or isn't
  ss> even built yet.

If you have GNU make 3.76 or better, you can use MAKECMDGOALS for this
(see the manual).  If you use the automake method you won't need this,
though.

  ss> Another question: The gcc manpage states that the -MD switch will
  ss> generate the corresponding .d file, *and* compile the source file. In
  ss> doing so, does the contents of the .d file not affect the compilation
  ss> of the source file? If not, does that not put the auto-generation of
  ss> the dependency rule one step behind in the compilation process? ie.
  ss> Shouldn't the generation of the .d file be done in one step, for
  ss> subsequent use by make in determining whether to compile the source?

Well, it's not "one step behind" because they're still both done at
essentially the same time (during the same build invocation).  It is,
however, less efficient and has a few annoying "features", all of which
are resolved by Tom's method.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06  7:19 ` Paul D. Smith
@ 1999-12-06 16:28   ` Stuart Summerville
  1999-12-06 16:37     ` Stuart Summerville
  1999-12-31 22:24     ` Stuart Summerville
  1999-12-31 22:24   ` Paul D. Smith
  1 sibling, 2 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-06 16:28 UTC (permalink / raw)
  To: help-gcc

>dependencies, invented by Tom Tromey for use in automake.  I did a
>writeup of it; you can find it on my GNU make webpage below.

Hi Paul. I read your advanced auto-dependency generation webpage - very
interesting/useful read.

Unfortunately, I have a more pressing problem with my make environment.
Sometimes the problem doesn't occur, but usually it does.

In debugging this problem, I'm down to the following makefile:

#-------------------------------
fred:
	@echo "doin' it!!"
#-------------------------------

If I make the following call from my c-shell:

> make -f ./makefile fred

I would expect it to execute the echo command, and then exit. Unfortunately, I
get the following error:

#-------------------------------
', needed by `fred'.  Stop.arget `
#-------------------------------

This is happening on two solaris 2.5.1 boxes, running gnu make V3.76.1. The same
makefile (actually a more convoluted version with the same problem) works fine
on a Win32 box running cygnus make port.

Any ideas? This is driving me crazy.

Regards, sTu.
________________________________________________________________________
Stuart Summerville                     NEC Australia Pty. Ltd.
ph: (+61 3) 9264-3090                  Integrated Comm Products (R&D)
fax:(+61 3) 9264-3841                  649-655 Springvale Road Mulgrave
stuarts@<nospam>icpdd.neca.nec.com.au  VIC 3170, AUSTRALIA

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06 16:28   ` Stuart Summerville
@ 1999-12-06 16:37     ` Stuart Summerville
  1999-12-06 20:31       ` Paul D. Smith
  1999-12-31 22:24       ` Stuart Summerville
  1999-12-31 22:24     ` Stuart Summerville
  1 sibling, 2 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-06 16:37 UTC (permalink / raw)
  To: help-gcc

>#-------------------------------
>', needed by `fred'.  Stop.arget `
>#-------------------------------


Goddam!! just happened to load the makefile into a unix editor (as opposed to
the win32 one I normally use) & saw the CR on the end of the first line.
Removing it obviously fixed the problem.

I've been through this process before, but the errors are so non-intuitive, that
one goes round & round looking in all the wrong places.

ggrr...

sTu.
________________________________________________________________________
Stuart Summerville                     NEC Australia Pty. Ltd.
ph: (+61 3) 9264-3090                  Integrated Comm Products (R&D)
fax:(+61 3) 9264-3841                  649-655 Springvale Road Mulgrave
stuarts@<nospam>icpdd.neca.nec.com.au  VIC 3170, AUSTRALIA

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06 16:37     ` Stuart Summerville
@ 1999-12-06 20:31       ` Paul D. Smith
  1999-12-31 22:24         ` Paul D. Smith
  1999-12-31 22:24       ` Stuart Summerville
  1 sibling, 1 reply; 10+ messages in thread
From: Paul D. Smith @ 1999-12-06 20:31 UTC (permalink / raw)
  To: help-gcc

%% stuarts@icpdd.neca.nec.com.au (Stuart Summerville) writes:

  >> ', needed by `fred'.  Stop.arget `

  ss> Goddam!! just happened to load the makefile into a unix editor (as
  ss> opposed to the win32 one I normally use) & saw the CR on the end
  ss> of the first line.  Removing it obviously fixed the problem.

Darn, and I knew that one, too :)

Whenever you see screwed up text like that you can always bet there's an
extraneous CR character in there resetting to the beginning of the line.

Anyway, if you upgrade to the latest GNU make (3.78.1) you won't have
this problem; it silently ignores CR's as part of CRNL pairs.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06  7:19 ` Paul D. Smith
  1999-12-06 16:28   ` Stuart Summerville
@ 1999-12-31 22:24   ` Paul D. Smith
  1 sibling, 0 replies; 10+ messages in thread
From: Paul D. Smith @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

%% stus@deimus.com.au (Stuart Summerville) writes:

  ss> I'm trying to get auto dependencies working amongst gnu make (V3.76 or
  ss> so), dmake (4) and gcc (ver?). The gnu make manual (at www.gnu.org)
  ss> suggests creating a pattern rule that will create a .d makefile
  ss> (containing dependencies for that file) for each source file, & then
  ss> "including" that .d file into the main makefile before the source is
  ss> built.

I don't know anything about dmake.  But for gmake and GCC, while the
version in the GNU make manual works, it's considered (by me, anyway :)
to be "old technology".  There is a much better way to handle
dependencies, invented by Tom Tromey for use in automake.  I did a
writeup of it; you can find it on my GNU make webpage below.

  ss> Question: How does one stop 'make' from including the .d files if
  ss> they're not built yet? For a small 1 file test project (could it be
  ss> smaller?), I include the .d file, but its either an old one, or isn't
  ss> even built yet.

If you have GNU make 3.76 or better, you can use MAKECMDGOALS for this
(see the manual).  If you use the automake method you won't need this,
though.

  ss> Another question: The gcc manpage states that the -MD switch will
  ss> generate the corresponding .d file, *and* compile the source file. In
  ss> doing so, does the contents of the .d file not affect the compilation
  ss> of the source file? If not, does that not put the auto-generation of
  ss> the dependency rule one step behind in the compilation process? ie.
  ss> Shouldn't the generation of the .d file be done in one step, for
  ss> subsequent use by make in determining whether to compile the source?

Well, it's not "one step behind" because they're still both done at
essentially the same time (during the same build invocation).  It is,
however, less efficient and has a few annoying "features", all of which
are resolved by Tom's method.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

^ permalink raw reply	[flat|nested] 10+ messages in thread

* dmake, GNU make, gcc, and auto-dependencies
  1999-12-06  4:43 dmake, GNU make, gcc, and auto-dependencies Stuart Summerville
  1999-12-06  7:19 ` Paul D. Smith
@ 1999-12-31 22:24 ` Stuart Summerville
  1 sibling, 0 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Hi there,

I'm trying to get auto dependencies working amongst gnu make (V3.76 or
so), dmake (4) and gcc (ver?). The gnu make manual (at www.gnu.org)
suggests creating a pattern rule that will create a .d makefile
(containing dependencies for that file) for each source file, & then
"including" that .d file into the main makefile before the source is
built.

Question: How does one stop 'make' from including the .d files if
they're not built yet? For a small 1 file test project (could it be
smaller?), I include the .d file, but its either an old one, or isn't
even built yet.

Another question: The gcc manpage states that the -MD switch will
generate the corresponding .d file, *and* compile the source file. In
doing so, does the contents of the .d file not affect the compilation
of the source file? If not, does that not put the auto-generation of
the dependency rule one step behind in the compilation process? ie.
Shouldn't the generation of the .d file be done in one step, for
subsequent use by make in determining whether to compile the source?

Thanks for any help,

sTu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06 16:37     ` Stuart Summerville
  1999-12-06 20:31       ` Paul D. Smith
@ 1999-12-31 22:24       ` Stuart Summerville
  1 sibling, 0 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

>#-------------------------------
>', needed by `fred'.  Stop.arget `
>#-------------------------------


Goddam!! just happened to load the makefile into a unix editor (as opposed to
the win32 one I normally use) & saw the CR on the end of the first line.
Removing it obviously fixed the problem.

I've been through this process before, but the errors are so non-intuitive, that
one goes round & round looking in all the wrong places.

ggrr...

sTu.
________________________________________________________________________
Stuart Summerville                     NEC Australia Pty. Ltd.
ph: (+61 3) 9264-3090                  Integrated Comm Products (R&D)
fax:(+61 3) 9264-3841                  649-655 Springvale Road Mulgrave
stuarts@<nospam>icpdd.neca.nec.com.au  VIC 3170, AUSTRALIA

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06 20:31       ` Paul D. Smith
@ 1999-12-31 22:24         ` Paul D. Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Paul D. Smith @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

%% stuarts@icpdd.neca.nec.com.au (Stuart Summerville) writes:

  >> ', needed by `fred'.  Stop.arget `

  ss> Goddam!! just happened to load the makefile into a unix editor (as
  ss> opposed to the win32 one I normally use) & saw the CR on the end
  ss> of the first line.  Removing it obviously fixed the problem.

Darn, and I knew that one, too :)

Whenever you see screwed up text like that you can always bet there's an
extraneous CR character in there resetting to the beginning of the line.

Anyway, if you upgrade to the latest GNU make (3.78.1) you won't have
this problem; it silently ignores CR's as part of CRNL pairs.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: dmake, GNU make, gcc, and auto-dependencies
  1999-12-06 16:28   ` Stuart Summerville
  1999-12-06 16:37     ` Stuart Summerville
@ 1999-12-31 22:24     ` Stuart Summerville
  1 sibling, 0 replies; 10+ messages in thread
From: Stuart Summerville @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

>dependencies, invented by Tom Tromey for use in automake.  I did a
>writeup of it; you can find it on my GNU make webpage below.

Hi Paul. I read your advanced auto-dependency generation webpage - very
interesting/useful read.

Unfortunately, I have a more pressing problem with my make environment.
Sometimes the problem doesn't occur, but usually it does.

In debugging this problem, I'm down to the following makefile:

#-------------------------------
fred:
	@echo "doin' it!!"
#-------------------------------

If I make the following call from my c-shell:

> make -f ./makefile fred

I would expect it to execute the echo command, and then exit. Unfortunately, I
get the following error:

#-------------------------------
', needed by `fred'.  Stop.arget `
#-------------------------------

This is happening on two solaris 2.5.1 boxes, running gnu make V3.76.1. The same
makefile (actually a more convoluted version with the same problem) works fine
on a Win32 box running cygnus make port.

Any ideas? This is driving me crazy.

Regards, sTu.
________________________________________________________________________
Stuart Summerville                     NEC Australia Pty. Ltd.
ph: (+61 3) 9264-3090                  Integrated Comm Products (R&D)
fax:(+61 3) 9264-3841                  649-655 Springvale Road Mulgrave
stuarts@<nospam>icpdd.neca.nec.com.au  VIC 3170, AUSTRALIA

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-06  4:43 dmake, GNU make, gcc, and auto-dependencies Stuart Summerville
1999-12-06  7:19 ` Paul D. Smith
1999-12-06 16:28   ` Stuart Summerville
1999-12-06 16:37     ` Stuart Summerville
1999-12-06 20:31       ` Paul D. Smith
1999-12-31 22:24         ` Paul D. Smith
1999-12-31 22:24       ` Stuart Summerville
1999-12-31 22:24     ` Stuart Summerville
1999-12-31 22:24   ` Paul D. Smith
1999-12-31 22:24 ` Stuart Summerville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).