mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
In 9956ddc19164b02dc1925fb389a1af77472eba5e, ten years ago, the current objfile.txt based linking model was introduced. It's time to retire the old SUBSYS.o based model. This primarily is pertinent because the bitcode files for LLVM based inlining are not produced when using PARTIAL_LINKING. It does not seem worth to fix PARTIAL_LINKING to support that. Author: Andres Freund Discussion: https://postgr.es/m/20180121204356.d5oeu34jetqhmdv2@alap3.anarazel.de
48 lines
1.3 KiB
Makefile
48 lines
1.3 KiB
Makefile
#
|
|
# Common make rules for backend
|
|
#
|
|
# src/backend/common.mk
|
|
#
|
|
|
|
# When including this file, set OBJS to the object files created in
|
|
# this directory and SUBDIRS to subdirectories containing more things
|
|
# to build.
|
|
|
|
subsysfilename = objfiles.txt
|
|
|
|
SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilename))
|
|
|
|
# top-level backend directory obviously has its own "all" target
|
|
ifneq ($(subdir), src/backend)
|
|
all: $(subsysfilename)
|
|
endif
|
|
|
|
SUBSYS.o: $(SUBDIROBJS) $(OBJS)
|
|
$(LD) $(LDREL) $(LDOUT) $@ $^
|
|
|
|
objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
|
|
# Don't rebuild the list if only the OBJS have changed.
|
|
$(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
|
|
|
|
ifeq ($(with_llvm), yes)
|
|
objfiles.txt: $(patsubst %.o,%.bc, $(OBJS))
|
|
endif
|
|
|
|
# make function to expand objfiles.txt contents
|
|
expand_subsys = $(foreach file,$(1),$(if $(filter %/objfiles.txt,$(file)),$(patsubst ../../src/backend/%,%,$(addprefix $(top_builddir)/,$(shell cat $(file)))),$(file)))
|
|
|
|
# Parallel make trickery
|
|
$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
|
|
|
|
.PHONY: $(SUBDIRS:%=%-recursive)
|
|
$(SUBDIRS:%=%-recursive):
|
|
$(MAKE) -C $(subst -recursive,,$@) all
|
|
|
|
$(call recurse,clean)
|
|
clean: clean-local
|
|
clean-local:
|
|
rm -f $(subsysfilename) $(OBJS) $(patsubst %.o,%.bc, $(OBJS))
|
|
|
|
$(call recurse,coverage)
|
|
$(call recurse,install)
|