Where `gcc -MMD' puts .d files - Mailing list pgsql-hackers

From Alexander Klimov
Subject Where `gcc -MMD' puts .d files
Date
Msg-id Pine.SUN.4.21.0105081138130.11034-100000@dardar.wisdom.weizmann.ac.il
Whole thread Raw
Responses Re: Where `gcc -MMD' puts .d files  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Hi.

After `configure --enable-depend' I try `make' and got
gmake[3]: Entering directory
`/tmp_mnt/hosts/wisdom/NewSoftware/Ask/build/pgsql/src/backend/port'
gcc  -Wall -Wmissing-prototypes -Wmissing-declarations
-I../../../src/include   -c -o ../../utils/strdup.o ../../utils/strdup.c
-MMD
cp: ../../utils/strdup.d: No such file or directory
gmake[3]: *** [../../utils/strdup.o] Error 1
gmake[3]: *** Deleting file `../../utils/strdup.o'
gmake[3]: Leaving directory
`/tmp_mnt/hosts/wisdom/NewSoftware/Ask/build/pgsql/src/backend/port'

The reason is that gcc has bug (or changed feature) in determing there to
put .d files: `gcc -MMD x/a.c -c -o x/a.o' puts a.d to the current
directory if its version is `2.92.2 19991024', and in x, if its version is
`3.1 20010430'. It is looks like the makefile assumes the new
behaviour. (Actually, I guess, nobody faced the issue, because developer's
systems has `strdup')

It is looks like the following patch solves the problem:
Index: src/Makefile.global.in
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.123
diff -C2 -r1.123 Makefile.global.in
*** src/Makefile.global.in      2001/03/10 10:38:59     1.123
--- src/Makefile.global.in      2001/05/08 10:07:30
***************
*** 367,375 **** # subdirectory, with the dummy targets as explained above. define postprocess-depend
! @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
! @cp $*.d $(df).P
! @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
!      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
! @rm -f $*.d endef 
--- 367,377 ---- # subdirectory, with the dummy targets as explained above. define postprocess-depend
! @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi; \
! if test -f $*.d; then dfile=$*.d ; \
!  else dfile=`basename $*.d` ; fi; \
! cp $$dfile $(df).P; \
! sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
!     -e '/^$$/ d' -e 's/$$/ :/' < $$dfile >> $(df).P; \
! rm -f $$dfile endef

BTW: Is there documentation about build process (makefiles structure,
etc.)?

Another tiny (for quick computer) thing: is it necessary for `make
distclean' to call configure, or something is wrong with my environment?

And yet another: is it OK for `make depend' to produce
gcc -MM  -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-error *.c>depend
analyze.c:14: postgres.h: No such file or directory
analyze.c:16: access/heapam.h: No such file or directory
...

Regards,
ASK

P.S. Search in the mailing lists for `-MMD' failed with 
Output from Glimpse: 
glimpse: error in options or arguments to `agrep'







pgsql-hackers by date:

Previous
From: darcy@druid.net (D'Arcy J.M. Cain)
Date:
Subject: Changes needed to build on NetBSD
Next
From: Lieven Van Acker
Date:
Subject: Re: [GENERAL] v7.1.1 Branched, Packaged and Released ...