029502
OBJCOPY = objcopy
029502
029502
ifndef SYMBOLSUFFIX
029502
SYMBOLSUFFIX =
029502
endif
029502
029502
clean:
029502
	rm -f *.o libcblas.a libcblas.so*
029502
029502
ERRHAND= cblas_globals.o cblas_xerbla.o xerbla.o
029502
029502
SLEV1= cblas_srotg.o cblas_srotmg.o cblas_srot.o cblas_srotm.o \
029502
       cblas_sswap.o cblas_sscal.o  cblas_scopy.o cblas_saxpy.o \
029502
       cblas_sdot.o  cblas_sdsdot.o cblas_snrm2.o cblas_sasum.o \
029502
       cblas_isamax.o sdotsub.o sdsdotsub.o snrm2sub.o sasumsub.o \
029502
       isamaxsub.o
029502
029502
DLEV1= cblas_drotg.o cblas_drotmg.o cblas_drot.o cblas_drotm.o \
029502
       cblas_dswap.o cblas_dscal.o  cblas_dcopy.o cblas_daxpy.o \
029502
       cblas_ddot.o  cblas_dsdot.o cblas_dnrm2.o cblas_dasum.o \
029502
       cblas_idamax.o ddotsub.f dsdotsub.o dnrm2sub.o \
029502
       dasumsub.o idamaxsub.o
029502
029502
CLEV1= cblas_cswap.o cblas_cscal.o cblas_csscal.o cblas_ccopy.o \
029502
       cblas_caxpy.o cblas_cdotu_sub.o cblas_cdotc_sub.o \
029502
       cblas_icamax.o cdotcsub.o cdotusub.o icamaxsub.o
029502
029502
ZLEV1= cblas_zswap.o cblas_zscal.o cblas_zdscal.o cblas_zcopy.o \
029502
       cblas_zaxpy.o cblas_zdotu_sub.o cblas_zdotc_sub.o cblas_dznrm2.o \
029502
       cblas_dzasum.o cblas_izamax.o zdotcsub.o zdotusub.o \
029502
       dzasumsub.o dznrm2sub.o izamaxsub.o
029502
029502
SCLEV1= cblas_scasum.o scasumsub.o cblas_scnrm2.o scnrm2sub.o
029502
029502
SLEV2= cblas_sgemv.o cblas_sgbmv.o cblas_sger.o  cblas_ssbmv.o cblas_sspmv.o \
029502
       cblas_sspr.o  cblas_sspr2.o cblas_ssymv.o cblas_ssyr.o  cblas_ssyr2.o \
029502
       cblas_stbmv.o cblas_stbsv.o cblas_stpmv.o cblas_stpsv.o cblas_strmv.o \
029502
       cblas_strsv.o
029502
029502
DLEV2= cblas_dgemv.o cblas_dgbmv.o cblas_dger.o  cblas_dsbmv.o cblas_dspmv.o \
029502
       cblas_dspr.o  cblas_dspr2.o cblas_dsymv.o cblas_dsyr.o  cblas_dsyr2.o \
029502
       cblas_dtbmv.o cblas_dtbsv.o cblas_dtpmv.o cblas_dtpsv.o cblas_dtrmv.o \
029502
       cblas_dtrsv.o
029502
029502
CLEV2= cblas_cgemv.o cblas_cgbmv.o cblas_chemv.o cblas_chbmv.o cblas_chpmv.o \
029502
        cblas_ctrmv.o cblas_ctbmv.o cblas_ctpmv.o cblas_ctrsv.o cblas_ctbsv.o \
029502
        cblas_ctpsv.o cblas_cgeru.o cblas_cgerc.o cblas_cher.o  cblas_cher2.o \
029502
        cblas_chpr.o  cblas_chpr2.o
029502
029502
ZLEV2= cblas_zgemv.o cblas_zgbmv.o cblas_zhemv.o cblas_zhbmv.o cblas_zhpmv.o \
029502
       cblas_ztrmv.o cblas_ztbmv.o cblas_ztpmv.o cblas_ztrsv.o cblas_ztbsv.o \
029502
       cblas_ztpsv.o cblas_zgeru.o cblas_zgerc.o cblas_zher.o  cblas_zher2.o \
