Fixed gen dependencies.

This commit is contained in:
Brad Nelson
2023-12-22 14:33:08 -08:00
parent ca05d3b6b0
commit f882c97f60
4 changed files with 95 additions and 58 deletions

View File

@ -95,6 +95,7 @@ TARGETS = posix_target \
web_target \ web_target \
esp32_target \ esp32_target \
esp32_sim_target \ esp32_sim_target \
pico_ice_target \
pico_ice_sim_target pico_ice_sim_target
TESTS = posix_tests web_tests esp32_sim_tests TESTS = posix_tests web_tests esp32_sim_tests
@ -233,73 +234,57 @@ sanity_test_web: $(WEB)/ueforth.js
$(GEN): $(GEN):
mkdir -p $@ mkdir -p $@
COMMON_PHASE1 = common/comments.fs \ -include $(GEN)/posix_boot_merged.fs.dd
common/boot.fs \
common/io.fs \
common/conditionals.fs \
common/vocabulary.fs \
common/floats.fs \
common/structures.fs
COMMON_PHASE1e = common/comments.fs \ $(GEN)/posix_boot_merged.fs: posix/posix_boot.fs | $(GEN)
common/tier2a_forth.fs \ ./tools/importation.py $< $@ \
common/boot.fs \ -I . -I $(GEN) --depsout $@.dd \
common/tier2b_forth.fs \
common/io.fs \
common/conditionals.fs \
common/vocabulary.fs \
common/floats.fs \
common/structures.fs
COMMON_PHASE2 = common/utils.fs common/code.fs common/locals.fs common/case.fs
COMMON_FILETOOLS = common/tasks.fs common/streams.fs \
common/filetools.fs common/including.fs \
common/blocks.fs common/ansi.fs \
common/visual.fs
COMMON_DESKTOP = common/desktop.fs \
common/graphics.fs common/graphics_utils.fs common/heart.fs
$(GEN)/posix_boot_merged.fs: tools/importation.py posix/posix_boot.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \ --set-version $(VERSION) \
--set-revision $(REVISION) >$@ --set-revision $(REVISION)
$(GEN)/posix_boot.h: tools/source_to_string.js $(GEN)/posix_boot_merged.fs | $(GEN) $(GEN)/posix_boot.h: tools/source_to_string.js $(GEN)/posix_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/posix_boot_merged.fs >$@ $< boot $(VERSION) $(REVISION) $(GEN)/posix_boot_merged.fs >$@
$(GEN)/windows_boot_extra_merged.fs: \ -include $(GEN)/windows_boot_extra_merged.fs.dd
tools/importation.py windows/windows_boot_extra.fs | $(GEN)
$^ -I . -I $(GEN) \ $(GEN)/windows_boot_extra_merged.fs: windows/windows_boot_extra.fs | $(GEN)
./tools/importation.py $< $@ \
-I . -I $(GEN) --depsout $@.dd \
--set-version $(VERSION) \ --set-version $(VERSION) \
--set-revision $(REVISION) >$@ --set-revision $(REVISION)
$(GEN)/windows_boot_extra.h: tools/source_to_string.js $(GEN)/windows_boot_extra_merged.fs | $(GEN) $(GEN)/windows_boot_extra.h: tools/source_to_string.js $(GEN)/windows_boot_extra_merged.fs | $(GEN)
$< -win boot_extra $(VERSION) $(REVISION) $(GEN)/windows_boot_extra_merged.fs >$@ $< -win boot_extra $(VERSION) $(REVISION) $(GEN)/windows_boot_extra_merged.fs >$@
$(GEN)/windows_boot_merged.fs: tools/importation.py windows/windows_boot.fs | $(GEN) -include $(GEN)/windows_boot_merged.fs.dd
$^ -I . -I $(GEN) \
$(GEN)/windows_boot_merged.fs: windows/windows_boot.fs | $(GEN)
./tools/importation.py $^ $@ \
-I . -I $(GEN) --depsout $@.dd \
--set-version $(VERSION) \ --set-version $(VERSION) \
--set-revision $(REVISION) >$@ --set-revision $(REVISION)
$(GEN)/windows_boot.h: tools/source_to_string.js $(GEN)/windows_boot_merged.fs | $(GEN) $(GEN)/windows_boot.h: tools/source_to_string.js $(GEN)/windows_boot_merged.fs | $(GEN)
$< -win boot $(VERSION) $(REVISION) $(GEN)/windows_boot_merged.fs >$@ $< -win boot $(VERSION) $(REVISION) $(GEN)/windows_boot_merged.fs >$@
$(GEN)/pico_ice_boot_merged.fs: \ -include $(GEN)/pico_ice_boot_merged.fs.dd
tools/importation.py pico-ice/pico_ice_boot.fs | $(GEN)
$^ -I . -I $(GEN) \ $(GEN)/pico_ice_boot_merged.fs: pico-ice/pico_ice_boot.fs | $(GEN)
./tools/importation.py $^ $@ \
-I . -I $(GEN) --depsout $@.dd \
--set-version $(VERSION) \ --set-version $(VERSION) \
--set-revision $(REVISION) >$@ --set-revision $(REVISION)
$(GEN)/pico_ice_boot.h: tools/source_to_string.js $(GEN)/pico_ice_boot_merged.fs | $(GEN) $(GEN)/pico_ice_boot.h: tools/source_to_string.js $(GEN)/pico_ice_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/pico_ice_boot_merged.fs >$@ $< boot $(VERSION) $(REVISION) $(GEN)/pico_ice_boot_merged.fs >$@
$(GEN)/esp32_boot_merged.fs: \ -include $(GEN)/esp32_boot_merged.fs.dd
tools/importation.py esp32/esp32_boot.fs | $(GEN)
$^ -I . -I $(GEN) \ $(GEN)/esp32_boot_merged.fs: esp32/esp32_boot.fs | $(GEN)
./tools/importation.py $^ $@ \
-I . -I $(GEN) --depsout $@.dd \
--set-version $(VERSION) \ --set-version $(VERSION) \
--set-revision $(REVISION) >$@ --set-revision $(REVISION)
$(GEN)/esp32_boot.h: tools/source_to_string.js $(GEN)/esp32_boot_merged.fs | $(GEN) $(GEN)/esp32_boot.h: tools/source_to_string.js $(GEN)/esp32_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/esp32_boot_merged.fs >$@ $< boot $(VERSION) $(REVISION) $(GEN)/esp32_boot_merged.fs >$@
@ -390,15 +375,16 @@ $(GEN)/web_dict.js: $(GEN)/dump_web_opcodes | $(GEN)
$(GEN)/web_sys.js: $(GEN)/dump_web_opcodes | $(GEN) $(GEN)/web_sys.js: $(GEN)/dump_web_opcodes | $(GEN)
$< sys >$@ $< sys >$@
WEB_BOOT = $(COMMON_PHASE1e) \ -include $(GEN)/web_boot_merged.fs.dd
web/platform.fs \
common/ansi.fs \ $(GEN)/web_boot_merged.fs: web/web_boot.fs | $(GEN)
$(COMMON_PHASE2) \ ./tools/importation.py $^ $@ \
common/tasks.fs \ -I . -I $(GEN) --depsout $@.dd \
web/utils.fs \ --set-version $(VERSION) \
web/fini.fs --set-revision $(REVISION)
$(GEN)/web_boot.js: tools/source_to_string.js $(WEB_BOOT) | $(GEN)
$< -web boot $(VERSION) $(REVISION) $(WEB_BOOT) >$@ $(GEN)/web_boot.js: tools/source_to_string.js $(GEN)/web_boot_merged.fs | $(GEN)
$< -web boot $(VERSION) $(REVISION) $(GEN)/web_boot_merged.fs >$@
# ---- RESOURCES ---- # ---- RESOURCES ----

