2012-10-29 10:30:54 +01:00
|
|
|
# -*- mode: makefile-gmake -*-
|
|
|
|
|
2013-05-28 15:30:36 +02:00
|
|
|
OS := $(shell uname)
|
2014-07-27 09:30:14 +02:00
|
|
|
# Do not forget to bump SOMINOR when changing VERSION,
|
2014-07-29 15:46:20 +02:00
|
|
|
# and SOMAJOR when breaking ABI in a backward-incompatible way
|
2016-08-06 17:00:31 +02:00
|
|
|
VERSION = 0.5.2
|
2015-02-12 15:30:17 +01:00
|
|
|
SOMAJOR = 2
|
2016-08-06 17:00:31 +02:00
|
|
|
SOMINOR = 3
|
2014-01-04 21:37:17 +01:00
|
|
|
DESTDIR =
|
2014-01-07 21:54:15 +01:00
|
|
|
prefix = /usr/local
|
2014-04-08 17:49:38 +02:00
|
|
|
bindir = $(prefix)/bin
|
2014-01-07 21:54:15 +01:00
|
|
|
libdir = $(prefix)/lib
|
2014-01-07 21:57:50 +01:00
|
|
|
includedir = $(prefix)/include
|
2012-07-03 13:19:19 +02:00
|
|
|
|
2016-01-19 13:45:54 +01:00
|
|
|
ifeq ($(OS), FreeBSD)
|
|
|
|
pkgconfigdir = $(prefix)/libdata/pkgconfig
|
|
|
|
else
|
|
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
|
|
|
endif
|
|
|
|
|
2012-07-03 13:19:19 +02:00
|
|
|
USEGCC = 1
|
|
|
|
USECLANG = 0
|
|
|
|
|
2013-07-14 15:03:56 +02:00
|
|
|
ifeq ($(OS), Darwin)
|
|
|
|
USEGCC = 0
|
|
|
|
USECLANG = 1
|
|
|
|
endif
|
|
|
|
|
2015-01-11 23:50:17 +01:00
|
|
|
ifeq ($(OS), FreeBSD)
|
|
|
|
USEGCC = 0
|
|
|
|
USECLANG = 1
|
|
|
|
endif
|
|
|
|
|
2013-07-14 15:03:56 +02:00
|
|
|
AR = ar
|
2012-10-31 22:33:04 +01:00
|
|
|
|
2012-07-03 13:19:19 +02:00
|
|
|
ifeq ($(USECLANG),1)
|
|
|
|
USEGCC = 0
|
|
|
|
CC = clang
|
2013-03-03 01:40:38 +01:00
|
|
|
CFLAGS_add += -fno-builtin
|
2012-07-03 13:19:19 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(USEGCC),1)
|
|
|
|
CC = gcc
|
2016-02-27 19:32:49 +01:00
|
|
|
CFLAGS_add += -fno-gnu89-inline -fno-builtin
|
2012-07-03 13:19:19 +02:00
|
|
|
endif
|
2011-12-31 08:18:43 +01:00
|
|
|
|
2015-02-27 19:48:11 +01:00
|
|
|
ARCH ?= $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/")
|
|
|
|
ARCH_ORIGIN := $(origin ARCH)
|
|
|
|
|
2013-05-30 03:08:06 +02:00
|
|
|
ifeq ($(ARCH),mingw32)
|
|
|
|
$(error "the mingw32 compiler you are using fails the openblas testsuite. please see the Julia README.windows.md document for a replacement")
|
|
|
|
endif
|
2013-05-28 15:30:36 +02:00
|
|
|
|
2015-11-13 04:37:28 +01:00
|
|
|
CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/ld80 -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
|
|
|
|
|
2011-12-31 14:56:51 +01:00
|
|
|
default: all
|
|
|
|
|
2016-02-23 16:40:46 +01:00
|
|
|
# *int / *intf need to be built with -O0
|
|
|
|
src/%int.c.o: src/%int.c
|
|
|
|
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@
|
|
|
|
|
|
|
|
src/%intf.c.o: src/%intf.c
|
|
|
|
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@
|
|
|
|
|
2012-05-25 05:14:58 +02:00
|
|
|
%.c.o: %.c
|
2015-02-27 19:48:11 +01:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add) -c $< -o $@
|
2012-10-29 10:30:54 +01:00
|
|
|
|
2012-05-25 05:14:58 +02:00
|
|
|
%.S.o: %.S
|
2015-10-26 06:15:39 +01:00
|
|
|
$(CC) $(CPPFLAGS) $(SFLAGS) $(SFLAGS_add) $(filter -m% -B% -I% -D%,$(CFLAGS_add)) -c $< -o $@
|
2012-05-25 05:14:58 +02:00
|
|
|
|
2011-12-31 08:18:43 +01:00
|
|
|
# OS-specific stuff
|
2015-02-27 19:48:11 +01:00
|
|
|
REAL_ARCH := $(ARCH)
|
|
|
|
ifeq ($(findstring arm,$(ARCH)),arm)
|
|
|
|
override ARCH := arm
|
|
|
|
endif
|
2016-04-08 19:37:13 +02:00
|
|
|
ifeq ($(ARCH),aarch64)
|
|
|
|
override ARCH := arm
|
|
|
|
endif
|
2016-02-26 12:27:35 +01:00
|
|
|
ifeq ($(findstring powerpc,$(ARCH)),powerpc)
|
|
|
|
override ARCH := powerpc
|
|
|
|
endif
|
2016-02-26 17:46:17 +01:00
|
|
|
ifeq ($(findstring ppc,$(ARCH)),ppc)
|
|
|
|
override ARCH := powerpc
|
|
|
|
endif
|
2012-05-25 22:24:37 +02:00
|
|
|
ifeq ($(ARCH),i386)
|
2013-05-28 15:30:36 +02:00
|
|
|
override ARCH := i387
|
2012-05-25 22:24:37 +02:00
|
|
|
endif
|
2013-06-18 02:38:51 +02:00
|
|
|
ifeq ($(ARCH),i486)
|
|
|
|
override ARCH := i387
|
|
|
|
endif
|
2014-06-20 15:30:10 +02:00
|
|
|
ifeq ($(ARCH),i586)
|
|
|
|
override ARCH := i387
|
|
|
|
endif
|
2013-06-18 02:38:51 +02:00
|
|
|
ifeq ($(ARCH),i686)
|
|
|
|
override ARCH := i387
|
|
|
|
endif
|
2012-05-25 22:24:37 +02:00
|
|
|
|
|
|
|
ifeq ($(ARCH),x86_64)
|
2013-05-28 15:30:36 +02:00
|
|
|
override ARCH := amd64
|
2014-12-04 19:02:39 +01:00
|
|
|
endif
|
2012-04-09 02:03:36 +02:00
|
|
|
|
2016-02-23 14:56:12 +01:00
|
|
|
# The optimization flag may be overriden with the environment variable CFLAGS.
|
2016-08-06 16:49:14 +02:00
|
|
|
CFLAGS ?= -O3
|
2016-02-23 14:56:12 +01:00
|
|
|
|
2013-05-28 14:59:02 +02:00
|
|
|
ifneq (,$(findstring MINGW,$(OS)))
|
|
|
|
override OS=WINNT
|
2013-03-03 01:40:38 +01:00
|
|
|
endif
|
2014-04-08 17:49:38 +02:00
|
|
|
|
|
|
|
#keep these if statements separate
|
2011-12-31 08:18:43 +01:00
|
|
|
|
2015-10-27 08:32:56 +01:00
|
|
|
ifeq ($(OS), WINNT)
|
|
|
|
SHLIB_EXT = dll
|
|
|
|
SONAME_FLAG = -soname
|
2016-06-24 05:32:31 +02:00
|
|
|
CFLAGS_add += -nodefaultlibs
|
2015-10-27 08:32:56 +01:00
|
|
|
shlibdir = $(bindir)
|
2016-01-19 13:45:54 +01:00
|
|
|
else
|
2015-10-27 08:32:56 +01:00
|
|
|
ifeq ($(OS), Darwin)
|
|
|
|
SHLIB_EXT = dylib
|
|
|
|
SONAME_FLAG = -install_name
|
|
|
|
else
|
|
|
|
SHLIB_EXT = so
|
|
|
|
SONAME_FLAG = -soname
|
|
|
|
endif
|
2016-06-24 05:32:31 +02:00
|
|
|
CFLAGS_add += -fPIC
|
2015-10-27 08:32:56 +01:00
|
|
|
shlibdir = $(libdir)
|
2012-04-09 02:03:36 +02:00
|
|
|
endif
|
2015-02-27 19:48:11 +01:00
|
|
|
|
|
|
|
# The target specific FLAGS_add
|
|
|
|
ifeq ($(ARCH_ORIGIN),file)
|
|
|
|
CFLAGS_add_TARGET_$(ARCH) :=
|
|
|
|
SFLAGS_add_TARGET_$(ARCH) :=
|
|
|
|
LDFLAGS_add_TARGET_$(ARCH) :=
|
|
|
|
else
|
|
|
|
ifeq ($(ARCH),i387)
|
|
|
|
CFLAGS_add_TARGET_$(ARCH) := -m32 -march=$(REAL_ARCH)
|
|
|
|
SFLAGS_add_TARGET_$(ARCH) := -m32 -march=$(REAL_ARCH)
|
|
|
|
LDFLAGS_add_TARGET_$(ARCH) := -m32 -march=$(REAL_ARCH)
|
|
|
|
endif
|
|
|
|
CFLAGS_add_TARGET_x86_64 := -m64
|
|
|
|
SFLAGS_add_TARGET_x86_64 := -m64
|
|
|
|
LDFLAGS_add_TARGET_x86_64 := -m64
|
|
|
|
# Arm
|
|
|
|
ifeq ($(ARCH),arm)
|
|
|
|
ifneq ($(REAL_ARCH),arm)
|
|
|
|
CFLAGS_add_TARGET_$(ARCH) := -march=$(REAL_ARCH)
|
|
|
|
SFLAGS_add_TARGET_$(ARCH) := -march=$(REAL_ARCH)
|
|
|
|
LDFLAGS_add_TARGET_$(ARCH) := -march=$(REAL_ARCH)
|
|
|
|
else
|
|
|
|
$(error No known generic arm cflags. Please specify arch type)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Actually finish setting the FLAGS_add
|
|
|
|
CFLAGS_add += $(CFLAGS_add_TARGET_$(ARCH))
|
|
|
|
LDFLAGS_add += $(LDFLAGS_add_TARGET_$(ARCH))
|
|
|
|
SFLAGS_add += $(SFLAGS_add_TARGET_$(ARCH))
|