Force a checkpoint in CREATE DATABASE before starting to copy the files,
[PostgreSQL.git] / src / backend / common.mk
blob611a257b15e352be4b38222944dc6e724410b5c1
2 # Common make rules for backend
4 # $PostgreSQL$
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 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
19 SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
21 # top-level backend directory obviously has its own "all" target
22 ifneq ($(subdir), src/backend)
23 all: $(subsysfilename)
24 endif
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
43 clean: clean-local
44 clean-local:
45 ifdef SUBDIRS
46 for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
47 endif
48 rm -f $(subsysfilename) $(OBJS)
51 coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
52 ifdef SUBDIRS
53 for dir in $(SUBDIRS); do $(MAKE) -C $$dir coverage || exit; done
54 endif