2012-10-29 10:30:54 +01:00
|
|
|
# -*- mode: makefile-gmake -*-
|
|
|
|
|
2017-01-15 22:21:46 +01:00
|
|
|
# Default build rule for any Makefile in this project: all
|
|
|
|
default: all
|
|
|
|
|
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
|
2018-06-18 22:06:34 +02:00
|
|
|
VERSION = 0.6.0
|
2015-02-12 15:30:17 +01:00
|
|
|
SOMAJOR = 2
|
2018-05-26 11:36:57 +02:00
|
|
|
SOMINOR = 5
|
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)
|
2017-01-15 22:21:46 +01:00
|
|
|
pkgconfigdir = $(prefix)/libdata/pkgconfig
|
2016-01-19 13:45:54 +01:00
|
|
|
else
|
2017-01-15 22:21:46 +01:00
|
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
2016-01-19 13:45:54 +01:00
|
|
|
endif
|
|
|
|
|
2012-07-03 13:19:19 +02:00
|
|
|
USEGCC = 1
|
|
|
|
USECLANG = 0
|
|
|
|
|
2018-04-06 23:04:45 +02:00
|
|
|
ifneq (,$(findstring $(OS),Darwin FreeBSD OpenBSD))
|
2015-01-11 23:50:17 +01:00
|
|
|
USEGCC = 0
|
|
|
|
USECLANG = 1
|
|
|
|
endif
|
|
|
|
|
2017-12-21 21:35:54 +01:00
|
|
|
AR = $(TOOLPREFIX)ar
|
2012-10-31 22:33:04 +01:00
|
|
|
|
2012-07-03 13:19:19 +02:00
|
|
|
ifeq ($(USECLANG),1)
|
|
|
|
USEGCC = 0
|
|
|
|
CC = clang
|
2017-09-22 22:24:07 +02:00
|
|
|
CFLAGS_add += -fno-builtin -fno-strict-aliasing
|
2012-07-03 13:19:19 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(USEGCC),1)
|
2017-12-21 21:35:54 +01:00
|
|
|
CC = $(TOOLPREFIX)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/")
|
|
|
|
|
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
|
|
|
|
2011-12-31 08:18:43 +01:00
|
|
|
# OS-specific stuff
|
2015-02-27 19:48:11 +01:00
|
|
|
ifeq ($(findstring arm,$(ARCH)),arm)
|
|
|
|
override ARCH := arm
|
2017-01-15 22:21:46 +01:00
|
|
|
MARCH ?= armv7-a
|
|
|
|
CFLAGS_add += -mhard-float
|
2016-04-08 19:37:13 +02:00
|
|
|
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
|
2017-01-15 22:21:46 +01:00
|
|
|
ifneq ($(filter $(ARCH),i386 i486 i586 i686 i387 i487 i587 i687),)
|
2013-05-28 15:30:36 +02:00
|
|
|
override ARCH := i387
|
2017-01-15 22:21:46 +01:00
|
|
|
MARCH ?= i686
|
2012-05-25 22:24:37 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),x86_64)
|
2013-05-28 15:30:36 +02:00
|
|
|
override ARCH := amd64
|
2014-12-04 19:02:39 +01:00
|
|
|
endif
|
2017-01-24 17:19:33 +01:00
|
|
|
ifeq ($(findstring mips,$(ARCH)),mips)
|
|
|
|
override ARCH := mips
|
|
|
|
endif
|
2012-04-09 02:03:36 +02:00
|
|
|
|
2016-08-09 02:24:07 +02:00
|
|
|
# If CFLAGS does not contain a -O optimization flag, default to -O3
|
|
|
|
ifeq ($(findstring -O,$(CFLAGS)),)
|
|
|
|
CFLAGS_add += -O3
|
|
|
|
endif
|
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
|
2015-10-27 08:32:56 +01:00
|
|
|
ifeq ($(OS), WINNT)
|
2017-01-15 22:21:46 +01:00
|
|
|
SHLIB_EXT = dll
|
|
|
|
SONAME_FLAG = -soname
|
|
|
|
CFLAGS_add += -nodefaultlibs
|
|
|
|
shlibdir = $(bindir)
|
2016-01-19 13:45:54 +01:00
|
|
|
else
|
2017-01-15 22:21:46 +01:00
|
|
|
ifeq ($(OS), Darwin)
|
|
|
|
SHLIB_EXT = dylib
|
|
|
|
SONAME_FLAG = -install_name
|
2015-02-27 19:48:11 +01:00
|
|
|
else
|
2017-01-15 22:21:46 +01:00
|
|
|
SHLIB_EXT = so
|
|
|
|
SONAME_FLAG = -soname
|
|
|
|
endif
|
|
|
|
CFLAGS_add += -fPIC
|
|
|
|
shlibdir = $(libdir)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Add `-march` to our CFLAGS if it's defined
|
|
|
|
ifneq ($(MARCH),)
|
|
|
|
CFLAGS_arch += -march=$(MARCH)
|
|
|
|
endif
|
|
|
|
|
2015-02-27 19:48:11 +01:00
|
|
|
ifeq ($(ARCH),i387)
|
2017-01-15 22:21:46 +01:00
|
|
|
CFLAGS_arch += -m32
|
|
|
|
SFLAGS_arch += -m32
|
|
|
|
LDFLAGS_arch += -m32
|
2015-02-27 19:48:11 +01:00
|
|
|
endif
|
2017-01-15 22:21:46 +01:00
|
|
|
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
CFLAGS_arch += -m64
|
|
|
|
SFLAGS_arch += -m64
|
|
|
|
LDFLAGS_arch += -m64
|
2015-02-27 19:48:11 +01:00
|
|
|
endif
|
2017-01-15 22:21:46 +01:00
|
|
|
|
|
|
|
# Add our "arch"-related FLAGS in. We separate arch-related flags out so that
|
|
|
|
# we can conveniently get at them for targets that don't want the rest of
|
|
|
|
# *FLAGS_add, such as the testing Makefile targets
|
|
|
|
CFLAGS_add += $(CFLAGS_arch)
|
|
|
|
SFLAGS_add += $(SFLAGS_arch)
|
|
|
|
LDFLAGS_add += $(LDFLAGS_arch)
|
|
|
|
|
|
|
|
CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
|
2017-10-21 15:50:50 +02:00
|
|
|
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
|
2017-01-15 22:21:46 +01:00
|
|
|
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80
|
2017-10-21 15:50:50 +02:00
|
|
|
else
|
|
|
|
ifneq ($(filter $(ARCH),aarch64),)
|
|
|
|
CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
|
|
|
|
endif
|
2015-02-27 19:48:11 +01:00
|
|
|
endif
|
|
|
|
|
2017-01-15 22:21:46 +01:00
|
|
|
|
|
|
|
%.c.o: %.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add) -c $< -o $@
|
|
|
|
|
|
|
|
%.S.o: %.S
|
|
|
|
$(CC) $(CPPFLAGS) $(SFLAGS) $(SFLAGS_add) $(filter -m% -B% -I% -D%,$(CFLAGS_add)) -c $< -o $@
|
|
|
|
|
|
|
|
|
|
|
|
# Makefile debugging trick:
|
|
|
|
# call print-VARIABLE to see the runtime value of any variable
|
|
|
|
print-%:
|
|
|
|
@echo '$*=$($*)'
|