This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Makeconfig change for dependency generation


Hi.

Here's a little patch that makes the generated dependencies a little
more forgiving if a dependent header file is removed. A patch like this is
possible because glibc now requires gcc-3.2, and gcc-2.X didn't have
this flag. The patch I've attached below is being used to build right
now, and the generated ".d" files look good.

A more radical approach (not given here) to dependency generation could
be done by modifying the Makerules file and changing the "compile.c" line
like so ...

compile.c = $(CC) $< -c -MD -MP -MF $(addsuffix .d, $@) $(CFLAGS) $(CPPFLAGS)

For each object file generated there would be an associated dependency
file created at compile time. This would increase the disk space needed
to compile glibc because there would be more dependency files generated,
but it could product more accurate dependencies if the object files for
static, shared, profiled, and debug compiled code rely on different
header files. I've made this change to the Makerules file, and the
output seems correct.

If this approach was taken, then the step of generating the dependencies
in an initial pass through the directory could be eliminated. I'm not
sure just how many makefile modifications would be needed to 'include'
these dependencies though.  Maybe this idea can generate some discussion
between the main developers ... 

Here's the patch for modifying the current dependency generation.

2003-01-03  Art Haas  <ahaas@airmail.net>

	* Makeconfig: Generate make targets for all header files in a
	dependency file.

Index: Makeconfig
===================================================================
RCS file: /cvs/glibc/libc/Makeconfig,v
retrieving revision 1.278
diff -u -r1.278 Makeconfig
--- Makeconfig	9 Dec 2002 20:37:23 -0000	1.278
+++ Makeconfig	4 Jan 2003 01:44:43 -0000
@@ -556,7 +556,7 @@
 # This is the program that generates makefile
 # dependencies from C source files.
 ifndef +mkdep
-+mkdep = $(CC) -M
++mkdep = $(CC) -M -MP
 endif
 
 # The program that makes Emacs-style TAGS files.
-- 
They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety.
 -- Benjamin Franklin, Historical Review of Pennsylvania, 1759


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]