Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ LOCALOBJS += utils/probes.o
endif
endif

OBJS = \
ONLYOBJS = \
$(LOCALOBJS) \
$(SUBDIROBJS) \
$(SUBDIROBJS)
OBJS = \
$(ONLYOBJS) \
$(top_builddir)/src/common/libpgcommon_srv.a \
$(top_builddir)/src/port/libpgport_srv.a

Expand All @@ -60,16 +62,32 @@ override LDFLAGS := $(LDFLAGS) $(LDFLAGS_EX) $(LDFLAGS_EX_BE)

all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP)

ifneq ($(PORTNAME), emscripten)
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), aix)

postgres: $(OBJS)
$(CC) $(MAIN_MODULE) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@

endif
endif
endif
endif

ifeq ($(PORTNAME), emscripten)
AR ?= llvm-ar
LIBPGLITE ?= $(top_builddir)/libpglite.a
LIBPG = $(top_builddir)/libpostgres.a
PGLITE = $(top_builddir)/src/common/libpgcommon_srv.a $(top_builddir)/src/port/libpgport_srv.a $(LIBPG)
PGMAIN = main/main.o tcop/postgres.o
postgres: $(OBJS)
$(AR) rcs $(top_builddir)/libpgmain.a $(PGMAIN)
$(AR) rcs $(LIBPG) $(filter-out $(PGMAIN),$(call expand_subsys,$(ONLYOBJS)))
$(CC) -r -o $(top_builddir)/libpglite.o -Wl,--whole-archive $(PGLITE)
$(AR) rcs $(LIBPGLITE) $(top_builddir)/libpglite.o
COPTS="$(LOPTS)" $(CC) $(MAIN_MODULE) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPGLITE) $(top_builddir)/libpgmain.a $(LIBS)
endif

ifeq ($(PORTNAME), cygwin)

Expand Down