www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/23/22:46:35

Date: Thu, 24 Nov 94 12:39:28 EST
From: p DOT campbell AT trl DOT OZ DOT AU (Peter K. Campbell)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Make depend on DOS?
Cc: p DOT campbell AT trl DOT OZ DOT AU

On Unix, I generally have a simple makefile with a few lines like:
.SUFFIXES:.c
.c.o: ...

and a make depend bit to automatically generate dependencies at the bottom
of the file, so I can then run make later & it uses the implicit .c.o rule
to compile all my object files.

However, I don't need to even do the make depend, because the GNU make
I use on Unix boxes recognizes from the implicit directions that when I
need to make a file name.o that I need a name.c file and goes ahead and
does it.

Now, with both ndmake & djgpp's make (from eg mak371bn), this doesn't
appear to be the case.  When I just try a standard make without the
dependencies I get an error like "Don't know how to make `name.o'".

This would merely be annoying, except for the fact that I can find
nothing to automatically generate dependencies, which means it looks
like I have to go through and add a useless:
	name.o: name.c
line for every one of my source files.

Now, I checked out the make documentation, and it has the following:
--------------------------------------------------------------------
_make depend_

With old make programs, it was traditional practice to use this
compiler feature to generate dependencies on demand with a command like
make depend.  That command would create a file depend containing all
the automatically-generated dependencies; then the makefile could use
include to read them in.

In GNU make, the feature of remaking makefiles makes this practice
obsolete---you need never tell make explicitly to regenerate the
dependencies, because it always regenerates any makefile that is out of
date.

The practice we recommend for automatic dependency generation is to
have one makefile corresponding to each source file.  For each source
file {name}.c there is a makefile {name}.d which lists what files the
object file {name}.o depends on.  That way only the source files that
have changed need to be rescanned to produce the new dependencies.
--------------------------------------------------------------------

This seems to be saying that there is no way of automatically generating
dependencies as you can on Unix systems with make depend, and, not only
that, but you need to create a makefile for every single source file,
and that this is better than the old way!!!  I checked out the "Remaking
Makefiles", and it appears to be saying you need to make a list of all
of your makefiles to be able to use them.

So, can someone tell me what I am misreading?  Is there a way to do what
make depend does _without_ having to create a makefile for each source
file, or is the author of the docs a tinny short of a slab in thinking
that the "new" way is better?

Please reply via email as well as to the list.

Peter K. Campbell
p DOT campbell AT trl DOT oz DOT au

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019