diff --git i/src/makefiles/pgxs.mk w/src/makefiles/pgxs.mk index 039cee3dfe5..d7732024b15 100644 --- i/src/makefiles/pgxs.mk +++ w/src/makefiles/pgxs.mk @@ -219,7 +219,12 @@ endef all: $(PROGRAM) $(DATA_built) $(HEADER_allbuilt) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION)) ifeq ($(with_llvm), yes) +# Ensure that .bc files for MODULES and OBJS get built with all all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS)) +# Ensure that each .bc file depends on the corresponding .o file, to ensure +# the dependencies required for it to be built are present. +$(patsubst %.o,%.bc, $(OBJS)): $(OBJS) +$(addsuffix .bc, $(MODULES)): $(addsuffix .o, $(MODULES)) endif ifdef MODULE_big diff --git i/src/backend/common.mk w/src/backend/common.mk index 61861f5c7eb..85bb4ee2527 100644 --- i/src/backend/common.mk +++ w/src/backend/common.mk @@ -22,7 +22,10 @@ objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS) $(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@) ifeq ($(with_llvm), yes) +# Ensure that .bc files get built when building .o files objfiles.txt: $(patsubst %.o,%.bc, $(OBJS)) +# Ensure that each .bc file depends on the corresponding .o file, to ensure +# the dependencies required for it to be built are present. $(patsubst %.o,%.bc, $(OBJS)): $(OBJS) endif