postgresql/src/makefiles/Makefile.hpux
Tom Lane aa5bb828af Select CFLAGS_SL at configure time, not in platform-specific Makefiles.
Move the platform-dependent logic that sets CFLAGS_SL from
src/makefiles/Makefile.foo to src/template/foo, so that the value
is determined at configure time and thus is available while running
configure's tests.

On a couple of platforms this might save a few microseconds of build
time by eliminating a test that make otherwise has to do over and over.
Otherwise it's pretty much a wash for build purposes; in particular,
this makes no difference to anyone who might be overriding CFLAGS_SL
via a make option.

This patch in itself does nothing with the value and thus should not
change any behavior, though you'll probably have to re-run configure
to get a correctly updated Makefile.global.  We'll use the new
configure variable in a follow-on patch.

Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,
because the follow-on patch is a portability bug fix.

Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com
2019-10-21 12:32:35 -04:00

53 lines
1.3 KiB
Makefile

# 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