23
common/phase1e.fs Normal file
View File

@ -0,0 +1,23 @@
\ Copyright 2023 Bradley D. Nelson
\
\ Licensed under the Apache License, Version 2.0 (the "License");
\ you may not use this file except in compliance with the License.
\ You may obtain a copy of the License at
\
\ http://www.apache.org/licenses/LICENSE-2.0
\
\ Unless required by applicable law or agreed to in writing, software
\ distributed under the License is distributed on an "AS IS" BASIS,
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\ See the License for the specific language governing permissions and
\ limitations under the License.
needs comments.fs
needs tier2a_forth.fs
needs boot.fs
needs tier2b_forth.fs
needs io.fs
needs conditionals.fs
needs vocabulary.fs
needs floats.fs
needs structures.fs

View File

@ -7,15 +7,17 @@ import sys
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='importation', prog='importation',
description='Imports header / fs files') description='Imports header / fs files')
parser.add_argument('filename') parser.add_argument('input')
parser.add_argument('output')
parser.add_argument('-I', action='append') parser.add_argument('-I', action='append')
parser.add_argument('--set-version') parser.add_argument('--set-version')
parser.add_argument('--set-revision') parser.add_argument('--set-revision')
parser.add_argument('--depsout')
args = parser.parse_args() args = parser.parse_args()
bases = args.I or [] bases = args.I or []
results = [] results = []
imported = set() imported = set([__file__])
def Import(filename): def Import(filename):
filename = os.path.abspath(filename) filename = os.path.abspath(filename)
@ -46,12 +48,17 @@ def Import(filename):
results.append(line) results.append(line)
def Process(): def Process():
Import(args.filename) Import(args.input)
for line in results: for line in results:
if args.set_version: if args.set_version:
line = line.replace('{{VERSION}}', args.set_version) line = line.replace('{{VERSION}}', args.set_version)
if args.set_revision: if args.set_revision:
line = line.replace('{{REVISION}}', args.set_revision) line = line.replace('{{REVISION}}', args.set_revision)
print('\n'.join(results)) if args.depsout:
with open(args.depsout, 'w') as fh:
fh.write(args.output + ': ' +
' '.join([os.path.relpath(i) for i in imported]) + '\n')
with open(args.output, 'w') as fh:
fh.write('\n'.join(results) + '\n')
Process() Process()

21
web/web_boot.fs Normal file
View File

@ -0,0 +1,21 @@
\ Copyright 2023 Bradley D. Nelson
\
\ Licensed under the Apache License, Version 2.0 (the "License");
\ you may not use this file except in compliance with the License.
\ You may obtain a copy of the License at
\
\ http://www.apache.org/licenses/LICENSE-2.0
\
\ Unless required by applicable law or agreed to in writing, software
\ distributed under the License is distributed on an "AS IS" BASIS,
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\ See the License for the specific language governing permissions and
\ limitations under the License.
needs ../common/phase1e.fs
needs platform.fs
needs ../common/ansi.fs
needs ../common/phase2.fs
needs ../common/tasks.fs
needs utils.fs
needs fini.fs