Revert commit 66c0185a3 and follow-on patches.
[pgsql.git] / src / backend / common.mk
blob61861f5c7ebda50bb003651a4379402834140ef6
2 # Common make rules for backend
4 # src/backend/common.mk
7 # When including this file, set OBJS to the object files created in
8 # this directory and SUBDIRS to subdirectories containing more things
9 # to build.
11 subsysfilename = objfiles.txt
13 SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
15 # top-level backend directory obviously has its own "all" target
16 ifneq ($(subdir), src/backend)
17 all: $(subsysfilename)
18 endif
20 objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
21 # Don't rebuild the list if only the OBJS have changed.
22 $(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
24 ifeq ($(with_llvm), yes)
25 objfiles.txt: $(patsubst %.o,%.bc, $(OBJS))
26 $(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
27 endif
29 # make function to expand objfiles.txt contents
30 expand_subsys = $(foreach file,$(1),$(if $(filter %/objfiles.txt,$(file)),$(patsubst ../../src/backend/%,%,$(addprefix $(top_builddir)/,$(shell cat $(file)))),$(file)))
32 # Parallel make trickery
33 $(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
35 .PHONY: $(SUBDIRS:%=%-recursive)
36 $(SUBDIRS:%=%-recursive):
37 $(MAKE) -C $(subst -recursive,,$@) all
39 $(call recurse,clean)
40 clean: clean-local
41 clean-local:
42 rm -f $(subsysfilename) $(OBJS) $(patsubst %.o,%.bc, $(OBJS))
44 $(call recurse,coverage)
45 $(call recurse,install)