Szabolcs Nagy | 7889228 | 2018-04-24 17:10:05 +0100 | [diff] [blame] | 1 | # Example config.mk |
| 2 | # |
Szabolcs Nagy | 1eb5d7c | 2023-01-24 13:24:09 +0000 | [diff] [blame] | 3 | # Copyright (c) 2018-2022, Arm Limited. |
Szabolcs Nagy | 189dfef | 2022-02-10 10:32:35 +0000 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception |
Szabolcs Nagy | 7889228 | 2018-04-24 17:10:05 +0100 | [diff] [blame] | 5 | |
Szabolcs Nagy | 1fd2aaa | 2019-11-20 18:05:06 +0000 | [diff] [blame] | 6 | # Subprojects to build |
Ola Liljedahl | 6a988f6 | 2020-02-27 15:10:03 +0100 | [diff] [blame] | 7 | SUBS = math string networking |
Szabolcs Nagy | 1fd2aaa | 2019-11-20 18:05:06 +0000 | [diff] [blame] | 8 | |
Pierre Blanchard | 82c8c8a | 2022-03-25 15:04:38 +0000 | [diff] [blame] | 9 | # Subsubprojects to build if subproject pl is built |
| 10 | PLSUBS = math |
| 11 | |
Szabolcs Nagy | 1dfd7b8 | 2020-02-12 15:10:29 +0000 | [diff] [blame] | 12 | # Target architecture: aarch64, arm or x86_64 |
| 13 | ARCH = aarch64 |
Szabolcs Nagy | a202746 | 2018-07-27 11:14:11 +0100 | [diff] [blame] | 14 | |
Branislav Rankov | 4d55c2d | 2020-05-28 18:11:20 +0100 | [diff] [blame] | 15 | # Use for cross compilation with gcc. |
| 16 | #CROSS_COMPILE = aarch64-none-linux-gnu- |
| 17 | |
Szabolcs Nagy | 1dfd7b8 | 2020-02-12 15:10:29 +0000 | [diff] [blame] | 18 | # Compiler for the target |
Szabolcs Nagy | 7889228 | 2018-04-24 17:10:05 +0100 | [diff] [blame] | 19 | CC = $(CROSS_COMPILE)gcc |
| 20 | CFLAGS = -std=c99 -pipe -O3 |
Szabolcs Nagy | a202746 | 2018-07-27 11:14:11 +0100 | [diff] [blame] | 21 | CFLAGS += -Wall -Wno-missing-braces |
Szabolcs Nagy | 433a3b1 | 2019-10-17 12:31:17 +0100 | [diff] [blame] | 22 | CFLAGS += -Werror=implicit-function-declaration |
Szabolcs Nagy | a202746 | 2018-07-27 11:14:11 +0100 | [diff] [blame] | 23 | |
Szabolcs Nagy | 1dfd7b8 | 2020-02-12 15:10:29 +0000 | [diff] [blame] | 24 | # Used for test case generator that is executed on the host |
| 25 | HOST_CC = gcc |
| 26 | HOST_CFLAGS = -std=c99 -O2 |
| 27 | HOST_CFLAGS += -Wall -Wno-unused-function |
| 28 | |
Szabolcs Nagy | a202746 | 2018-07-27 11:14:11 +0100 | [diff] [blame] | 29 | # Enable debug info. |
| 30 | HOST_CFLAGS += -g |
| 31 | CFLAGS += -g |
Szabolcs Nagy | 7889228 | 2018-04-24 17:10:05 +0100 | [diff] [blame] | 32 | |
Szabolcs Nagy | 1e0c802 | 2019-08-06 12:04:27 +0100 | [diff] [blame] | 33 | # Optimize the shared libraries on aarch64 assuming they fit in 1M. |
| 34 | #CFLAGS_SHARED = -fPIC -mcmodel=tiny |
| 35 | |
Branislav Rankov | 4d55c2d | 2020-05-28 18:11:20 +0100 | [diff] [blame] | 36 | # Enable MTE support. |
| 37 | #CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1 |
Szabolcs Nagy | 7889228 | 2018-04-24 17:10:05 +0100 | [diff] [blame] | 38 | |
| 39 | # Use with cross testing. |
| 40 | #EMULATOR = qemu-aarch64-static |
| 41 | #EMULATOR = sh -c 'scp $$1 user@host:/dir && ssh user@host /dir/"$$@"' -- |
Szabolcs Nagy | 1fd2aaa | 2019-11-20 18:05:06 +0000 | [diff] [blame] | 42 | |
| 43 | # Additional flags for subprojects. |
| 44 | math-cflags = |
| 45 | math-ldlibs = |
| 46 | math-ulpflags = |
| 47 | math-testflags = |
| 48 | string-cflags = |
Ola Liljedahl | 6a988f6 | 2020-02-27 15:10:03 +0100 | [diff] [blame] | 49 | networking-cflags = |
Szabolcs Nagy | 1fd2aaa | 2019-11-20 18:05:06 +0000 | [diff] [blame] | 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. |
| 56 | math-cflags += -frounding-math -fexcess-precision=standard -fno-stack-protector |
| 57 | math-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 Blanchard | a790e50 | 2022-07-21 13:50:32 +0100 | [diff] [blame] | 65 | # Disable/enable SVE vector math code and tests |
| 66 | WANT_SVE_MATH = 0 |
| 67 | ifeq ($(WANT_SVE_MATH), 1) |
| 68 | math-cflags += -march=armv8.2-a+sve |
| 69 | endif |
| 70 | math-cflags += -DWANT_SVE_MATH=$(WANT_SVE_MATH) |
Pierre Blanchard | bc9ff56 | 2022-06-14 15:55:50 +0100 | [diff] [blame] | 71 | |
Joe Ramsay | 617d26f | 2022-11-04 13:57:18 +0000 | [diff] [blame] | 72 | # 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. |
| 75 | WANT_ERRNO = 0 |
| 76 | math-cflags += -DWANT_ERRNO=$(WANT_ERRNO) |
| 77 | |
Joe Ramsay | a5e45e4 | 2022-12-07 15:31:03 +0000 | [diff] [blame] | 78 | # If set to 1, set fenv in vector math routines. |
| 79 | WANT_SIMD_EXCEPT = 0 |
| 80 | math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT) |
| 81 | |
Szabolcs Nagy | 1fd2aaa | 2019-11-20 18:05:06 +0000 | [diff] [blame] | 82 | # Disable fenv checks |
| 83 | #math-ulpflags = -q -f |
| 84 | #math-testflags = -nostatus |
Ola Liljedahl | 6a988f6 | 2020-02-27 15:10:03 +0100 | [diff] [blame] | 85 | |
Szabolcs Nagy | e112794 | 2020-05-01 13:14:50 +0100 | [diff] [blame] | 86 | # Remove GNU Property Notes from asm files. |
| 87 | #string-cflags += -DWANT_GNU_PROPERTY=0 |
| 88 | |
Ola Liljedahl | 6a988f6 | 2020-02-27 15:10:03 +0100 | [diff] [blame] | 89 | # Enable assertion checks. |
| 90 | #networking-cflags += -DWANT_ASSERT |
| 91 | |
| 92 | # Avoid auto-vectorization of scalar code and unroll loops |
| 93 | networking-cflags += -O2 -fno-tree-vectorize -funroll-loops |