]> granicus.if.org Git - postgresql/blob - src/backend/common.mk
Don't apply sortgroupref labels to a tlist that might not match.
[postgresql] / src / backend / common.mk
1 #
2 # Common make rules for backend
3 #
4 # src/backend/common.mk
5 #
6
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.
10
11 ifdef PARTIAL_LINKING
12 # old style: linking using SUBSYS.o
13 subsysfilename = SUBSYS.o
14 else
15 # new style: linking all object files at once
16 subsysfilename = objfiles.txt
17 endif
18
19 SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
20
21 # top-level backend directory obviously has its own "all" target
22 ifneq ($(subdir), src/backend)
23 all: $(subsysfilename)
24 endif
25
26 SUBSYS.o: $(SUBDIROBJS) $(OBJS)
27         $(LD) $(LDREL) $(LDOUT) $@ $^
28
29 objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
30 # Don't rebuild the list if only the OBJS have changed.
31         $(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
32
33 # make function to expand objfiles.txt contents
34 expand_subsys = $(foreach file,$(1),$(if $(filter %/objfiles.txt,$(file)),$(patsubst ../../src/backend/%,%,$(addprefix $(top_builddir)/,$(shell cat $(file)))),$(file)))
35
36 # Parallel make trickery
37 $(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
38
39 .PHONY: $(SUBDIRS:%=%-recursive)
40 $(SUBDIRS:%=%-recursive):
41         $(MAKE) -C $(subst -recursive,,$@) all
42
43 $(call recurse,clean)
44 clean: clean-local
45 clean-local:
46         rm -f $(subsysfilename) $(OBJS)
47
48 $(call recurse,coverage)