| @@ -85,7 +85,7 @@ endif | |||||
| shared : | shared : | ||||
| ifndef NO_SHARED | ifndef NO_SHARED | ||||
| ifeq ($(OSNAME), Linux) | |||||
| ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) | |||||
| @$(MAKE) -C exports so | @$(MAKE) -C exports so | ||||
| @-ln -fs $(LIBSONAME) $(LIBPREFIX).so | @-ln -fs $(LIBSONAME) $(LIBPREFIX).so | ||||
| @-ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION) | @-ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION) | ||||
| @@ -29,7 +29,7 @@ install : lib.grd | |||||
| #for inc | #for inc | ||||
| @echo \#ifndef OPENBLAS_CONFIG_H > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | @echo \#ifndef OPENBLAS_CONFIG_H > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | ||||
| @echo \#define OPENBLAS_CONFIG_H >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | @echo \#define OPENBLAS_CONFIG_H >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | ||||
| @awk 'NF {print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | |||||
| @$(AWK) 'NF {print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | |||||
| @echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | @echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | ||||
| @cat openblas_config_template.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | @cat openblas_config_template.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | ||||
| @echo \#endif \/\* OPENBLAS_CONFIG_H \*\/ >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | @echo \#endif \/\* OPENBLAS_CONFIG_H \*\/ >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h | ||||
| @@ -64,7 +64,7 @@ endif | |||||
| #for install shared library | #for install shared library | ||||
| ifndef NO_SHARED | ifndef NO_SHARED | ||||
| @echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) | @echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) | ||||
| ifeq ($(OSNAME), Linux) | |||||
| ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) | |||||
| @install -pm755 $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) | @install -pm755 $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) | ||||
| @cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \ | @cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \ | ||||
| ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \ | ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \ | ||||
| @@ -967,7 +967,7 @@ ifndef MD5SUM | |||||
| MD5SUM = md5sum | MD5SUM = md5sum | ||||
| endif | endif | ||||
| AWK = awk | |||||
| AWK = nawk | |||||
| REVISION = -r$(VERSION) | REVISION = -r$(VERSION) | ||||
| MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION))) | MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION))) | ||||
| @@ -70,7 +70,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| /*********************************************************************/ | /*********************************************************************/ | ||||
| #include "common.h" | #include "common.h" | ||||
| #if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) | |||||
| #if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) || defined(OS_SUNOS) | |||||
| #include <dlfcn.h> | #include <dlfcn.h> | ||||
| #include <signal.h> | #include <signal.h> | ||||
| #include <sys/resource.h> | #include <sys/resource.h> | ||||
| @@ -576,10 +576,12 @@ int blas_thread_init(void){ | |||||
| struct rlimit rlim; | struct rlimit rlim; | ||||
| const char *msg = strerror(ret); | const char *msg = strerror(ret); | ||||
| fprintf(STDERR, "OpenBLAS blas_thread_init: pthread_create: %s\n", msg); | fprintf(STDERR, "OpenBLAS blas_thread_init: pthread_create: %s\n", msg); | ||||
| #ifdef RLIMIT_NPROC | |||||
| if(0 == getrlimit(RLIMIT_NPROC, &rlim)) { | if(0 == getrlimit(RLIMIT_NPROC, &rlim)) { | ||||
| fprintf(STDERR, "OpenBLAS blas_thread_init: RLIMIT_NPROC " | fprintf(STDERR, "OpenBLAS blas_thread_init: RLIMIT_NPROC " | ||||
| "%ld current, %ld max\n", (long)(rlim.rlim_cur), (long)(rlim.rlim_max)); | "%ld current, %ld max\n", (long)(rlim.rlim_cur), (long)(rlim.rlim_max)); | ||||
| } | } | ||||
| #endif | |||||
| if(0 != raise(SIGINT)) { | if(0 != raise(SIGINT)) { | ||||
| fprintf(STDERR, "OpenBLAS blas_thread_init: calling exit(3)\n"); | fprintf(STDERR, "OpenBLAS blas_thread_init: calling exit(3)\n"); | ||||
| exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
| @@ -144,7 +144,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| #if defined(_MSC_VER) && !defined(__clang__) | #if defined(_MSC_VER) && !defined(__clang__) | ||||
| #define CONSTRUCTOR __cdecl | #define CONSTRUCTOR __cdecl | ||||
| #define DESTRUCTOR __cdecl | #define DESTRUCTOR __cdecl | ||||
| #elif defined(OS_DARWIN) && defined(C_GCC) | |||||
| #elif (defined(OS_DARWIN) || defined(OS_SUNOS)) && defined(C_GCC) | |||||
| #define CONSTRUCTOR __attribute__ ((constructor)) | #define CONSTRUCTOR __attribute__ ((constructor)) | ||||
| #define DESTRUCTOR __attribute__ ((destructor)) | #define DESTRUCTOR __attribute__ ((destructor)) | ||||
| #else | #else | ||||
| @@ -169,7 +169,7 @@ void goto_set_num_threads(int num_threads) {}; | |||||
| #else | #else | ||||
| #ifdef OS_LINUX | |||||
| #if defined(OS_LINUX) || defined(OS_SUNOS) | |||||
| #ifndef NO_AFFINITY | #ifndef NO_AFFINITY | ||||
| int get_num_procs(void); | int get_num_procs(void); | ||||
| #else | #else | ||||
| @@ -114,7 +114,7 @@ endif | |||||
| dllinit.$(SUFFIX) : dllinit.c | dllinit.$(SUFFIX) : dllinit.c | ||||
| $(CC) $(CFLAGS) -c -o $(@F) -s $< | $(CC) $(CFLAGS) -c -o $(@F) -s $< | ||||
| ifeq ($(OSNAME), Linux) | |||||
| ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) | |||||
| so : ../$(LIBSONAME) | so : ../$(LIBSONAME) | ||||
| @@ -1,5 +1,7 @@ | |||||
| #!/usr/bin/perl | #!/usr/bin/perl | ||||
| $hostos = `uname -s | sed -e s/\-.*//`; chop($hostos); | |||||
| # | # | ||||
| # 1. Not specified | # 1. Not specified | ||||
| # 1.1 Automatically detect, then check compiler | # 1.1 Automatically detect, then check compiler | ||||
| @@ -272,8 +274,9 @@ if ($link ne "") { | |||||
| } | } | ||||
| if ($flags =~ /^\-Y/) { | if ($flags =~ /^\-Y/) { | ||||
| next if ($hostos eq 'SunOS'); | |||||
| $linker_L .= "-Wl,". $flags . " "; | $linker_L .= "-Wl,". $flags . " "; | ||||
| } | |||||
| } | |||||
| if ($flags =~ /^\-rpath\@/) { | if ($flags =~ /^\-rpath\@/) { | ||||
| $flags =~ s/\@/\,/g; | $flags =~ s/\@/\,/g; | ||||
| @@ -86,7 +86,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| #include <sys/types.h> | #include <sys/types.h> | ||||
| #include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
| #endif | #endif | ||||
| #ifdef linux | |||||
| #if defined(linux) || defined(__sun__) | |||||
| #include <sys/sysinfo.h> | #include <sys/sysinfo.h> | ||||
| #include <unistd.h> | #include <unistd.h> | ||||
| #endif | #endif | ||||
| @@ -906,7 +906,7 @@ static int get_num_cores(void) { | |||||
| size_t len; | size_t len; | ||||
| #endif | #endif | ||||
| #ifdef linux | |||||
| #if defined(linux) || defined(__sun__) | |||||
| //returns the number of processors which are currently online | //returns the number of processors which are currently online | ||||
| return sysconf(_SC_NPROCESSORS_ONLN); | return sysconf(_SC_NPROCESSORS_ONLN); | ||||