2 # Common make rules for backend
7 # When including this file, set OBJS to the object files created in
8 # this directory and SUBDIRS to subdirectories containing more things
12 # old style: linking using SUBSYS.o
13 subsysfilename
= SUBSYS.o
15 # new style: linking all object files at once
16 subsysfilename
= objfiles.txt
19 SUBDIROBJS
= $(SUBDIRS
:%=%/$(subsysfilename
))
21 # top-level backend directory obviously has its own "all" target
22 ifneq ($(subdir
), src
/backend
)
23 all: $(subsysfilename
)
26 SUBSYS.o
: $(SUBDIROBJS
) $(OBJS
)
27 $(LD
) $(LDREL
) $(LDOUT
) $@
$^
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
$@
)
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
)))
36 # Parallel make trickery
37 $(SUBDIROBJS
): $(SUBDIRS
:%=%-recursive
) ;
39 .PHONY
: $(SUBDIRS
:%=%-recursive
)
40 $(SUBDIRS
:%=%-recursive
):
41 $(MAKE
) -C
$(subst -recursive
,,$@
) all
46 for
dir in
$(SUBDIRS
); do
$(MAKE
) -C
$$dir clean || exit
; done
48 rm -f
$(subsysfilename
) $(OBJS
)
51 coverage
: $(gcda_files
:.gcda
=.c.gcov
) lcov.
info
53 for
dir in
$(SUBDIRS
); do
$(MAKE
) -C
$$dir coverage || exit
; done