kusano 2b45e8
TOPDIR	= ..
kusano 2b45e8
kusano 2b45e8
include ../Makefile.system
kusano 2b45e8
kusano 2b45e8
ifndef EXPRECISION
kusano 2b45e8
EXPRECISION	= 0
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NO_CBLAS
kusano 2b45e8
NO_CBLAS	= 0
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NO_LAPACK
kusano 2b45e8
NO_LAPACK	= 0
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NO_LAPACKE
kusano 2b45e8
NO_LAPACKE	= 0
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), WINNT)
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
EXTRALIB += -lgfortran
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), CYGWIN_NT)
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
EXTRALIB += -lgfortran
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
all::
kusano 2b45e8
kusano 2b45e8
libs::
kusano 2b45e8
kusano 2b45e8
prof::
kusano 2b45e8
kusano 2b45e8
hpl:: libgoto_hpl.$(LIBSUFFIX)
kusano 2b45e8
kusano 2b45e8
hpl_p:: libgoto_hpl_p.$(LIBSUFFIX)
kusano 2b45e8
kusano 2b45e8
libgoto_hpl.$(LIBSUFFIX) : ../$(LIBNAME)
kusano 2b45e8
	rm -f $(@F)
kusano 2b45e8
	$(LD) -r $(LDFLAGS) -o goto.$(SUFFIX) --whole-archive $< --no-whole-archive
kusano 2b45e8
	$(AR) cq $(@F) goto.$(SUFFIX)
kusano 2b45e8
	$(RANLIB) libgoto_hpl.$(LIBSUFFIX)
kusano 2b45e8
kusano 2b45e8
libgoto_hpl_p.$(LIBSUFFIX) :  ../$(LIBNAME_P)
kusano 2b45e8
	rm -f $(@F)
kusano 2b45e8
	$(LD) -r  $(LDFLAGS) -o goto.$(PSUFFIX)  --whole-archive $< --no-whole-archive
kusano 2b45e8
	$(AR) cq $(@F) goto.$(PSUFFIX)
kusano 2b45e8
	$(RANLIB) libgoto_hpl_p.$(LIBSUFFIX)
kusano 2b45e8
kusano 2b45e8
libgoto_hpl.dll : libgoto_hpl.$(LIBSUFFIX) dllinit.$(SUFFIX) libgoto_hpl.def
kusano 2b45e8
	$(DLLWRAP) -o $(@F) --def libgoto_hpl.def --entry _dllinit -s dllinit.$(SUFFIX) --dllname libgoto_hpl.dll libgoto_hpl.$(LIBSUFFIX)
kusano 2b45e8
	lib /machine:X64 /def:libgoto_hpl.def
kusano 2b45e8
kusano 2b45e8
dyn : $(LIBDYNNAME)
kusano 2b45e8
kusano 2b45e8
zip : dll
kusano 2b45e8
	zip $(LIBZIPNAME) $(LIBDLLNAME) $(LIBNAME)
kusano 2b45e8
kusano 2b45e8
dll  : ../$(LIBDLLNAME)
kusano 2b45e8
#libgoto2.dll
kusano 2b45e8
kusano 2b45e8
dll2 : libgoto2_shared.dll
kusano 2b45e8
kusano 2b45e8
../$(LIBDLLNAME) : ../$(LIBNAME) libopenblas.def dllinit.$(SUFFIX)
kusano 2b45e8
	$(RANLIB) ../$(LIBNAME)
kusano 2b45e8
ifeq ($(BINARY32), 1)
kusano 2b45e8
	$(DLLWRAP) -o ../$(LIBDLLNAME) --def libopenblas.def \
kusano 2b45e8
	--entry _dllinit@12 -s dllinit.$(SUFFIX) --dllname $(@F) ../$(LIBNAME) $(FEXTRALIB)
kusano 2b45e8
	-lib /machine:i386 /def:libopenblas.def
kusano 2b45e8
else
kusano 2b45e8
	$(DLLWRAP) -o ../$(LIBDLLNAME) --def libopenblas.def \
kusano 2b45e8
	--entry $(FU)dllinit    -s dllinit.$(SUFFIX) --dllname $(@F) ../$(LIBNAME) $(FEXTRALIB)
kusano 2b45e8
	-lib /machine:X64 /def:libopenblas.def 
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
libgoto2_shared.dll : ../$(LIBNAME) libgoto2_shared.def
kusano 2b45e8
	$(CC) $(CFLAGS) libgoto2_shared.def -shared -o $(@F) \
kusano 2b45e8
	-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \
kusano 2b45e8
	-Wl,--out-implib,libgoto2_shared.lib $(FEXTRALIB)
kusano 2b45e8
kusano 2b45e8
libopenblas.def : gensymbol
kusano 2b45e8
	perl ./gensymbol win2k    $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
libgoto2_shared.def : gensymbol
kusano 2b45e8
	perl ./gensymbol win2k    $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
libgoto_hpl.def : gensymbol
kusano 2b45e8
	perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
$(LIBDYNNAME) : ../$(LIBNAME) osx.def
kusano 2b45e8
	$(CC) $(CFLAGS) -all_load -headerpad_max_install_names -install_name $(CURDIR)/../$(LIBDYNNAME) -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def  $(FEXTRALIB)
kusano 2b45e8
kusano 2b45e8
symbol.$(SUFFIX) : symbol.S
kusano 2b45e8
	$(CC) $(CFLAGS) -c -o $(@F) $^
