This commit is contained in:
Brad Nelson
2024-01-01 15:50:27 -08:00
parent b8f4a7b3c4
commit a69961d90d
9 changed files with 91 additions and 80 deletions

View File

@ -169,7 +169,7 @@ tests: $(TESTS)
n:
mkdir -p out
tools/configure.py >out/build.ninja
ninja -C out/
ninja
clean-esp32:
rm -rf $(ESP32)/esp32*_build $(ESP32)/esp32*_cache

2
build.ninja Normal file
View File

@ -0,0 +1,2 @@
builddir = out
include out/build.ninja

View File

@ -17,17 +17,17 @@ ESP32_ZIP_FILES = []
# Main .ino file.
ESP32_ZIP_FILES += [
Importation('esp32/ESP32forth/README.txt',
Importation('$dst/esp32/ESP32forth/README.txt',
'$src/esp32/README.txt'),
Importation('esp32/ESP32forth/ESP32forth.ino',
Importation('$dst/esp32/ESP32forth/ESP32forth.ino',
'$src/esp32/ESP32forth.ino',
implicit=['gen/esp32_boot.h'], keep=True),
implicit=['$dst/gen/esp32_boot.h'], keep=True),
]
Importation('gen/esp32_boot.h', '$src/esp32/esp32_boot.fs', name='boot')
Importation('$dst/gen/esp32_boot.h', '$src/esp32/esp32_boot.fs', name='boot')
# Optional Compontents.
ESP32_ZIP_FILES += [
Importation('esp32/ESP32forth/optional/README-optional.txt',
Importation('$dst/esp32/ESP32forth/optional/README-optional.txt',
'$src/esp32/optional/README-optional.txt'),
Esp32Optional('rmt', '$src/esp32/optional/rmt.h', []),
Esp32Optional('assemblers', '$src/esp32/optional/assemblers/assemblers.h',
@ -48,16 +48,16 @@ ESP32_ZIP_FILES += [
# Zip it.
ESP32_FILES += [
Zip('esp32/ESP32forth.zip', ESP32_ZIP_FILES, base='esp32/ESP32forth'),
Zip('$dst/esp32/ESP32forth.zip', ESP32_ZIP_FILES, base='$dst/esp32/ESP32forth'),
]
# Simulator.
ESP32_FILES += [
Compile('esp32-sim/esp32-sim', '$src/esp32/sim_main.cpp',
implicit=['gen/esp32_boot.h', 'gen/esp32_sim_opcodes.h'])
Compile('$dst/esp32-sim/esp32-sim', '$src/esp32/sim_main.cpp',
implicit=['$dst/gen/esp32_boot.h', '$dst/gen/esp32_sim_opcodes.h'])
]
Compile('gen/print-esp32-builtins', '$src/esp32/print-builtins.cpp'),
Run('gen/esp32_sim_opcodes.h', 'gen/print-esp32-builtins')
Compile('$dst/gen/print-esp32-builtins', '$src/esp32/print-builtins.cpp'),
Run('$dst/gen/esp32_sim_opcodes.h', '$dst/gen/print-esp32-builtins')
# Main Alias.
Alias('esp32', ' '.join(ESP32_FILES))

View File

@ -17,27 +17,28 @@ PICO_ICE_ZIP_FILES = []
# Main .ino file.
PICO_ICE_ZIP_FILES += [
Importation('pico-ice/ueforth-pico-ice/README.txt',
Importation('$dst/pico-ice/ueforth-pico-ice/README.txt',
'$src/pico-ice/README.txt'),
# TODO: .uf2
Copy('pico-ice/ueforth-pice-ice/LICENSE', '$src/LICENSE'),
Copy('pico-ice/ueforth-pice-ice/pico-ice-sdk-LICENSE.md',
Copy('$dst/pico-ice/ueforth-pice-ice/LICENSE', '$src/LICENSE'),
Copy('$dst/pico-ice/ueforth-pice-ice/pico-ice-sdk-LICENSE.md',
'$src/pico-ice/pico-ice-sdk/LICENSE.md'),
Copy('pico-ice/ueforth-pice-ice/pico-sdk-LICENSE.TXT',
Copy('$dst/pico-ice/ueforth-pice-ice/pico-sdk-LICENSE.TXT',
'$src/pico-ice/pico-sdk/LICENSE.TXT'),
]
# Zip it.
PICO_ICE_FILES += [
Zip('pico-ice/ueforth-pico-ice.zip', PICO_ICE_ZIP_FILES, base='pico-ice/ueforth-pico-ice'),
Zip('$dst/pico-ice/ueforth-pico-ice.zip', PICO_ICE_ZIP_FILES,
base='$dst/pico-ice/ueforth-pico-ice'),
]
# Simulator.
PICO_ICE_FILES += [
CompileSim('pico-ice-sim/ueforth_pico_ice_sim', '$src/pico-ice/main.c',
implicit=['gen/pico_ice_boot.h'])
CompileSim('$dst/pico-ice-sim/ueforth_pico_ice_sim', '$src/pico-ice/main.c',
implicit=['$dst/gen/pico_ice_boot.h'])
]
Importation('gen/pico_ice_boot.h', '$src/pico-ice/pico_ice_boot.fs', name='boot')
Importation('$dst/gen/pico_ice_boot.h', '$src/pico-ice/pico_ice_boot.fs', name='boot')
# Main Alias.
Alias('pico', ' '.join(PICO_ICE_FILES))

View File

@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
Importation('gen/posix_boot.h', '$src/posix/posix_boot.fs', name='boot')
Compile('posix/ueforth', '$src/posix/main.c',
implicit=['gen/posix_boot.h'])
Importation('$dst/gen/posix_boot.h', '$src/posix/posix_boot.fs', name='boot')
Compile('$dst/posix/ueforth', '$src/posix/main.c',
implicit=['$dst/gen/posix_boot.h'])
Alias('posix', ' '.join([
ForthTest('tests/posix_all_tests.out', 'posix/ueforth', '$src/common/all_tests.fs'),
ForthTest('$dst/tests/posix_all_tests.out',
'$dst/posix/ueforth', '$src/common/all_tests.fs'),
]))
OneShot('install', 'sudo cp posix/ueforth /usr/bin/ueforth',
'posix/ueforth', pool='console')
OneShot('install', 'sudo cp $dst/posix/ueforth /usr/bin/ueforth',
'$dst/posix/ueforth', pool='console')

View File

@ -26,22 +26,22 @@ ESP_REPLACE = REPLACE + ['-DFORTH=ESP32forth']
DEPLOY_ITEMS = []
DEPLOY_ITEMS += [
Copy('deploy/.gcloudignore', '$src/site/.gcloudignore'),
Copy('deploy/ueforth.js', 'web/ueforth.js'),
Importation('deploy/index.html', '$src/site/index.html'),
Importation('deploy/linux.html', '$src/site/linux.html'),
Importation('deploy/windows.html', '$src/site/windows.html'),
Importation('deploy/web.html', '$src/site/web.html'),
Importation('deploy/ESP32forth.html', '$src/site/ESP32forth.html'),
Importation('deploy/pico-ice.html', '$src/site/pico-ice.html'),
Importation('deploy/internals.html', '$src/site/internals.html'),
Importation('deploy/classic.html', '$src/site/classic.html'),
Copy('deploy/eforth.go', '$src/site/eforth.go'),
Copy('deploy/app.yaml', '$src/site/app.yaml'),
Copy('$dst/deploy/.gcloudignore', '$src/site/.gcloudignore'),
Copy('$dst/deploy/ueforth.js', '$dst/web/ueforth.js'),
Importation('$dst/deploy/index.html', '$src/site/index.html'),
Importation('$dst/deploy/linux.html', '$src/site/linux.html'),
Importation('$dst/deploy/windows.html', '$src/site/windows.html'),
Importation('$dst/deploy/web.html', '$src/site/web.html'),
Importation('$dst/deploy/ESP32forth.html', '$src/site/ESP32forth.html'),
Importation('$dst/deploy/pico-ice.html', '$src/site/pico-ice.html'),
Importation('$dst/deploy/internals.html', '$src/site/internals.html'),
Importation('$dst/deploy/classic.html', '$src/site/classic.html'),
Copy('$dst/deploy/eforth.go', '$src/site/eforth.go'),
Copy('$dst/deploy/app.yaml', '$src/site/app.yaml'),
]
DEPLOY_ITEMS += [
Copy('deploy/static/' + i, '$src/site/static/' + i) for i in [
Copy('$dst/deploy/static/' + i, '$src/site/static/' + i) for i in [
'eforth.css',
'robots.txt',
'esp32-c3-wroom-02.jpg',

View File

@ -30,8 +30,8 @@ REVISION = 'TODO'
CFLAGS_COMMON = [
'-O2',
'-I', '$src/',
'-I', './',
'-I', '$src',
'-I', '$dst',
]
CFLAGS_MINIMIZE = [
@ -128,7 +128,8 @@ NODEJS = LSQ('/usr/bin/nodejs')
output = f"""
ninja_required_version = 1.1
src = ..
src = .
dst = out
VERSION = {VERSION}
REVISION = {REVISION}
CFLAGS = {' '.join(CFLAGS)}
@ -154,7 +155,7 @@ rule importation
description = importation
depfile = $out.d
deps = gcc
command = $src/tools/importation.py -i $in -o $out -I . -I $src $options --depsout $depfile -DVERSION=$VERSION -DREVISION=$REVERSION
command = $src/tools/importation.py -i $in -o $out -I $dst -I $src $options --depsout $depfile -DVERSION=$VERSION -DREVISION=$REVERSION
rule compile
description = CXX
@ -256,12 +257,12 @@ 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:
parts.append(Importation('gen/esp32_' + name + '.h',
parts.append(Importation('$dst/gen/esp32_' + name + '.h',
source, name=name.replace('-', '_') + '_source'))
return Importation('esp32/ESP32forth/optional/' + main_name + '.h',
return Importation('$dst/esp32/ESP32forth/optional/' + main_name + '.h',
main_source,
keep=True,
deps='gen/esp32_optional_' + main_name + '.h.d',
deps='$dst/gen/esp32_optional_' + main_name + '.h.d',
implicit=parts)

View File

@ -12,24 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
Importation('gen/web_boot.js', '$src/web/web_boot.fs', header_mode='web', name='boot')
Compile('gen/dump_web_opcodes', '$src/web/dump_web_opcodes.c')
GenRun('gen/web_cases.js', 'gen/dump_web_opcodes', 'cases', [])
GenRun('gen/web_dict.js', 'gen/dump_web_opcodes', 'dict', [])
GenRun('gen/web_sys.js', 'gen/dump_web_opcodes', 'sys', [])
Importation('$dst/gen/web_boot.js', '$src/web/web_boot.fs', header_mode='web', name='boot')
Compile('$dst/gen/dump_web_opcodes', '$src/web/dump_web_opcodes.c')
GenRun('$dst/gen/web_cases.js', '$dst/gen/dump_web_opcodes', 'cases', [])
GenRun('$dst/gen/web_dict.js', '$dst/gen/dump_web_opcodes', 'dict', [])
GenRun('$dst/gen/web_sys.js', '$dst/gen/dump_web_opcodes', 'sys', [])
WEB_ITEMS = [
GenRun('web/ueforth.js', '$src/web/fuse_web.js', '', [
GenRun('$dst/web/ueforth.js', '$src/web/fuse_web.js', '', [
'$src/web/web.template.js',
'gen/web_boot.js',
'gen/web_dict.js',
'gen/web_cases.js',
'gen/web_sys.js',
'$dst/gen/web_boot.js',
'$dst/gen/web_dict.js',
'$dst/gen/web_cases.js',
'$dst/gen/web_sys.js',
]),
Copy('web/terminal.html', '$src/web/terminal.html'),
Copy('web/lazy_terminal.html', '$src/web/lazy_terminal.html'),
Copy('web/script_lite_test.html', '$src/web/script_lite_test.html'),
Copy('web/script_test.fs', '$src/web/script_test.fs'),
Copy('$dst/web/terminal.html', '$src/web/terminal.html'),
Copy('$dst/web/lazy_terminal.html', '$src/web/lazy_terminal.html'),
Copy('$dst/web/script_lite_test.html', '$src/web/script_lite_test.html'),
Copy('$dst/web/script_test.fs', '$src/web/script_test.fs'),
]
Alias('web', ' '.join(WEB_ITEMS))

View File

@ -15,40 +15,46 @@
Alias('windows', 'win32 win64')
# Create boot.
Importation('gen/windows_boot.h', '$src/windows/windows_boot.fs',
Importation('$dst/gen/windows_boot.h', '$src/windows/windows_boot.fs',
header_mode='win', name='boot')
Importation('gen/windows_boot_extra.h', '$src/windows/windows_boot_extra.fs',
Importation('$dst/gen/windows_boot_extra.h', '$src/windows/windows_boot_extra.fs',
header_mode='win', name='boot_extra')
# Compile Win32.
Alias('win32', ' '.join([
ForthTest('tests/win32_all_tests.out', 'windows/uEf32.exe', '$src/common/all_tests.fs',
ForthTest('$dst/tests/win32_all_tests.out',
'$dst/windows/uEf32.exe', '$src/common/all_tests.fs',
interp='wine'),
]))
CompileW32('windows/uEf32.obj', '$src/windows/main.c',
implicit=['gen/windows_boot.h', 'gen/windows_boot_extra.h'])
LinkW32('windows/uEf32.exe',
' '.join(['windows/uEf32.obj', 'resources/ueforth_res32.res']))
CompileW32('$dst/windows/uEf32.obj', '$src/windows/main.c',
implicit=['$dst/gen/windows_boot.h',
'$dst/gen/windows_boot_extra.h'])
LinkW32('$dst/windows/uEf32.exe',
' '.join(['$dst/windows/uEf32.obj',
'$dst/resources/ueforth_res32.res']))
# Compile Win64.
Alias('win64', ' '.join([
ForthTest('tests/win64_all_tests.out', 'windows/uEf64.exe', '$src/common/all_tests.fs',
ForthTest('$dst/tests/win64_all_tests.out',
'$dst/windows/uEf64.exe', '$src/common/all_tests.fs',
interp='wine'),
]))
CompileW64('windows/uEf64.obj', '$src/windows/main.c',
implicit=['gen/windows_boot.h', 'gen/windows_boot_extra.h'])
LinkW64('windows/uEf64.exe',
' '.join(['windows/uEf64.obj', 'resources/ueforth_res64.res']))
CompileW64('$dst/windows/uEf64.obj', '$src/windows/main.c',
implicit=['$dst/gen/windows_boot.h',
'$dst/gen/windows_boot_extra.h'])
LinkW64('$dst/windows/uEf64.exe',
' '.join(['$dst/windows/uEf64.obj',
'$dst/resources/ueforth_res64.res']))
# Create icon.
ICON_SIZES = [
ResizeImage('resources/eforth16x16.png', '$src/images/eforth.png', '16x16'),
ResizeImage('resources/eforth32x32.png', '$src/images/eforth.png', '32x32'),
ResizeImage('resources/eforth48x48.png', '$src/images/eforth.png', '48x48'),
ResizeImage('resources/eforth256x256.png', '$src/images/eforth.png', '256x256'),
ResizeImage('$dst/resources/eforth16x16.png', '$src/images/eforth.png', '16x16'),
ResizeImage('$dst/resources/eforth32x32.png', '$src/images/eforth.png', '32x32'),
ResizeImage('$dst/resources/eforth48x48.png', '$src/images/eforth.png', '48x48'),
ResizeImage('$dst/resources/eforth256x256.png', '$src/images/eforth.png', '256x256'),
]
ConvertImage('resources/eforth.ico', ' '.join(ICON_SIZES))
CompileResource32('resources/ueforth_res32.res', '$src/windows/ueforth.rc',
implicit=['resources/eforth.ico'])
CompileResource64('resources/ueforth_res64.res', '$src/windows/ueforth.rc',
implicit=['resources/eforth.ico'])
ConvertImage('$dst/resources/eforth.ico', ' '.join(ICON_SIZES))
CompileResource32('$dst/resources/ueforth_res32.res', '$src/windows/ueforth.rc',
implicit=['$dst/resources/eforth.ico'])
CompileResource64('$dst/resources/ueforth_res64.res', '$src/windows/ueforth.rc',
implicit=['$dst/resources/eforth.ico'])