From c7f893f6aa8dcab45494e97519797485c70de36a Mon Sep 17 00:00:00 2001 From: Edwin Brady Date: Sat, 16 May 2020 18:08:00 +0100 Subject: [PATCH] Reorganise optimisation options for C It should be -O2 for the rts, but -O2 takes ages for idris2.c so should be saved for releases (also OPT should be able to be edited easily for e.g. adding profiling) Also default to clang (perhaps it would be better if we could check whether clang was available first, but it does a better job as the default overall). --- config.mk | 2 +- dist/config.mk | 2 +- dist/rts/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.mk b/config.mk index 314d6bb..417c0c1 100644 --- a/config.mk +++ b/config.mk @@ -6,7 +6,7 @@ PREFIX ?= $(HOME)/.idris2 OPT = # clang compiles the output much faster than gcc! -CC ?= clang +CC := clang ################################################################## diff --git a/dist/config.mk b/dist/config.mk index 3c502b5..f5eae67 100644 --- a/dist/config.mk +++ b/dist/config.mk @@ -1,6 +1,6 @@ include $(IDRIS2_CURDIR)/config.mk -CFLAGS += -O2 -std=c99 -pipe -fdata-sections -ffunction-sections -D_POSIX_C_SOURCE=200809L +CFLAGS += $(OPT) -std=c99 -pipe -fdata-sections -ffunction-sections -D_POSIX_C_SOURCE=200809L ifeq ($(OS),bsd) GMP_INCLUDE_DIR = -I/usr/local/include diff --git a/dist/rts/Makefile b/dist/rts/Makefile index 608d9d0..a3b55d4 100644 --- a/dist/rts/Makefile +++ b/dist/rts/Makefile @@ -7,7 +7,7 @@ HDRS =idris_rts.h idris_heap.h idris_gc.h idris_gmp.h idris_bitstring.h \ idris_opts.h idris_stats.h idris_stdfgn.h idris_net.h \ idris_buffer.h idris_utf8.h getline.h -CFLAGS += $(GMP_INCLUDE_DIR) -DIDRIS_TARGET_OS="\"$(OS)\"" +CFLAGS += -O2 $(GMP_INCLUDE_DIR) -DIDRIS_TARGET_OS="\"$(OS)\"" CFLAGS += -DIDRIS_TARGET_TRIPLE="\"$(MACHINE)\"" ifeq ($(OS), windows)