mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Rather than define ld_library_path_ver with a big nested $(if), just put the overriding values in the makefiles for the relevant ports. Also add a variable for port makefiles to append their own stuff to with_temp_install, and use it to set LD_LIBRARY_PATH_RPATH=1 on FreeBSD which is needed to make LD_LIBRARY_PATH override DT_RPATH if DT_RUNPATH is not set (which seems to depend in unpredictable ways on the choice of compiler, at least on my system). Backpatch for the benefit of anyone doing regression tests on FreeBSD. (For other platforms there should be no functional change.)
33 lines
800 B
Makefile
33 lines
800 B
Makefile
AROPT = cr
|
|
|
|
ifdef ELF_SYSTEM
|
|
export_dynamic = -Wl,-export-dynamic
|
|
rpath = -Wl,-R'$(rpathdir)'
|
|
endif
|
|
|
|
DLSUFFIX = .so
|
|
|
|
CFLAGS_SL = -fPIC -DPIC
|
|
|
|
# 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
|
|
ifdef ELF_SYSTEM
|
|
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
|
|
else
|
|
$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
|
|
@echo building shared object $@
|
|
@rm -f $@.pic
|
|
@${AR} cq $@.pic $<.obj
|
|
${RANLIB} $@.pic
|
|
@rm -f $@
|
|
$(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
|
|
endif
|