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
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
)
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
)
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
42 rm -f
$(subsysfilename
) $(OBJS
) $(patsubst %.o
,%.bc
, $(OBJS
))
44 $(call recurse
,coverage
)
45 $(call recurse
,install)