1
1
# -*-makefile-*-
2
- # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.106 2000/10/27 23:59:39 petere Exp $
2
+ # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.107 2000/10/29 16:13:28 petere Exp $
3
3
4
4
# ------------------------------------------------------------------------------
5
5
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -332,28 +332,48 @@ $(top_builddir)/config.status: $(top_srcdir)/configure
332
332
# that make will update all files that depended on the now removed
333
333
# file.)
334
334
335
- COMPILE.c =$(CC ) -c$(CPPFLAGS ) $(CFLAGS )
336
-
337
335
autodepend = @autodepend@
338
336
339
337
ifeq ($(autodepend ) , yes)
340
338
339
+ ifndef COMPILE.c
340
+ COMPILE.c =$(CC ) $(CFLAGS ) $(CPPFLAGS ) -c
341
+ endif
342
+
343
+ ifndef COMPILE.cc
344
+ COMPILE.cc =$(CXX ) $(CXXFLAGS ) $(CPPFLAGS ) -c
345
+ endif
346
+
341
347
DEPDIR = .deps
342
348
df =$(DEPDIR ) /$(*F )
343
349
350
+ # This converts a .d file in the current directory to a .P file in the .deps
351
+ # subdirectory, with the dummy targets as explained above.
352
+ define postprocess-depend
353
+ @if test ! -d$(DEPDIR ) ; then mkdir$(DEPDIR ) ; fi
354
+ @cp$* .d$(df ) .P
355
+ @sed -e 's/# .*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//'\
356
+ -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
357
+ @rm -f$* .d
358
+ endef
359
+
344
360
ifeq ($(GCC ) , yes)
345
361
346
362
# GCC allows us to create object and dependency file in one invocation.
347
363
% .o :% .c
348
- $(COMPILE.c ) -MMD$< -o$@
349
- @iftest ! -d$(DEPDIR ) ; then mkdir$(DEPDIR ) ; fi ; \
350
- cp$* .d$(df ) .P; \
351
- sed -e' s/#.*//' -e' s/^[^:]*: *//' -e' s/ *\\$$//' \
352
- -e' /^$$/ d' -e' s/$$/ :/' < $* .d>> $(df ) .P; \
353
- rm -f$* .d
364
+ $(COMPILE.c ) -o$@ $< -MMD
365
+ $(postprocess-depend )
354
366
355
367
endif # GCC
356
368
369
+ ifeq ($(GXX ) , yes)
370
+
371
+ % .o :% .cc
372
+ $(COMPILE.cc ) -o$@ $< -MMD
373
+ $(postprocess-depend )
374
+
375
+ endif # GXX
376
+
357
377
# Include all the dependency files generated for the current
358
378
# directory. List /dev/null as dummy because if the wildcard expands
359
379
# to nothing then make would complain.
@@ -364,6 +384,6 @@ clean distclean maintainer-clean: clean-deps
364
384
365
385
.PHONY : clean-deps
366
386
clean-deps :
367
- @rm -rf$(DEPDIR )
387
+ @rm -rf$(DEPDIR ) * .d
368
388
369
389
endif # autodepend