blob: 7a8497507a81bae26f4ba3777761b16e199507ca [file] [log] [blame]
Szabolcs Nagy78892282018-04-24 17:10:05 +01001# Example config.mk
2#
Szabolcs Nagy1eb5d7c2023-01-24 13:24:09 +00003# Copyright (c) 2018-2022, Arm Limited.
Szabolcs Nagy189dfef2022-02-10 10:32:35 +00004# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
Szabolcs Nagy78892282018-04-24 17:10:05 +01005
Szabolcs Nagy1fd2aaa2019-11-20 18:05:06 +00006# Subprojects to build
Ola Liljedahl6a988f62020-02-27 15:10:03 +01007SUBS = math string networking
Szabolcs Nagy1fd2aaa2019-11-20 18:05:06 +00008
Pierre Blanchard82c8c8a2022-03-25 15:04:38 +00009# Subsubprojects to build if subproject pl is built
10PLSUBS = math
11
Szabolcs Nagy1dfd7b82020-02-12 15:10:29 +000012# Target architecture: aarch64, arm or x86_64
13ARCH = aarch64
Szabolcs Nagya2027462018-07-27 11:14:11 +010014
Branislav Rankov4d55c2d2020-05-28 18:11:20 +010015# Use for cross compilation with gcc.
16#CROSS_COMPILE = aarch64-none-linux-gnu-
17
Szabolcs Nagy1dfd7b82020-02-12 15:10:29 +000018# Compiler for the target
Szabolcs Nagy78892282018-04-24 17:10:05 +010019CC = $(CROSS_COMPILE)gcc
20CFLAGS = -std=c99 -pipe -O3
Szabolcs Nagya2027462018-07-27 11:14:11 +010021CFLAGS += -Wall -Wno-missing-braces
Szabolcs Nagy433a3b12019-10-17 12:31:17 +010022CFLAGS += -Werror=implicit-function-declaration
Szabolcs Nagya2027462018-07-27 11:14:11 +010023
Szabolcs Nagy1dfd7b82020-02-12 15:10:29 +000024# 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
Szabolcs Nagya2027462018-07-27 11:14:11 +010029# Enable debug info.
30HOST_CFLAGS += -g
31CFLAGS += -g
Szabolcs Nagy78892282018-04-24 17:10:05 +010032
Szabolcs Nagy1e0c8022019-08-06 12:04:27 +010033# Optimize the shared libraries on aarch64 assuming they fit in 1M.
34#CFLAGS_SHARED = -fPIC -mcmodel=tiny
35
Branislav Rankov4d55c2d2020-05-28 18:11:20 +010036# Enable MTE support.
37#CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1
Szabolcs Nagy78892282018-04-24 17:10:05 +010038
39# Use with cross testing.
40#EMULATOR = qemu-aarch64-static
41#EMULATOR = sh -c 'scp $$1 user@host:/dir && ssh user@host /dir/"$$@"' --
Szabolcs Nagy1fd2aaa2019-11-20 18:05:06 +000042
43# Additional flags for subprojects.
44math-cflags =
45math-ldlibs =
46math-ulpflags =
47math-testflags =
48string-cflags =
Ola Liljedahl6a988f62020-02-27 15:10:03 +010049networking-cflags =
Szabolcs Nagy1fd2aaa2019-11-20 18:05:06 +000050
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 vector math code
63#math-cflags += -DWANT_VMATH=0
64
Pierre Blancharda790e502022-07-21 13:50:32 +010065# Disable/enable SVE vector math code and tests
66WANT_SVE_MATH = 0
67ifeq ($(WANT_SVE_MATH), 1)
68 math-cflags += -march=armv8.2-a+sve
69endif
70math-cflags += -DWANT_SVE_MATH=$(WANT_SVE_MATH)
Pierre Blanchardbc9ff562022-06-14 15:55:50 +010071
Joe Ramsay617d26f2022-11-04 13:57:18 +000072# If defined to 1, set errno in math functions according to ISO C. Many math
73# libraries do not set errno, so this is 0 by default. It may need to be
74# set to 1 if math.h has (math_errhandling & MATH_ERRNO) != 0.
75WANT_ERRNO = 0
76math-cflags += -DWANT_ERRNO=$(WANT_ERRNO)
77
Joe Ramsaya5e45e42022-12-07 15:31:03 +000078# If set to 1, set fenv in vector math routines.
79WANT_SIMD_EXCEPT = 0
80math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT)
81
Szabolcs Nagy1fd2aaa2019-11-20 18:05:06 +000082# Disable fenv checks
83#math-ulpflags = -q -f
84#math-testflags = -nostatus
Ola Liljedahl6a988f62020-02-27 15:10:03 +010085
Szabolcs Nagye1127942020-05-01 13:14:50 +010086# Remove GNU Property Notes from asm files.
87#string-cflags += -DWANT_GNU_PROPERTY=0
88
Ola Liljedahl6a988f62020-02-27 15:10:03 +010089# Enable assertion checks.
90#networking-cflags += -DWANT_ASSERT
91
92# Avoid auto-vectorization of scalar code and unroll loops
93networking-cflags += -O2 -fno-tree-vectorize -funroll-loops