029502
       cblas_zhpr.o  cblas_zhpr2.o
029502
029502
SLEV3= cblas_sgemm.o cblas_ssymm.o cblas_ssyrk.o cblas_ssyr2k.o cblas_strmm.o \
029502
       cblas_strsm.o
029502
029502
DLEV3= cblas_dgemm.o cblas_dsymm.o cblas_dsyrk.o cblas_dsyr2k.o cblas_dtrmm.o \
029502
       cblas_dtrsm.o
029502
029502
CLEV3= cblas_cgemm.o cblas_csymm.o cblas_chemm.o cblas_cherk.o \
029502
       cblas_cher2k.o cblas_ctrmm.o cblas_ctrsm.o cblas_csyrk.o \
029502
       cblas_csyr2k.o
029502
029502
ZLEV3= cblas_zgemm.o cblas_zsymm.o cblas_zhemm.o cblas_zherk.o \
029502
       cblas_zher2k.o cblas_ztrmm.o cblas_ztrsm.o cblas_zsyrk.o \
029502
       cblas_zsyr2k.o
029502
029502
OBJS= $(SLEV1) $(DLEV1) $(CLEV1) $(ZLEV1) $(SCLEV1) $(SLEV2) $(DLEV2) $(CLEV2) \
029502
      $(ZLEV2) $(SLEV3) $(DLEV3) $(CLEV3) $(ZLEV3) $(ERRHAND)
029502
029502
static: $(OBJS)
029502
ifeq "$(SYMBOLSUFFIX)" ""
029502
	ar ruv libcblas.a $(OBJS)
029502
	ranlib libcblas.a
029502
else
029502
	ar ruv libcblas$(SYMBOLSUFFIX).a $(OBJS)
029502
	ranlib libcblas$(SYMBOLSUFFIX).a
029502
	for i in `nm libcblas$(SYMBOLSUFFIX).a |grep " T " | awk '{print $$3}'`; do echo "$$i" "64_$$i"; done > cblas-static-prefix.def.dirty
029502
	sort -n cblas-static-prefix.def.dirty | uniq > cblas-static-prefix.def
029502
	$(OBJCOPY) --redefine-syms cblas-static-prefix.def libcblas$(SYMBOLSUFFIX).a libcblas$(SYMBOLSUFFIX).a.fixed
029502
	rm -rf libcblas$(SYMBOLSUFFIX).a
029502
	mv libcblas$(SYMBOLSUFFIX).a.fixed libcblas$(SYMBOLSUFFIX).a
029502
endif
029502
029502
shared: $(OBJS)
029502
ifeq "$(SYMBOLSUFFIX)" ""
029502
	# No renaming needed
029502
	cc $(CFLAGS) -shared -Wl,-soname,libcblas.so.@SHORTVER@ -o libcblas.so.@LONGVER@ $(OBJS) $(LDFLAGS) -L../../ -lblas -lm -lgfortran -lc
029502
else
029502
	cc $(CFLAGS) -shared -Wl,-soname,libcblas$(SYMBOLSUFFIX).so.@SHORTVER@ -o libcblas$(SYMBOLSUFFIX).so.@LONGVER@ $(OBJS) $(LDFLAGS) -L../.. -lblas -lm -lgfortran -lc
029502
	# generate a list of all symbols in shared library and rename with SYMBOLSUFFIX
029502
	for i in `readelf -Ws libcblas$(SYMBOLSUFFIX).so.@LONGVER@ | awk '{print $$8}' | grep -v GLIBC |grep -v GFORTRAN |grep -v "Name" `; do echo "$$i" "64_$$i"; done > cblas-prefix.def.dirty
029502
	sort -n cblas-prefix.def.dirty | uniq > cblas-prefix.def
029502
	$(OBJCOPY) --redefine-syms cblas-prefix.def libcblas$(SYMBOLSUFFIX).so.@LONGVER@ libcblas$(SYMBOLSUFFIX).so.@LONGVER@.fixed
029502
	rm -rf libcblas$(SYMBOLSUFFIX).so.@LONGVER@
029502
	mv libcblas$(SYMBOLSUFFIX).so.@LONGVER@.fixed libcblas$(SYMBOLSUFFIX).so.@LONGVER@
029502
endif
029502