aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2018-07-27 11:14:11 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2018-07-30 13:16:37 +0100
commita202746b8841f77ebfe63f38d08832afc1155e03 (patch)
tree579e42671fae8ce90cae718a66516b1e98358f5d
parentc5a8042e506925fb107d370636f0de5536c2cb92 (diff)
downloadarm-optimized-routines-a202746b8841f77ebfe63f38d08832afc1155e03.tar.gz
Add separate HOST_CFLAGS, HOST_LDFLAGS and HOST_LDLIBS make variables
Don't use target flags when building host tools. The example config.mk.dist is updated accordingly.
-rw-r--r--Makefile13
-rw-r--r--config.mk.dist9
2 files changed, 17 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 850da5e..c54eaf1 100644
--- a/Makefile
+++ b/Makefile
@@ -52,9 +52,13 @@ RTESTS = $(wildcard $(srcdir)/test/testcases/random/*.tst)
# Configure these in config.mk, do not make changes in this file.
HOST_CC = cc
+HOST_CFLAGS = -std=c99 -O2
+HOST_LDFLAGS =
+HOST_LDLIBS = -lm -lmpfr -lmpc
EMULATOR =
CFLAGS = -std=c99 -O2
LDFLAGS =
+LDLIBS = -lm
CPPFLAGS =
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
@@ -78,6 +82,7 @@ $(ALL_DIRS):
$(ALL_OBJS:%.o=%.os): CFLAGS_ALL += -fPIC
$(RTEST_OBJS): CC = $(HOST_CC)
+$(RTEST_OBJS): CFLAGS_ALL = $(HOST_CFLAGS)
build/test/mathtest.o: CFLAGS_ALL += -fmath-errno
@@ -102,16 +107,16 @@ build/lib/libmathlib.a: $(MATH_OBJS)
$(RANLIB) $@
build/bin/rtest: $(RTEST_OBJS)
- $(HOST_CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -o $@ $^ -lm -lmpfr -lmpc
+ $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(HOST_LDLIBS)
build/bin/mathtest: build/test/mathtest.o build/lib/libmathlib.a
- $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ -lm
+ $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ $(LDLIBS)
build/bin/mathbench: build/test/mathbench.o build/lib/libmathlib.a
- $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ -lm
+ $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ $(LDLIBS)
build/bin/mathbench_libc: build/test/mathbench.o
- $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ -lm
+ $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ $(LDLIBS)
build/include/%.h: $(srcdir)/math/include/%.h
cp $< $@
diff --git a/config.mk.dist b/config.mk.dist
index edc1a2f..d951a93 100644
--- a/config.mk.dist
+++ b/config.mk.dist
@@ -16,9 +16,16 @@
# limitations under the License.
HOST_CC = gcc
+HOST_CFLAGS = -std=c99 -O2
+HOST_CFLAGS += -Wall -Wno-unused-function
+
CC = $(CROSS_COMPILE)gcc
CFLAGS = -std=c99 -pipe -O3
-CFLAGS += -Wall -Wno-missing-braces -Wno-unused-function
+CFLAGS += -Wall -Wno-missing-braces
+
+# Enable debug info.
+HOST_CFLAGS += -g
+CFLAGS += -g
# Use if the target FPU only supports single precision.
#CFLAGS += WANT_SINGLEPREC