@ -56,6 +56,63 @@ void test(void)
;; Building
;;
( comptime-cond
;; Build using Cakelisp's build system. Not recommended unless you are doing active work on the
;; compiler. TODO: Replace this with using TCC's make but checking canUseCachedFile instead?
( 'tiny-c-compiler-direct-build
( add-c-build-dependency
;; "tcc.c" ;; This is the CLI, so we don't want it!
"libtcc.c"
"tccpp.c"
"tccgen.c"
"tccdbg.c"
"tccelf.c"
"tccasm.c"
"tccrun.c"
"x86_64-gen.c"
"x86_64-link.c"
"i386-asm.c" )
( add-build-options
#"#-DCONFIG_TRIPLET=" x86_64-linux-gnu "#" # "-DTCC_TARGET_X86_64"
"-DONE_SOURCE=0"
#"#-DTCC_GITHASH=" master:91d09be-mod "#" #
"-Wall" "-O2"
;; TODO: Silence warnings for these due to TinyCCompiler.cake.cpp
"-Wdeclaration-after-statement" "-Wno-pointer-sign"
"-fno-strict-aliasing"
"-Wno-sign-compare" "-Wno-unused-result" "-Wno-format-truncation"
"-Wno-stringop-truncation"
"-g"
"-IDependencies/TinyCC" "-Icakelisp_cache/TinyCCBuildDir" )
( set-module-option build-time-compiler "gcc" )
( set-module-option build-time-compile-arguments
"-c" 'source-input "-o" 'object-output
'include-search-dirs 'additional-options )
( defun-comptime prepare-tiny-cc-build ( manager ( ref ModuleManager )
module ( addr Module ) &return bool )
( var linux-config-h ( addr ( const char ) )
# " # # ifndef CONFIG_TCCDIR
# define CONFIG_TCCDIR "/usr/local/lib/tcc"
# endif
# ifndef CONFIG_TCC_PREDEFS
# define CONFIG_TCC_PREDEFS 1
# endif
# define TCC_VERSION "0.9.27"
# define GCC_MAJOR 9
# define GCC_MINOR 4
# define CC_NAME CC_gcc# " # )
( var config-file ( addr FILE ) ( fopen "cakelisp_cache/TinyCCBuildDir/config.h" "wb" ) )
( unless config-file
( return false ) )
( fprintf config-file "%s" linux-config-h )
( defer ( fclose config-file ) )
( return true ) )
( add-compile-time-hook-module pre-build build-tiny-cc ) )
;; Build using TCC's makefile
( true
( defun-comptime build-tiny-cc ( manager ( ref ModuleManager ) module ( addr Module ) &return bool )
( var tinycc-build-dir ( addr ( const char ) ) "cakelisp_cache/TinyCCBuildDir" )
@ -134,7 +191,7 @@ void test(void)
( makeDirectory tinycc-build-dir )
( run-process-sequential-or
( "sh" "../../Dependencies/TinyCC/configure" :in-directory tinycc-build-dir )
( "sh" "../../Dependencies/TinyCC/configure" "--debug" :in-directory tinycc-build-dir )
( Log
"failed at TinyCC configure step. This requires a sh/bash-style shell to execute.\n" )
( return false ) )
@ -156,7 +213,7 @@ void test(void)
( Log "TinyCC: Successfully built\n" )
( return true ) )
( add-compile-time-hook-module pre-build build-tiny-cc )
( add-compile-time-hook-module pre-build build-tiny-cc ) ) )
( add-c-search-directory-module "Dependencies/TinyCC" )
@ -165,7 +222,6 @@ void test(void)
( add-library-dependency "dl" )
( add-library-dependency "pthread" ) ) )
;; This is an unofficial mirror
( add-dependency-git-submodule
clone-tiny-cc
"git://repo.or.cz/tinycc.git"