Re: Where `gcc -MMD' puts .d files

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Alexander Klimov <ask@wisdom.weizmann.ac.il>
Cc: <pgsql-hackers@postgresql.org>
Date: 2001-05-08T16:57:06Z
Lists: pgsql-hackers
Alexander Klimov writes:

> The point is that I do use gcc 2.95.2, and it puts .d file in the curent
> directory, not to the directory there files come from. Anyway, my patch
> solve the problem at least for me.

I see the problem, the port/Makefile needs some changes because it's
trying to put output files outside the current directory.  Try this patch:

diff -c -r1.28 Makefile.in
*** Makefile.in 2000/12/11 00:49:54     1.28
--- Makefile.in 2001/05/08 16:42:20
***************
*** 22,29 ****
  include $(top_builddir)/src/Makefile.global

  OBJS = dynloader.o @INET_ATON@ @STRERROR@ @MISSING_RANDOM@ @SRANDOM@
! OBJS+= @GETHOSTNAME@ @GETRUSAGE@ @STRCASECMP@ @STRDUP@ @TAS@ @ISINF@
  OBJS+= @STRTOL@ @STRTOUL@ @SNPRINTF@
  ifeq ($(PORTNAME), qnx4)
  OBJS += getrusage.o qnx4/SUBSYS.o
  endif
--- 22,32 ----
  include $(top_builddir)/src/Makefile.global

  OBJS = dynloader.o @INET_ATON@ @STRERROR@ @MISSING_RANDOM@ @SRANDOM@
! OBJS+= @GETHOSTNAME@ @GETRUSAGE@ @STRCASECMP@ @TAS@ @ISINF@
  OBJS+= @STRTOL@ @STRTOUL@ @SNPRINTF@
+ ifdef STRDUP
+ OBJS += $(top_builddir)/src/utils/strdup.o
+ endif
  ifeq ($(PORTNAME), qnx4)
  OBJS += getrusage.o qnx4/SUBSYS.o
  endif
***************
*** 56,61 ****
--- 59,68 ----

  tas.o: tas.s
        $(CC) $(CFLAGS) -c $<
+
+ $(top_builddir)/src/utils/strdup.o:
+       $(MAKE) -C $(top_builddir)/src/utils strdup.o
+

  distclean clean:
        rm -f SUBSYS.o $(OBJS)
===snip

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter