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