kusano 2b45e8
kusano 2b45e8
dllinit.$(SUFFIX) : dllinit.c
kusano 2b45e8
	$(CC) $(CFLAGS) -c -o $(@F) -s $<
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), Linux)
kusano 2b45e8
kusano 2b45e8
so : ../$(LIBSONAME)
kusano 2b45e8
kusano 2b45e8
../$(LIBSONAME) : ../$(LIBNAME) linux.def linktest.c
kusano 2b45e8
	$(CC) $(CFLAGS) -shared -o ../$(LIBSONAME) \
kusano 2b45e8
	-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \
kusano 2b45e8
	-Wl,--retain-symbols-file=linux.def -Wl,-soname,$(LIBPREFIX).so.$(MAJOR_VERSION) $(EXTRALIB)
kusano 2b45e8
	$(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
kusano 2b45e8
	rm -f linktest
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), FreeBSD)
kusano 2b45e8
kusano 2b45e8
so : ../$(LIBSONAME)
kusano 2b45e8
kusano 2b45e8
../$(LIBSONAME) : ../$(LIBNAME) linux.def linktest.c
kusano 2b45e8
	$(CC) $(CFLAGS)  -shared -o ../$(LIBSONAME) \
kusano 2b45e8
	-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \
kusano 2b45e8
	-Wl,--retain-symbols-file=linux.def $(EXTRALIB)
kusano 2b45e8
	$(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
kusano 2b45e8
	rm -f linktest
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), OSF1)
kusano 2b45e8
kusano 2b45e8
so : ../$(LIBSONAME)
kusano 2b45e8
kusano 2b45e8
../$(LIBSONAME) :
kusano 2b45e8
	$(CC) -shared -o ../$(LIBSONAME) ../$(LIBNAME)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), SunOS)
kusano 2b45e8
kusano 2b45e8
so : ../$(LIBSONAME)
kusano 2b45e8
	$(CC) $(CFLAGS)  -shared -o ../$(LIBSONAME) \
kusano 2b45e8
	-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(EXTRALIB)
kusano 2b45e8
	$(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
kusano 2b45e8
	rm -f linktest
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), AIX)
kusano 2b45e8
kusano 2b45e8
ifeq ($(COMPILER_F77), xlf)
kusano 2b45e8
kusano 2b45e8
goto32.$(SUFFIX) : ../$(LIBNAME) aix.def
kusano 2b45e8
	ld -o $(@F) ../$(LIBNAME) -bE:aix.def -bM:SRE -bnoexpall -bnoentry -L$(HOME)/misc/lib -lxlf90 -lc -lm  -lpthread
kusano 2b45e8
kusano 2b45e8
goto64.$(SUFFIX) : ../$(LIBNAME) aix.def
kusano 2b45e8
	ld -b64 -o $(@F) ../$(LIBNAME) -bE:aix.def -bM:SRE -bnoexpall -bnoentry -L$(HOME)/misc/lib/ppc64 -lxlf90 -lc -lm -lpthread
kusano 2b45e8
else
kusano 2b45e8
goto32.$(SUFFIX) : ../$(LIBNAME) aix.def
kusano 2b45e8
	ld -o $(@F) ../$(LIBNAME) -bE:aix.def -bM:SRE -bnoexpall -bnoentry -L$(HOME)/misc/lib -lg2c -lc -lm 
kusano 2b45e8
kusano 2b45e8
goto64.$(SUFFIX) : ../$(LIBNAME) aix.def
kusano 2b45e8
	ld -b64 -o $(@F) ../$(LIBNAME) -bE:aix.def -bM:SRE -bnoexpall -bnoentry -L$(HOME)/misc/lib/ppc64 -lg2c -lc -lm 
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
static : ../$(LIBNAME)
kusano 2b45e8
	$(LD) $(LDFLAGS) -r -o goto.$(SUFFIX) \
kusano 2b45e8
	--whole-archive ../$(LIBNAME) --no-whole-archive
kusano 2b45e8
	rm -f ../$(LIBNAME)
kusano 2b45e8
	$(AR) -cq ../$(LIBNAME) goto.$(SUFFIX)
kusano 2b45e8
	rm -f goto.$(SUFFIX)
kusano 2b45e8
kusano 2b45e8
linux.def : gensymbol ../Makefile.system ../getarch.c
kusano 2b45e8
	perl ./gensymbol linux $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS)  $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
osx.def : gensymbol ../Makefile.system ../getarch.c
kusano 2b45e8
	perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS)  $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
aix.def : gensymbol ../Makefile.system ../getarch.c
kusano 2b45e8
	perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS)  $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
kusano 2b45e8
kusano 2b45e8
symbol.S : gensymbol
kusano 2b45e8
	perl ./gensymbol win2kasm noarch dummy $(EXPRECISION) $(NO_CBLAS)  $(NO_LAPACK) $(NO_LAPACKE) > symbol.S
kusano 2b45e8
kusano 2b45e8
test : linktest.c
kusano 2b45e8
	$(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) -lm && echo OK.
kusano 2b45e8
	rm -f linktest
kusano 2b45e8
kusano 2b45e8
linktest.c : gensymbol ../Makefile.system ../getarch.c
kusano 2b45e8
	perl ./gensymbol linktest  $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > linktest.c
kusano 2b45e8
kusano 2b45e8
clean ::
kusano 2b45e8
	@rm -f *.def *.dylib __.SYMDEF*
kusano 2b45e8
kusano 2b45e8
include ../Makefile.tail
kusano 2b45e8
kusano 2b45e8