From f4daa7e8bb7219208b24a3df5d8aa1ff1ad4a182 Mon Sep 17 00:00:00 2001 From: Peter Colberg Date: Fri, 13 Nov 2015 13:14:55 -0500 Subject: [PATCH 1/4] Set default optimization flag to -O2 Allow overriding optimization flag with the environment variable CFLAGS. --- Make.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Make.inc b/Make.inc index 9609331..6858ea3 100644 --- a/Make.inc +++ b/Make.inc @@ -47,9 +47,8 @@ endif CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/ld80 -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration -ifneq ($(NOOPT),1) -CFLAGS_add += -O3 -endif +# The optimization flag may be overriden with the environment variable CFLAGS. +CFLAGS ?= -O2 default: all From ebed203c045b9e957d5102231df49ebf46522838 Mon Sep 17 00:00:00 2001 From: Peter Colberg Date: Fri, 13 Nov 2015 13:19:51 -0500 Subject: [PATCH 2/4] Remove superfluous compiler flags for tests -O2 is the default, and -g should be set in CFLAGS if needed. --- test/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/Makefile b/test/Makefile index 8c6c2c6..71320fb 100644 --- a/test/Makefile +++ b/test/Makefile @@ -12,22 +12,22 @@ all: test-double test-float # test-double-system test-float-system bench: bench-syslibm bench-openlibm test-double: test-double.c libm-test.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@ test-float: test-float.c libm-test.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $@.c -D__BSD_VISIBLE -I ../include -I../src $(OPENLIBM_LIB) -o $@ test-double-system: test-double.c libm-test.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $< -DSYS_MATH_H -lm -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $< -DSYS_MATH_H -lm -o $@ test-float-system: test-float.c libm-test.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -g $< -DSYS_MATH_H -lm -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $< -DSYS_MATH_H -lm -o $@ bench-openlibm: libm-bench.cpp - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -O2 $< $(OPENLIBM_LIB) -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $< $(OPENLIBM_LIB) -o $@ bench-syslibm: libm-bench.cpp - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) -O2 $< -lm -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add_TARGET_$(ARCH)) $(LDFLAGS) $< -lm -o $@ clean: rm -fr test-double test-float test-double-system test-float-system bench-openlibm bench-syslibm *.dSYM From 0aef1f70095e8ee52e25e8f53ef20a0738be02df Mon Sep 17 00:00:00 2001 From: Peter Colberg Date: Fri, 13 Nov 2015 13:43:44 -0500 Subject: [PATCH 3/4] Clean up and test make clean --- .travis.sh | 2 ++ Makefile | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.travis.sh b/.travis.sh index ed014c7..12296d9 100755 --- a/.travis.sh +++ b/.travis.sh @@ -22,3 +22,5 @@ arm32) esac $LOADER make check + +make clean && git status --ignored --porcelain && test -z "$(git status --ignored --porcelain)" diff --git a/Makefile b/Makefile index b26d4f4..fd4c532 100644 --- a/Makefile +++ b/Makefile @@ -51,14 +51,9 @@ test/test-float: libopenlibm.$(SHLIB_EXT) $(MAKE) -C test test-float clean: - @for dir in $(SUBDIRS) .; do \ - rm -fr $$dir/*.o $$dir/*.a $$dir/*.$(SHLIB_EXT)*; \ - done - @rm -f test/test-double test/test-float - -distclean: - -rm -f $(OBJS) *.a *.$(SHLIB_EXT) libopenlibm.* - -$(MAKE) -C test clean + rm -f amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld128/*.o ld80/*.o src/*.o + rm -f libopenlibm.a libopenlibm.$(SHLIB_EXT)* + $(MAKE) -C test clean openlibm.pc: openlibm.pc.in Make.inc Makefile echo "prefix=${prefix}" > openlibm.pc From b9658f49e64304539f4178f2e8a0f47e093e9db3 Mon Sep 17 00:00:00 2001 From: Peter Colberg Date: Fri, 13 Nov 2015 13:45:37 -0500 Subject: [PATCH 4/4] Fail if library symlinks cannot be created libopenlibm.$(SHLIB_EXT).$(SOMAJOR) is required for running tests. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fd4c532..d05f97e 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,8 @@ ifeq ($(OS),WINNT) $(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT) -o libopenlibm.$(SHLIB_EXT) else $(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT).$(SOMAJOR) -o libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) - @-ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT).$(SOMAJOR) - @-ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT) + ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT).$(SOMAJOR) + ln -sf libopenlibm.$(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) libopenlibm.$(SHLIB_EXT) endif test/test-double: libopenlibm.$(SHLIB_EXT)