2008-02-19 11:30:09 +01:00
|
|
|
#
|
|
|
|
# Common make rules for backend
|
|
|
|
#
|
2008-03-17 19:24:56 +01:00
|
|
|
# $PostgreSQL: pgsql/src/backend/common.mk,v 1.7 2008/03/17 18:24:56 petere Exp $
|
2008-02-19 11:30:09 +01:00
|
|
|
#
|
|
|
|
|
2008-02-25 18:55:42 +01:00
|
|
|
# When including this file, set OBJS to the object files created in
|
|
|
|
# this directory and SUBDIRS to subdirectories containing more things
|
|
|
|
# to build.
|
2008-02-19 11:30:09 +01:00
|
|
|
|
2008-02-25 18:55:42 +01:00
|
|
|
ifdef PARTIAL_LINKING
|
|
|
|
# old style: linking using SUBSYS.o
|
|
|
|
subsysfilename = SUBSYS.o
|
|
|
|
else
|
|
|
|
# new style: linking all object files at once
|
|
|
|
subsysfilename = objfiles.txt
|
|
|
|
endif
|
|
|
|
|
|
|
|
SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
|
|
|
|
|
|
|
|
# top-level backend directory obviously has its own "all" target
|
|
|
|
ifneq ($(subdir), src/backend)
|
|
|
|
all: $(subsysfilename)
|
|
|
|
endif
|
2008-02-19 11:30:09 +01:00
|
|
|
|
|
|
|
SUBSYS.o: $(SUBDIROBJS) $(OBJS)
|
|
|
|
$(LD) $(LDREL) $(LDOUT) $@ $^
|
|
|
|
|
2008-02-29 11:34:51 +01:00
|
|
|
objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
|
2008-03-17 19:24:56 +01:00
|
|
|
# Don't rebuild the list if only the OBJS have changed.
|
|
|
|
$(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
|
2008-02-26 08:20:38 +01:00
|
|
|
|
2008-02-25 18:55:42 +01:00
|
|
|
# make function to expand objfiles.txt contents
|
2008-02-27 21:31:01 +01:00
|
|
|
expand_subsys = $(foreach file,$(1),$(if $(filter %/objfiles.txt,$(file)),$(patsubst ../../src/backend/%,%,$(addprefix $(top_builddir)/,$(shell cat $(file)))),$(file)))
|
2008-02-25 18:55:42 +01:00
|
|
|
|
|
|
|
# Parallel make trickery
|
2008-02-19 11:30:09 +01:00
|
|
|
$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
|
|
|
|
|
|
|
|
.PHONY: $(SUBDIRS:%=%-recursive)
|
|
|
|
$(SUBDIRS:%=%-recursive):
|
2008-02-25 18:55:42 +01:00
|
|
|
$(MAKE) -C $(subst -recursive,,$@) all
|
2008-02-19 11:30:09 +01:00
|
|
|
|
|
|
|
clean: clean-local
|
|
|
|
clean-local:
|
|
|
|
ifdef SUBDIRS
|
|
|
|
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
|
|
|
|
endif
|
2008-02-25 18:55:42 +01:00
|
|
|
rm -f $(subsysfilename) $(OBJS)
|