Shared library support for AIX

This commit is contained in:
Ayappan Perumal 2024-02-22 07:05:37 -06:00
parent 9d6eeea867
commit 892f8ff3e5
3 changed files with 21 additions and 4 deletions

View File

@ -152,6 +152,9 @@ endif
ifeq ($(OSNAME), CYGWIN_NT)
@$(MAKE) -C exports dll
endif
ifeq ($(OSNAME), AIX)
@$(MAKE) -C exports so
endif
endif
tests : shared

View File

@ -1707,11 +1707,7 @@ endif
LIBDLLNAME = $(LIBPREFIX).dll
IMPLIBNAME = lib$(LIBNAMEBASE).dll.a
ifneq ($(OSNAME), AIX)
LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.so)
else
LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.a)
endif
LIBDYNNAME = $(LIBNAME:.$(LIBSUFFIX)=.dylib)
LIBDEFNAME = $(LIBNAME:.$(LIBSUFFIX)=.def)
LIBEXPNAME = $(LIBNAME:.$(LIBSUFFIX)=.exp)

View File

@ -73,6 +73,10 @@ endif
endif
endif
ifeq ($(F_COMPILER)$(OSNAME), IBMAIX)
EXTRALIB += -lxlf90
endif
ifeq ($(C_COMPILER), PGI)
EXTRALIB += -pgf90libs
endif
@ -248,6 +252,20 @@ endif
ifeq ($(OSNAME), AIX)
so : ../$(LIBSONAME) linktest.c
$(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(EXTRALIB) && echo OK.
rm -f linktest
../$(LIBSONAME) : aix.exp
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \
-Wl,-bE:aix.exp -Wl,-bbigtoc ../$(LIBNAME) $(EXTRALIB)
aix.exp :
/usr/bin/nm -X32_64 -PCpgl ../$(LIBNAME) | /usr/bin/awk '{ if ((($$ 2 == "T") \
|| ($$ 2 == "D") || ($$ 2 == "B") || ($$ 2 == "W") || ($$ 2 == "V") || ($$ 2 == "Z")) && (substr($$ 1,1,1) != ".")) \
{ if (($$ 2 == "W") || ($$ 2 == "V") || ($$ 2 == "Z")) { print $$ 1 " weak" } else { print $$ 1 } } }' | \
/usr/bin/sort -u > aix.exp
ifeq ($(COMPILER_F77), xlf)
goto32.$(SUFFIX) : ../$(LIBNAME) aix.def