1# Example config.mk
2#
3# Copyright (c) 2018-2023, Arm Limited.
4# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
5
6# Subprojects to build
7SUBS = math string networking
8
9# Subsubprojects to build if subproject pl is built
10PLSUBS = math
11
12# Target architecture: aarch64, arm or x86_64
13ARCH = aarch64
14
15# Use for cross compilation with gcc.
16#CROSS_COMPILE = aarch64-none-linux-gnu-
17
18# Compiler for the target
19CC = $(CROSS_COMPILE)gcc
20CFLAGS = -std=c99 -pipe -O3
21CFLAGS += -Wall -Wno-missing-braces
22CFLAGS += -Werror=implicit-function-declaration
23
24# Used for test case generator that is executed on the host
25HOST_CC = gcc
26HOST_CFLAGS = -std=c99 -O2
27HOST_CFLAGS += -Wall -Wno-unused-function
28
29# Enable debug info.
30HOST_CFLAGS += -g
31CFLAGS += -g
32
33# Optimize the shared libraries on aarch64 assuming they fit in 1M.
34#CFLAGS_SHARED = -fPIC -mcmodel=tiny
35
36# Enable MTE support.
37#CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1
38
39# Use with cross testing.
40#EMULATOR = qemu-aarch64-static
41#EMULATOR = sh -c 'scp $$1 user@host:/dir && ssh user@host /dir/"$$@"' --
42
43# Additional flags for subprojects.
44math-cflags =
45math-ldlibs =
46math-ulpflags =
47math-testflags =
48string-cflags =
49networking-cflags =
50
51# Use if mpfr is available on the target for ulp error checking.
52#math-ldlibs += -lmpfr -lgmp
53#math-cflags += -DUSE_MPFR
54
55# Use with gcc.
56math-cflags += -frounding-math -fexcess-precision=standard -fno-stack-protector
57math-cflags += -ffp-contract=fast -fno-math-errno
58
59# Use with clang.
60#math-cflags += -ffp-contract=fast
61
62# Disable/enable SVE vector math code and tests.
63# If WANT_SVE_MATH is enabled, math-sve-cflags is added for SVE
64# routines only so that SVE code does not leak into scalar
65# routines. It is also necessary to add it for tools (e.g. ulp,
66# mathbench)
67WANT_SVE_MATH = 0
68ifeq ($(WANT_SVE_MATH), 1)
69  math-sve-cflags = -march=armv8-a+sve
70endif
71math-cflags += -DWANT_SVE_MATH=$(WANT_SVE_MATH)
72
73# If defined to 1, set errno in math functions according to ISO C.  Many math
74# libraries do not set errno, so this is 0 by default.  It may need to be
75# set to 1 if math.h has (math_errhandling & MATH_ERRNO) != 0.
76WANT_ERRNO = 0
77math-cflags += -DWANT_ERRNO=$(WANT_ERRNO)
78
79# If set to 1, set fenv in vector math routines.
80WANT_SIMD_EXCEPT = 0
81math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT)
82
83# Disable fenv checks
84#math-ulpflags = -q -f
85#math-testflags = -nostatus
86
87# Remove GNU Property Notes from asm files.
88#string-cflags += -DWANT_GNU_PROPERTY=0
89
90# Enable assertion checks.
91#networking-cflags += -DWANT_ASSERT
92
93# Avoid auto-vectorization of scalar code and unroll loops
94networking-cflags += -O2 -fno-tree-vectorize -funroll-loops
95