forked from ARM-software/optimized-routines
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.mk.dist
More file actions
174 lines (148 loc) · 5.04 KB
/
config.mk.dist
File metadata and controls
174 lines (148 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Example config.mk
#
# Copyright (c) 2018-2025, Arm Limited.
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
# Subprojects to build
SUBS = math string networking
# Target architecture: aarch64, arm or x86_64
ARCH = aarch64
# Use for cross compilation with gcc.
#CROSS_COMPILE = aarch64-none-linux-gnu-
# Compiler for the target
CC ?= $(CROSS_COMPILE)gcc
CFLAGS = -std=c99 -pipe -O3
CFLAGS += -Wall -Wno-missing-braces
CFLAGS += -Werror=implicit-function-declaration
# Used for test case generator that is executed on the host
HOST_CC ?= gcc
HOST_CFLAGS = -std=c99 -O2
HOST_CFLAGS += -Wall -Wno-unused-function
# Enable debug info.
HOST_CFLAGS += -g
CFLAGS += -g
ifeq ($(OS),Msys)
# llvm is the only available/valid native compiler
CC = clang
AR = llvm-ar
RANLIB = llvm-ranlib
HOST_CC = clang
SYSROOT = /c/wenv/msys2/msys64/clangarm64
# Common windows flags
COMMON_WIN_CFLAGS = -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
COMMON_WIN_CFLAGS += -Wno-deprecated-declarations -Wno-unused-variable
# For mathtest
HOST_CFLAGS += -I$(SYSROOT)/include
HOST_CFLAGS += $(COMMON_WIN_CFLAGS) -Wno-ignored-attributes
# Clear the default flag -fPIC, as not supported on Windows
CFLAGS_SHARED =
# For ulp.h with MPFR
CFLAGS += -I$(SYSROOT)/include
# For clang on Windows
CFLAGS += $(COMMON_WIN_CFLAGS)
endif
# Optimize the shared libraries on aarch64 assuming they fit in 1M.
#CFLAGS_SHARED = -fPIC -mcmodel=tiny
# Enable MTE support.
#CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1
# Use with cross testing.
EMULATOR ?=
#EMULATOR = qemu-aarch64-static
#EMULATOR = sh -c 'scp $$1 user@host:/dir && ssh user@host /dir/"$$@"' --
# Additional flags for subprojects.
math-cflags =
math-ldlibs =
math-ulpflags =
math-testflags =
string-cflags = -falign-functions=64
networking-cflags =
ifneq (,$(filter $(OS),Msys Mingw64))
# Libraries can be installed with pacman
libm-libs = -lmsvcrt -lvcruntime -lucrt
libc-libs =
# Linker will look for .lib but some systems only have .dll.a,
# therefore we have to give absolute path to libraries.
# This is system dependent and might need adjusting.
mpfr-libs = $(SYSROOT)/lib/libmpfr.dll.a
gmp-libs = $(SYSROOT)/lib/libgmp.dll.a
mpc-libs = $(SYSROOT)/lib/libmpc.dll.a
# TEST_BIN_FLAGS =
# Clear the default flag -fPIC, as not supported on Windows
CFLAGS_SHARED =
USE_GLIBC_ABI = 0
ifneq ($(ARCH),aarch64)
EMULATOR = "qemu-aarch64-static"
endif
endif
# For Apple Silicon update the paths
ifeq ($(OS),Darwin)
ifeq ($(ARCH),aarch64)
math-cflags += -I/opt/homebrew/include
math-ldlibs += -L/opt/homebrew/lib
HOST_CFLAGS += -I/opt/homebrew/include
HOST_LDFLAGS += -L/opt/homebrew/lib
TEST_BIN_FLAGS =
WANT_EXPERIMENTAL_MATH = 1
WANT_SVE_TESTS = 0
USE_GLIBC_ABI = 0
WANT_EXP10_TESTS = 0
USE_MPFR = 1
math-ulpflags = -q -f
endif
endif
# Use if mpfr is available on the target for ulp error checking.
USE_MPFR?=0
math-cflags += -DUSE_MPFR=$(USE_MPFR)
ifeq ($(USE_MPFR), 1)
math-ldlibs += $(mpfr-libs) $(gmp-libs)
math-ulpflags += -m -q
# Disable fenv checks is recommended when using MPFR.
math-ulpflags += -f
math-testflags += -nostatus
endif
# Use with gcc or llvm.
math-cflags += -frounding-math -fexcess-precision=standard -fno-stack-protector
math-cflags += -ffp-contract=fast -fno-math-errno
# If defined to 1, set errno in math functions according to ISO C. Many math
# libraries do not set errno, so this is 0 by default. It may need to be
# set to 1 if math.h has (math_errhandling & MATH_ERRNO) != 0.
WANT_ERRNO = 0
math-cflags += -DWANT_ERRNO=$(WANT_ERRNO)
# Disable/enable SVE vector math tests/tools.
ifeq ($(ARCH),aarch64)
WANT_SVE_TESTS ?= 1
else
WANT_SVE_TESTS ?= 0
endif
math-cflags += -DWANT_SVE_TESTS=$(WANT_SVE_TESTS)
# If set to 1, set fenv in vector math routines.
WANT_SIMD_EXCEPT ?= 0
math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT)
# If set to 1, enable tests for exp10.
WANT_EXP10_TESTS ?= 1
math-cflags += -DWANT_EXP10_TESTS=$(WANT_EXP10_TESTS)
# If set to 1, enable tests for C23 routines.
# These functions are only supported on aarch64
ifeq ($(ARCH),aarch64)
WANT_C23_TESTS = 1
else
WANT_C23_TESTS = 0
endif
math-cflags += -DWANT_C23_TESTS=$(WANT_C23_TESTS)
# Remove GNU Property Notes from asm files.
#string-cflags += -DWANT_GNU_PROPERTY=0
# Enable assertion checks.
#networking-cflags += -DWANT_ASSERT
# Avoid auto-vectorization of scalar code and unroll loops
networking-cflags += -O2 -fno-tree-vectorize -funroll-loops
# Provide *_finite symbols and some of the glibc hidden symbols
# so libmathlib can be used with binaries compiled against glibc
# to interpose math functions with both static and dynamic linking
USE_GLIBC_ABI ?= 1
math-cflags += -DUSE_GLIBC_ABI=$(USE_GLIBC_ABI)
# Enable experimental math routines - non-C23 vector math and low-accuracy scalar
WANT_EXPERIMENTAL_MATH ?= 0
math-cflags += -DWANT_EXPERIMENTAL_MATH=$(WANT_EXPERIMENTAL_MATH)
# If you add 'fp' to the SUBS list above, you must also define this to
# one of the subdirectories of 'fp', to indicate which set of
# arithmetic functions to build.
FP_SUBDIR = none