summaryrefslogtreecommitdiffstats
path: root/libtommath/makefile_include.mk
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-22 19:32:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-22 19:32:11 (GMT)
commitf8876cc390ecf388114f426db15e641a5adb20fc (patch)
tree81798f8180e5b22906f264758362a8b4bf54f979 /libtommath/makefile_include.mk
parent5753c7a42b638962406f9f7f822e48561e7a6253 (diff)
downloadtcl-f8876cc390ecf388114f426db15e641a5adb20fc.zip
tcl-f8876cc390ecf388114f426db15e641a5adb20fc.tar.gz
tcl-f8876cc390ecf388114f426db15e641a5adb20fc.tar.bz2
Update libtommath to latest "develop" branch
Diffstat (limited to 'libtommath/makefile_include.mk')
-rw-r--r--libtommath/makefile_include.mk37
1 files changed, 31 insertions, 6 deletions
diff --git a/libtommath/makefile_include.mk b/libtommath/makefile_include.mk
index 45a4895..c4ba8db 100644
--- a/libtommath/makefile_include.mk
+++ b/libtommath/makefile_include.mk
@@ -17,15 +17,34 @@ ifndef CROSS_COMPILE
CROSS_COMPILE=
endif
-ifeq ($(CC),cc)
- CC = $(CROSS_COMPILE)gcc
+# We only need to go through this dance of determining the right compiler if we're using
+# cross compilation, otherwise $(CC) is fine as-is.
+ifneq (,$(CROSS_COMPILE))
+ifeq ($(origin CC),default)
+CSTR := "\#ifdef __clang__\nCLANG\n\#endif\n"
+ifeq ($(PLATFORM),FreeBSD)
+ # XXX: FreeBSD needs extra escaping for some reason
+ CSTR := $$$(CSTR)
endif
+ifneq (,$(shell echo $(CSTR) | $(CC) -E - | grep CLANG))
+ CC := $(CROSS_COMPILE)clang
+else
+ CC := $(CROSS_COMPILE)gcc
+endif # Clang
+endif # cc is Make's default
+endif # CROSS_COMPILE non-empty
+
LD=$(CROSS_COMPILE)ld
AR=$(CROSS_COMPILE)ar
RANLIB=$(CROSS_COMPILE)ranlib
ifndef MAKE
- MAKE=make
+# BSDs refer to GNU Make as gmake
+ifneq (,$(findstring $(PLATFORM),FreeBSD OpenBSD DragonFly NetBSD))
+ MAKE=gmake
+else
+ MAKE=make
+endif
endif
CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow
@@ -67,10 +86,16 @@ ifeq ($(PLATFORM), Darwin)
CFLAGS += -Wno-nullability-completeness
endif
+ifeq ($(PLATFORM),FreeBSD)
+ _ARCH := $(shell sysctl -b hw.machine_arch)
+else
+ _ARCH := $(shell arch)
+endif
+
# adjust coverage set
-ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),)
+ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),)
COVERAGE = test_standalone timing
- COVERAGE_APP = ./test && ./ltmtest
+ COVERAGE_APP = ./test && ./timing
else
COVERAGE = test_standalone
COVERAGE_APP = ./test
@@ -113,7 +138,7 @@ cleancov-clean:
cleancov: cleancov-clean clean
clean:
- rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
+ rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test timing mpitest mtest/mtest mtest/mtest.exe \
*.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la
rm -rf .libs/
${MAKE} -C etc/ clean MAKE=${MAKE}