Where `gcc -MMD' puts .d files

From: Alexander Klimov <ask(at)wisdom(dot)weizmann(dot)ac(dot)il>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Where `gcc -MMD' puts .d files
Date: 2001-05-08 11:53:27
Message-ID: Pine.SUN.4.21.0105081138130.11034-100000@dardar.wisdom.weizmann.ac.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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'

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-05-08 14:16:32 7.1.2 schedule (was Re: Posted 7.1 RPMs for Mandrake 7.2)
Previous Message test 2001-05-08 11:38:39 Re: AW: AW: Re: New Linux xfs/reiser file systems