diff --git a/SConstruct b/SConstruct index cf6a18c08..bdbcc9b2d 100644 --- a/SConstruct +++ b/SConstruct @@ -19,10 +19,13 @@ rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX') go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE') +coconut_builder = Builder(action='coconut $COCONUTFLAGS $SOURCE $TARGET', src_suffix='.coco', target_suffix='.py') + env = Environment(ENV=os.environ, BUILDERS={'rustc': rust_rustc_builder, 'cargo': rust_cargo_builder, - 'Go': go_builder}, + 'Go': go_builder, + 'Coconut': coconut_builder}, tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran']) Export('env') @@ -30,6 +33,7 @@ Export('env') env['CFLAGS'] = '-Wall -Wextra -Werror' env['CXXFLAGS'] = '-std=c++17' env['ASFLAGS'] = '--64' +env['COCONUTFLAGS'] = '--target 3.8' # Add other languages here when you want to add language targets # Put 'name_of_language_directory' : 'file_extension' @@ -40,6 +44,7 @@ languages = { 'rust': 'rs', 'go': 'go', 'fortran': 'f90', + 'coconut': 'coco', } # Do not add new Builders here, add them to the BUILDERS argument in the call to Environment above diff --git a/sconscripts/coconut_SConscript b/sconscripts/coconut_SConscript new file mode 100644 index 000000000..1356343eb --- /dev/null +++ b/sconscripts/coconut_SConscript @@ -0,0 +1,6 @@ +Import('files_to_compile env') + +for file_info in files_to_compile: + build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}' + build_result = env.Coconut(build_target, str(file_info.path)) + env.Alias(str(file_info.chapter), build_result)