summaryrefslogtreecommitdiffstats
path: root/src/makefiles/Makefile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/makefiles/Makefile
parentInitial commit. (diff)
downloadpostgresql-13-upstream.tar.xz
postgresql-13-upstream.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/makefiles/Makefile15
-rw-r--r--src/makefiles/Makefile.aix46
-rw-r--r--src/makefiles/Makefile.cygwin53
-rw-r--r--src/makefiles/Makefile.darwin16
-rw-r--r--src/makefiles/Makefile.freebsd19
-rw-r--r--src/makefiles/Makefile.hpux53
-rw-r--r--src/makefiles/Makefile.linux13
-rw-r--r--src/makefiles/Makefile.netbsd11
-rw-r--r--src/makefiles/Makefile.openbsd11
-rw-r--r--src/makefiles/Makefile.solaris23
-rw-r--r--src/makefiles/Makefile.win3287
11 files changed, 347 insertions, 0 deletions
diff --git a/src/makefiles/Makefile b/src/makefiles/Makefile
new file mode 100644
index 0000000..417c98b
--- /dev/null
+++ b/src/makefiles/Makefile
@@ -0,0 +1,15 @@
+# src/makefiles/Makefile
+
+subdir = src/makefiles
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+
+
+install: all installdirs
+ $(INSTALL_DATA) $(srcdir)/pgxs.mk '$(DESTDIR)$(pgxsdir)/$(subdir)/'
+
+installdirs:
+ $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
+
+uninstall:
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pgxs.mk'
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 0000000..ba3695d
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,46 @@
+# MAKE_EXPORTS is required for svr4 loaders that want a file of
+# symbol names to tell them what to export/import.
+MAKE_EXPORTS= true
+
+RANLIB= touch
+AROPT = crs
+
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+ifeq ($(host_os), aix3.2.5)
+ rpath = -L'$(rpathdir)'
+else
+ rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+endif
+
+DLSUFFIX = .so
+ifeq ($(host_os), aix3.2.5)
+ifneq ($(GCC), yes)
+ LDFLAGS_SL += -e _nostart -H512 -bM:SRE
+endif
+else
+ LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%.exp: %.o
+ $(MKLDEXPORT) $^ >$@
+
+# Rule for building a shared library from a single .o file
+%$(DLSUFFIX): %.o %.exp
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ -Wl,-bE:$*.exp $(BE_DLLLIBS)
diff --git a/src/makefiles/Makefile.cygwin b/src/makefiles/Makefile.cygwin
new file mode 100644
index 0000000..81089d6
--- /dev/null
+++ b/src/makefiles/Makefile.cygwin
@@ -0,0 +1,53 @@
+# src/makefiles/Makefile.cygwin
+
+ifdef PGXS
+BE_DLLLIBS= -L$(libdir) -lpostgres
+else
+BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
+endif
+
+# linking with -lm or -lc causes program to crash
+# (see http://sources.redhat.com/cygwin/faq/faq.html#SEC110)
+LIBS:=$(filter-out -lm -lc, $(LIBS))
+
+AROPT = crs
+DLSUFFIX = .dll
+
+override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
+
+ifneq (,$(findstring backend,$(subdir)))
+ifeq (,$(findstring conversion_procs,$(subdir)))
+ifeq (,$(findstring libpqwalreceiver,$(subdir)))
+ifeq (,$(findstring replication/pgoutput,$(subdir)))
+ifeq (,$(findstring snowball,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+endif
+endif
+endif
+endif
+
+ifneq (,$(findstring src/common,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring src/port,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring timezone,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring ecpg/ecpglib,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+# required by Python headers
+ifneq (,$(findstring src/pl/plpython,$(subdir)))
+override CPPFLAGS+= -DUSE_DL_IMPORT
+endif
+
+# Rule for building a shared library from a single .o file
+%.dll: %.o
+ $(CC) $(CFLAGS) -shared -o $@ $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
diff --git a/src/makefiles/Makefile.darwin b/src/makefiles/Makefile.darwin
new file mode 100644
index 0000000..b17598f
--- /dev/null
+++ b/src/makefiles/Makefile.darwin
@@ -0,0 +1,16 @@
+AROPT = crs
+
+DLSUFFIX = .so
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = DYLD_LIBRARY_PATH
+
+ifdef PGXS
+ BE_DLLLIBS = -bundle_loader $(bindir)/postgres
+else
+ BE_DLLLIBS = -bundle_loader $(top_builddir)/src/backend/postgres
+endif
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -o $@
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
new file mode 100644
index 0000000..75db21b
--- /dev/null
+++ b/src/makefiles/Makefile.freebsd
@@ -0,0 +1,19 @@
+AROPT = cr
+
+export_dynamic = -Wl,-export-dynamic
+rpath = -Wl,-R'$(rpathdir)'
+
+DLSUFFIX = .so
+
+# extra stuff for $(with_temp_install)
+# we need this to get LD_LIBRARY_PATH searched ahead of the compiled-in
+# rpath, if no DT_RUNPATH is present in the executable. The conditions
+# under which DT_RUNPATH are added seem unpredictable, so be safe.
+
+define with_temp_install_extra
+LD_LIBRARY_PATH_RPATH=1
+endef
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux
new file mode 100644
index 0000000..7e18770
--- /dev/null
+++ b/src/makefiles/Makefile.hpux
@@ -0,0 +1,53 @@
+# Using X/Open Networking Interfaces requires to link with libxnet.
+# Without specifying this, bind(), getpeername() and so on don't work
+# correctly in the LP64 data model.
+LIBS := -lxnet $(LIBS)
+
+# Set up rpath so that the executables don't need SHLIB_PATH to be set.
+# (Note: --disable-rpath is a really bad idea on this platform...)
+ifeq ($(with_gnu_ld), yes)
+ rpath = -Wl,-rpath -Wl,'$(rpathdir)'
+else
+ rpath = -Wl,+b -Wl,'$(rpathdir)'
+endif
+
+# catch null pointer dereferences
+ifeq ($(with_gnu_ld), yes)
+# XXX what to put here?
+else
+ LDFLAGS_EX += -Wl,-z
+endif
+
+# set up appropriate options for shared library builds
+export_dynamic = -Wl,-E
+
+INSTALL_SHLIB_OPTS = -m 555
+
+AROPT = crs
+
+ifeq ($(host_cpu), ia64)
+ DLSUFFIX = .so
+else
+ DLSUFFIX = .sl
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = SHLIB_PATH
+
+# Rule for building a shared library from a single .o file
+%$(DLSUFFIX): %.o
+ifeq ($(GCC), yes)
+ ifeq ($(with_gnu_ld), yes)
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ `$(CC) $(LDFLAGS) -print-libgcc-file-name`
+ else
+ $(LD) -b -o $@ $< `$(CC) $(LDFLAGS) -print-libgcc-file-name`
+ endif
+else
+ ifeq ($(with_gnu_ld), yes)
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
+ else
+ $(LD) -b -o $@ $<
+ endif
+endif
+
+sqlmansect = 5
diff --git a/src/makefiles/Makefile.linux b/src/makefiles/Makefile.linux
new file mode 100644
index 0000000..645f73a
--- /dev/null
+++ b/src/makefiles/Makefile.linux
@@ -0,0 +1,13 @@
+AROPT = crs
+
+export_dynamic = -Wl,-E
+# Use --enable-new-dtags to generate DT_RUNPATH instead of DT_RPATH.
+# This allows LD_LIBRARY_PATH to still work when needed.
+rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
+
+DLSUFFIX = .so
+
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
new file mode 100644
index 0000000..6f9cb1d
--- /dev/null
+++ b/src/makefiles/Makefile.netbsd
@@ -0,0 +1,11 @@
+AROPT = cr
+
+export_dynamic = -Wl,-E
+rpath = -Wl,-R'$(rpathdir)'
+
+DLSUFFIX = .so
+
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
new file mode 100644
index 0000000..6f9cb1d
--- /dev/null
+++ b/src/makefiles/Makefile.openbsd
@@ -0,0 +1,11 @@
+AROPT = cr
+
+export_dynamic = -Wl,-E
+rpath = -Wl,-R'$(rpathdir)'
+
+DLSUFFIX = .so
+
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
new file mode 100644
index 0000000..62a6c01
--- /dev/null
+++ b/src/makefiles/Makefile.solaris
@@ -0,0 +1,23 @@
+# src/makefiles/Makefile.solaris
+
+AROPT = crs
+
+ifeq ($(with_gnu_ld), yes)
+export_dynamic = -Wl,-E
+rpath = -Wl,-rpath,'$(rpathdir)'
+else
+rpath = -Wl,-R'$(rpathdir)'
+endif
+
+DLSUFFIX = .so
+
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ifeq ($(GCC), yes)
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
+else
+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -G -o $@
+endif
+
+sqlmansect = 5sql
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
new file mode 100644
index 0000000..e72cb2d
--- /dev/null
+++ b/src/makefiles/Makefile.win32
@@ -0,0 +1,87 @@
+# src/makefiles/Makefile.win32
+
+ifdef PGXS
+BE_DLLLIBS= -L$(libdir) -lpostgres
+override CPPFLAGS+= -I$(includedir_server)/port/win32
+else
+BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
+override CPPFLAGS+="-I$(top_srcdir)/src/include/port/win32"
+endif
+
+override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
+
+AROPT = crs
+DLSUFFIX = .dll
+
+ifneq (,$(findstring backend,$(subdir)))
+ifeq (,$(findstring conversion_procs,$(subdir)))
+ifeq (,$(findstring libpqwalreceiver,$(subdir)))
+ifeq (,$(findstring replication/pgoutput,$(subdir)))
+ifeq (,$(findstring snowball,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+endif
+endif
+endif
+endif
+
+ifneq (,$(findstring src/common,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring src/port,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring timezone,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+ifneq (,$(findstring ecpg/ecpglib,$(subdir)))
+override CPPFLAGS+= -DBUILDING_DLL
+endif
+
+# required by Python headers
+ifneq (,$(findstring src/pl/plpython,$(subdir)))
+override CPPFLAGS+= -DUSE_DL_IMPORT
+endif
+
+# it is better to install shared-libraries anyway?
+# may be overridden with make MAKE_DLL=false install
+ifndef MAKE_DLL
+MAKE_DLL = true
+endif
+
+
+# Build rules to add versioninfo resources to win32 binaries
+
+WIN32RES += win32ver.o
+PGFTYPE = $(if $(shlib),VFT_DLL,VFT_APP)
+ifneq (,$(PGAPPICON))
+PGICOSTR = $(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
+endif
+
+# We do not install src/port/win32ver.rc, its content being specific to
+# PostgreSQL Global Development Group software. Any module can ship a
+# win32ver.rc or furnish a rule for generating one. Set $(PGFILEDESC) to
+# signal win32ver.rc availability to the dll build rule below.
+ifndef PGXS
+win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
+ sed -e 's;FILEDESC;$(PGFILEDESC);' \
+ -e 's;VFT_APP;$(PGFTYPE);' \
+ -e 's;_ICO_;$(PGICOSTR);' \
+ -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
+ -e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
+ -e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
+ $< >$@
+
+# Depend on Makefile.global to force rebuild on re-run of configure.
+win32ver.rc: $(top_builddir)/src/Makefile.global
+endif
+
+win32ver.o: win32ver.rc
+ $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir)
+
+# Rule for building a shared library from a single .o file
+%.dll: %.o $(if $(PGFILEDESC),$(WIN32RES))
+ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)