Use implicit mkdir.

This commit is contained in:
Brad Nelson
2023-12-24 14:03:53 -08:00
parent bf21b0f3c2
commit 92ace2753e
3 changed files with 15 additions and 34 deletions

View File

@ -15,7 +15,6 @@
ESP32_FILES = []
# Main .ino file.
Mkdir('esp32/ESP32forth')
ESP32_FILES += [
Importation('esp32/ESP32forth/README.txt',
'$src/esp32/README.txt'),
@ -26,7 +25,6 @@ ESP32_FILES += [
Importation('gen/esp32_boot.h', '$src/esp32/esp32_boot.fs', name='boot')
# Optional Compontents.
Mkdir('esp32/ESP32forth/optional')
ESP32_FILES += [
Importation('esp32/ESP32forth/optional/README-optional.txt',
'$src/esp32/optional/README-optional.txt'),
@ -48,7 +46,6 @@ ESP32_FILES += [
]
# Simulator.
Mkdir('esp32-sim')
ESP32_FILES += [
Compile('esp32-sim/esp32-sim', '$src/esp32/sim_main.cpp',
implicit=['gen/esp32_boot.h', 'gen/esp32_sim_opcodes.h'])

View File

@ -150,10 +150,6 @@ WIN_CFLAGS = {' '.join(WIN_CFLAGS)}
WIN_LFLAGS32 = {' '.join(WIN_LFLAGS32)}
WIN_LFLAGS64 = {' '.join(WIN_LFLAGS64)}
rule mkdir
description = mkdir
command = mkdir -p $out
rule importation
description = importation
depfile = $out.d
@ -169,28 +165,28 @@ rule compile
rule compile_win32
description = WIN_CL32
deps = msvc
command = $WIN_CL32 /showIncludes /nologo /c /Fo$out $WIN_CFLAGS $in
command = $WIN_CL32 /showIncludes /nologo /c /Fo$out $WIN_CFLAGS $in && touch $out
rule compile_win64
description = WIN_CL64
deps = msvc
command = $WIN_CL64 /showIncludes /nologo /c /Fo$out $WIN_CFLAGS $in >/dev/null
command = $WIN_CL64 /showIncludes /nologo /c /Fo$out $WIN_CFLAGS $in && touch $out
rule link_win32
description = WIN_LINK32
command = $WIN_LINK32 /nologo /OUT:$out $WIN_LFLAGS32 $in && chmod a+x $out
command = $WIN_LINK32 /nologo /OUT:$out $WIN_LFLAGS32 $in && touch $out && chmod a+x $out
rule link_win64
description = WIN_LINK64
command = $WIN_LINK64 /nologo /OUT:$out $WIN_LFLAGS64 $in && chmod a+x $out
command = $WIN_LINK64 /nologo /OUT:$out $WIN_LFLAGS64 $in && touch $out && chmod a+x $out
rule rc_win32
description = WIN_RC32
command = $WIN_RC32 /nologo /i $src /fo $out $in
command = $WIN_RC32 /nologo /i $src /fo $out $in && touch $out
rule rc_win64
description = WIN_RC64
command = $WIN_RC64 /nologo /i $src /fo $out $in
command = $WIN_RC64 /nologo /i $src /fo $out $in && touch $out
rule run
description = RUN
@ -204,16 +200,9 @@ rule convert_image
description = IMAGE_CONVERT
command = convert $in $out
build gen: mkdir
"""
def Mkdir(path):
global output
output += 'build ' + path + ': mkdir\n'
def Importation(target, source, header_mode='cpp', name=None, keep=False, deps=None, implicit=[]):
global output
options = ''
@ -221,9 +210,8 @@ def Importation(target, source, header_mode='cpp', name=None, keep=False, deps=N
options += '--keep-first-comment'
if name:
options += ' --name ' + name + ' --header ' + header_mode
outdir = os.path.dirname(target)
implicit = ' '.join(implicit)
output += f'build {target}: importation {source} | {outdir} {implicit}\n'
output += f'build {target}: importation {source} | {implicit}\n'
if options:
output += f' options = {options}\n'
if deps:
@ -232,23 +220,21 @@ def Importation(target, source, header_mode='cpp', name=None, keep=False, deps=N
def Esp32Optional(main_name, main_source, parts):
parts = []
for name, source in parts:
Importation('gen/esp32_' + name + '.h',
source, name=name.replace('-', '_') + '_source')
if not main_source:
main_source = 'gen/esp32_' + main_name + '.h'
parts.append(Importation('gen/esp32_' + name + '.h',
source, name=name.replace('-', '_') + '_source'))
return Importation('esp32/ESP32forth/optional/' + main_name + '.h',
main_source,
keep=True,
deps='gen/esp32_optional_' + main_name + '.h.d',
implicit=['gen/esp32_' + i + '.h' for i, _ in parts])
implicit=parts)
def Simple(op, target, source, implicit=[]):
global output
outdir = os.path.dirname(target)
implicit = ' '.join(implicit)
output += f'build {target}: {op} {source} | {outdir} {implicit}\n'
output += f'build {target}: {op} {source} | {implicit}\n'
return target
@ -308,7 +294,6 @@ def Default(target):
def Include(path):
Mkdir(path)
path = os.path.join(ROOT_DIR, path, 'BUILD')
data = open(path).read()
exec(data)

View File

@ -33,7 +33,6 @@ LinkW64('windows/uEf64.exe',
' '.join(['windows/uEf64.obj', 'resources/ueforth_res64.res']))
# Create icon.
Mkdir('resources')
ICON_SIZES = [
ResizeImage('resources/eforth16x16.png', '$src/images/eforth.png', '16x16'),
ResizeImage('resources/eforth32x32.png', '$src/images/eforth.png', '32x32'),