postgresql/src/makefiles/Makefile.hpux

54 lines
1.3 KiB
Makefile
Raw Normal View History

# 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
2001-03-10 11:38:59 +01:00
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)
Ensure link commands list *.o files before LDFLAGS. It's important for link commands to list *.o input files before -l switches for libraries, as library code may not get pulled into the link unless referenced by an earlier command-line entry. This is certainly necessary for static libraries (.a style). Apparently on some platforms it is also necessary for shared libraries, as reported by Donald Dong. We often put -l switches for within-tree libraries into LDFLAGS, meaning that link commands that list *.o files after LDFLAGS are hazardous. Most of our link commands got this right, but a few did not. In particular, places that relied on gmake's default implicit link rule failed, because that puts LDFLAGS first. Fix that by overriding the built-in rule with our own. The implicit link rules in src/makefiles/Makefile.* for single-.o-file shared libraries mostly got this wrong too, so fix them. I also changed the link rules for the backend and a couple of other places for consistency, even though they are not (currently) at risk because they aren't adding any -l switches to LDFLAGS. Arguably, the real problem here is that we're abusing LDFLAGS by putting -l switches in it and we should stop doing that. But changing that would be quite invasive, so I'm not eager to do so. Perhaps this is a candidate for back-patching, but so far it seems that problems can only be exhibited in test code we don't normally build, and at least some of the problems are new in HEAD anyway. So I'll refrain for now. Donald Dong and Tom Lane Discussion: https://postgr.es/m/CAKABAquXn-BF-vBeRZxhzvPyfMqgGuc74p8BmQZyCFDpyROBJQ@mail.gmail.com
2019-01-02 19:57:42 +01:00
$(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)
Ensure link commands list *.o files before LDFLAGS. It's important for link commands to list *.o input files before -l switches for libraries, as library code may not get pulled into the link unless referenced by an earlier command-line entry. This is certainly necessary for static libraries (.a style). Apparently on some platforms it is also necessary for shared libraries, as reported by Donald Dong. We often put -l switches for within-tree libraries into LDFLAGS, meaning that link commands that list *.o files after LDFLAGS are hazardous. Most of our link commands got this right, but a few did not. In particular, places that relied on gmake's default implicit link rule failed, because that puts LDFLAGS first. Fix that by overriding the built-in rule with our own. The implicit link rules in src/makefiles/Makefile.* for single-.o-file shared libraries mostly got this wrong too, so fix them. I also changed the link rules for the backend and a couple of other places for consistency, even though they are not (currently) at risk because they aren't adding any -l switches to LDFLAGS. Arguably, the real problem here is that we're abusing LDFLAGS by putting -l switches in it and we should stop doing that. But changing that would be quite invasive, so I'm not eager to do so. Perhaps this is a candidate for back-patching, but so far it seems that problems can only be exhibited in test code we don't normally build, and at least some of the problems are new in HEAD anyway. So I'll refrain for now. Donald Dong and Tom Lane Discussion: https://postgr.es/m/CAKABAquXn-BF-vBeRZxhzvPyfMqgGuc74p8BmQZyCFDpyROBJQ@mail.gmail.com
2019-01-02 19:57:42 +01:00
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
else
$(LD) -b -o $@ $<
endif
endif
sqlmansect = 5