Fixup ninja build more.

This commit is contained in:
Brad Nelson
2023-12-23 18:14:32 -08:00
parent 7455e6b511
commit 8f0aaba643
7 changed files with 61 additions and 26 deletions

7
BUILD
View File

@ -17,3 +17,10 @@ Include('windows')
Include('web')
Include('pico-ice')
Include('esp32')
Default('win32')
Default('win64')
Default('unix')
Default('html')
Default('esp')
Default('pico')

View File

@ -12,38 +12,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ESP32_FILES = []
# Main .ino file.
Mkdir('esp32/ESP32forth')
Importation('esp32/ESP32forth/README.txt',
'$src/esp32/README.txt')
ESP32_FILES += [
Importation('esp32/ESP32forth/README.txt',
'$src/esp32/README.txt'),
Importation('esp32/ESP32forth/ESP32forth.ino',
'$src/esp32/ESP32forth.ino',
implicit=['gen/esp32_boot.h'], keep=True),
]
Importation('gen/esp32_boot.h', '$src/esp32/esp32_boot.fs', name='boot')
Importation('esp32/ESP32forth/ESP32forth.ino',
'$src/esp32/ESP32forth.ino',
implicit=['gen/esp32_boot.h'], keep=True)
# Optional Compontents.
Mkdir('esp32/ESP32forth/optional')
Importation('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',
[('assembler', '$src/common/assembler.fs'),
('xtensa-assembler', '$src/esp32/optional/assemblers/xtensa-assembler.fs'),
('riscv-assembler', '$src/esp32/optional/assemblers/riscv-assembler.fs')])
Esp32Optional('camera', '$src/esp32/optional/camera/camera.h',
[('camera', '$src/esp32/optional/camera/camera_server.fs')])
Esp32Optional('interrupts', '$src/esp32/optional/interrupts/interrupts.h',
[('interrupts', '$src/esp32/optional/interrupts/timers.fs')])
Esp32Optional('oled', '$src/esp32/optional/oled/oled.h',
[('oled', '$src/esp32/optional/oled/oled.fs')])
Esp32Optional('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.h',
[('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.fs')])
Esp32Optional('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.h',
[('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.fs')])
ESP32_FILES = [
Importation('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',
[('assembler', '$src/common/assembler.fs'),
('xtensa-assembler', '$src/esp32/optional/assemblers/xtensa-assembler.fs'),
('riscv-assembler', '$src/esp32/optional/assemblers/riscv-assembler.fs')]),
Esp32Optional('camera', '$src/esp32/optional/camera/camera.h',
[('camera', '$src/esp32/optional/camera/camera_server.fs')]),
Esp32Optional('interrupts', '$src/esp32/optional/interrupts/interrupts.h',
[('interrupts', '$src/esp32/optional/interrupts/timers.fs')]),
Esp32Optional('oled', '$src/esp32/optional/oled/oled.h',
[('oled', '$src/esp32/optional/oled/oled.fs')]),
Esp32Optional('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.h',
[('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.fs')]),
Esp32Optional('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.h',
[('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.fs')]),
]
# Simulator.
Mkdir('esp32-sim')
Compile('gen/print-esp32-builtins', '$src/esp32/print-builtins.cpp')
ESP32_FILES += [
Compile('esp32-sim/esp32-sim', '$src/esp32/sim_main.cpp',
implicit=['gen/esp32_boot.h', '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('esp32-sim/esp32-sim', '$src/esp32/sim_main.cpp',
implicit=['gen/esp32_boot.h', 'gen/esp32_sim_opcodes.h'])
# Main Alias.
Alias('esp', ' '.join(ESP32_FILES))

View File

@ -12,4 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
Alias('pico', 'gen/pico_ice_boot.h')
Importation('gen/pico_ice_boot.h', '$src/pico-ice/pico_ice_boot.fs', name='boot')

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
Alias('unix', 'posix/ueforth')
Importation('gen/posix_boot.h', '$src/posix/posix_boot.fs', name='boot')
Compile('posix/ueforth', '$src/posix/main.c',
implicit=['gen/posix_boot.h'])

View File

@ -234,7 +234,7 @@ def Esp32Optional(main_name, main_source, parts):
source, name=name.replace('-', '_') + '_source')
if not main_source:
main_source = 'gen/esp32_' + main_name + '.h'
Importation('esp32/ESP32forth/optional/' + main_name + '.h',
return Importation('esp32/ESP32forth/optional/' + main_name + '.h',
main_source,
keep=True,
deps='gen/esp32_optional_' + main_name + '.h.dd',
@ -292,6 +292,18 @@ def Run(target, source, implicit=[]):
return Simple('run', target, source, implicit)
def Alias(target, source):
global output
output += f'build {target}: phony {source}\n'
return target
def Default(target):
global output
output += f'default {target}\n'
return target
def Include(path):
Mkdir(path)
path = os.path.join(ROOT_DIR, path, 'BUILD')

View File

@ -12,4 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
Alias('html', 'gen/web_boot.js')
Importation('gen/web_boot.js', '$src/web/web_boot.fs', header_mode='web', name='boot')

View File

@ -19,12 +19,14 @@ Importation('gen/windows_boot_extra.h', '$src/windows/windows_boot_extra.fs',
header_mode='win', name='boot_extra')
# Compile Win32.
Alias('win32', 'windows/uEf32.exe')
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']))
# Compile Win64.
Alias('win64', 'windows/uEf64.exe')
CompileW64('windows/uEf64.obj', '$src/windows/main.c',
implicit=['gen/windows_boot.h', 'gen/windows_boot_extra.h'])
LinkW64('windows/uEf64.exe',