Debian Codegraph @

src/backend/common.mk

raw
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 subsysfilename = objfiles.txt
12
13 SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
14
15 # top-level backend directory obviously has its own "all" target
16 ifneq ($(subdir), src/backend)
17 all: $(subsysfilename)
18 endif
19
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 $@)
23
24 ifeq ($(with_llvm), yes)
25 objfiles.txt: $(patsubst %.o,%.bc, $(OBJS))
26 $(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
27 endif
28
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)))
31
32 # Parallel make trickery
33 $(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
34
35 .PHONY: $(SUBDIRS:%=%-recursive)
36 $(SUBDIRS:%=%-recursive):
37 $(MAKE) -C $(subst -recursive,,$@) all
38
39 $(call recurse,clean)
40 clean: clean-local
41 clean-local:
42 rm -f $(subsysfilename) $(OBJS) $(patsubst %.o,%.bc, $(OBJS))
43
44 $(call recurse,coverage)
45 $(call recurse,install)