summaryrefslogtreecommitdiff
path: root/src/makefiles/Makefile.aix
blob: 9408c1e291308b1234ef5eeb9e641fc5deabfd18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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

# when building with gcc, need to make sure that libgcc can be found
ifeq ($(GCC), yes)
libpath := $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
endif

rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'

LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE

# gcc needs to know it's building a shared lib, otherwise it'll not emit
# correct code / link to the right support libraries
ifeq ($(GCC), yes)
LDFLAGS_SL += -shared
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)