diff --git a/SConstruct b/SConstruct index c93744156..93354e152 100644 --- a/SConstruct +++ b/SConstruct @@ -10,21 +10,21 @@ To run the compilation for all implementations in one language, e.g. C, run the from pathlib import Path import os -env = Environment(ENV={'PATH': os.environ['PATH']}) +env = Environment(ENV={'PATH': os.environ['PATH']}, + tools=['gcc', 'gnulink', 'g++', 'gas']) + +env['ASFLAGS'] = '--64' -env['CC'] = 'gcc' -for tool in ['gcc','gnulink']: - env.Tool(tool) env['CCFLAGS'] = '' env['CXXFLAGS'] = '-std=c++17' # Add other languages here when you want to add language targets # Put 'name_of_language_directory' : 'file_extension' -languages = {'c': 'c', 'cpp': 'cpp'} +languages = {'c': 'c', 'cpp': 'cpp', 'asm-x64': 's'} env.C = env.Program env.CPlusPlus = env.Program - +env.X64 = env.Program Export('env') @@ -46,7 +46,8 @@ sconscript_dir_path = Path('sconscripts') for language, files in files_to_compile.items(): if files: if (sconscript_path := sconscript_dir_path / f"{language}_SConscript").exists(): - SConscript(sconscript_path, exports = {'files_to_compile': files}) + SConscript(sconscript_path, exports = {'files_to_compile': files, + 'language': language}) else: print(f'{language} file found at {files[0]}, but no sconscript file is present ') diff --git a/contents/cooley_tukey/code/asm-x64/SConscript b/contents/cooley_tukey/code/asm-x64/SConscript new file mode 100644 index 000000000..05360fe6c --- /dev/null +++ b/contents/cooley_tukey/code/asm-x64/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS=['m'], LINKFLAGS='-no-pie') diff --git a/contents/forward_euler_method/code/asm-x64/SConscript b/contents/forward_euler_method/code/asm-x64/SConscript new file mode 100644 index 000000000..9322fd10c --- /dev/null +++ b/contents/forward_euler_method/code/asm-x64/SConscript @@ -0,0 +1,6 @@ +Import('*') +from pathlib import Path + +dirname = Path.cwd().parents[1].stem + +env.X64(f'#/build/asm-x64/{dirname}', Glob('*.s'), LIBS='m', LINKFLAGS='-no-pie') diff --git a/sconscripts/asm-x64_SConscript b/sconscripts/asm-x64_SConscript new file mode 100644 index 000000000..caabf226f --- /dev/null +++ b/sconscripts/asm-x64_SConscript @@ -0,0 +1,6 @@ +Import('files_to_compile language env') +from pathlib import Path + +for file in files_to_compile: + chapter_name = file.parent.parent.parent.stem + env.X64(f'#/build/{language}/{chapter_name}', str(file), LINKFLAGS='-no-pie')