Makefiles: allow to specify C compiler on a command line stx-8.0.0
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 02 Apr 2018 21:51:24 +0000
branchstx-8.0.0
changeset 232 85c422506875
parent 227 640f942d4e63
child 233 2aff5346b62c
Makefiles: allow to specify C compiler on a command line ...like: rake CC=gcc-8 or: make CC=gcc-8
makelib/config-linux-gnu.make
makelib/config.make
rakelib/clean.rake
rakelib/compile.rake
--- a/makelib/config-linux-gnu.make	Mon Apr 02 07:32:49 2018 +0100
+++ b/makelib/config-linux-gnu.make	Mon Apr 02 21:51:24 2018 +0000
@@ -31,19 +31,16 @@
 # We need to use at most GCC 6.x, some code may fail to compile
 # with GCC 7 due to -Werror (`send.c` for instance). We won't fix
 # that for Smalltalk/X 6.x.x, will be fixed only for Smalltalk/X 8.0.0
-ifeq (,$(shell which gcc-6))
-ifeq (,$(shell which gcc-5))
-ifeq (,$(shell which gcc-4))
-$(error Smalltalk/X requires GCC 4.x, GCC 5.x or GCC 6.x to compile, none found)
-else
-CC=gcc-4
+ifeq ($(CC),cc)
+  ifneq ($(shell which gcc-6),)
+    CC = gcc-6
+  else ifneq ($(shell which gcc-5),)
+    CC = gcc-5
+  else ifneq ($(shell which gcc-4),)
+    CC = gcc-4
+  endif
 endif
-else
-CC=gcc-5
-endif
-else
-CC=gcc-6
-endif
+
 
 STC_LEXLIB=-lfl
 
--- a/makelib/config.make	Mon Apr 02 07:32:49 2018 +0100
+++ b/makelib/config.make	Mon Apr 02 21:51:24 2018 +0000
@@ -86,16 +86,16 @@
 # MAKE=make
 
 # c-compiler to use
-CC=cc
-AS_CC=$(CC)
+CC ?= cc
+AS_CC ?= $(CC)
 AS_CC_CFLAG=-c
-CPP=/lib/cpp
+CPP = cpp
 
 # assembler for librun/asmhelp
-AS=as
+AS = as
 
 # linker for final executable
-LD=$(CC)
+LD = $(CC)
 # linker for classlibs
 CLASSLIB_LD=ld
 
@@ -178,7 +178,7 @@
 GOODIES_STCOPT=+optspace2
 
 # common for all:
-STCCOMMONOPT=+sharedLibCode -staticMethods
+STCCOMMONOPT=+sharedLibCode -staticMethods +lineInfo +stLineInfo
 CCCOMMONOPT=$(OPTIONAL_HAVE_FFI_ARG)
 
 # to be redefined in arch/COMMON/defines
--- a/rakelib/clean.rake	Mon Apr 02 07:32:49 2018 +0100
+++ b/rakelib/clean.rake	Mon Apr 02 21:51:24 2018 +0000
@@ -34,7 +34,10 @@
   task :pre
   task :post
 
-  task :main => %i(stc librun include packages)
+  task :main => %i(stc librun include packages) do
+    rm BUILD_DIR / 'stx-config.make'
+    rm BUILD_DIR / 'stx-config.rake'
+  end
 
   task :include do
     rm_rf BUILD_DIR / 'stx' / 'include'
@@ -42,13 +45,13 @@
 
   task :stc do
     chdir BUILD_DIR / 'stx' / 'stc' do
-      ; make 'clobber';
+      make 'clobber';
     end
   end
 
   task :librun do
     chdir BUILD_DIR / 'stx' / 'librun' do
-      ; make 'clobber'
+      make 'clobber'
     end
   end
 
--- a/rakelib/compile.rake	Mon Apr 02 07:32:49 2018 +0100
+++ b/rakelib/compile.rake	Mon Apr 02 21:51:24 2018 +0000
@@ -147,6 +147,9 @@
     makelib_dir = Pathname.new(File.expand_path('makelib')).relative_path_from(Pathname.new(BUILD_DIR / 'stx' ))
     File.open(STX_CONF_DIR / 'stx-config.make', 'w') do | f |
       f.puts "BUILD_TARGET ?= #{BUILD_TARGET}"
+      if defined? CC 
+        f.puts "CC ?= #{CC}"
+      end
     end
   end