1. 11 Dec, 2020 1 commit
    • Ben Avison's avatar
      Introduce new shared makefile fragments for BASIC components · c07ca290
      Ben Avison authored
      The `BasicApp` fragment is analogous to the `CApp` fragment in that it
      supports both single-file executables and application directories. Rules are
      included for building any such application directories into ROMs, with
      files destined for `Resources:$.Resources` being exported to the Messages
      module during the `resources` phase, and those destinated for
      `Resources:$.Apps` being built into a position-independent module, so that
      when the module is killed or unplugged, those files disappear from ResourceFS.
      
      Because the module is position-independent, the makefile fragment implements
      the `install_rom` rule rather than the `rom_link` rule used by `CApp`. This
      is consistent with how `srcbuild` already installs ROM components listed in
      the ModuleDB as being of type `BAS`.
      
      The other main difference from `CApp` is that there is no compilation or
      linking step. Tokenisation, crunching and squishing of the (untokenised)
      source files are roughly analogous to the compilation steps, except that
      multiple source files are concatenated (if applicable) as the first step.
      There is also no debug build variant, and so no `debug` rule.
      
      Crunching is performed (on native builds) using the `BasCrunch` tool, so if
      you are converting an existing component which includes its own Command
      script to perform tokenisation and crunching, this will no longer be needed.
      
      Cross-"compilation" is fully suported. This uses the new `toffb` tool for
      tokenisation (apologies for the wheel-reinvention, but this was developed in
      ignorance about Steve Fryatt's `Tokenize` tool; `toffb` also does do a more
      faithful job of replicating BASIC's `CRUNCH` options, so is more useful for
      ensuring cross-compilation builds remain identical to the native builds).
      It also uses Matrix Brandy (V1.22.9 or later) to execute Squish (at least
      RiscOS/Tools/Sources/Squish!1).
      
      We pass the new `-nosavepath` option to Squish to ensure that the results are
      identical for cross-compile builds compared to native ones. However, Squish
      ignores unrecognised command-line options, so this does not introduce a
      dependency on a newer Squish tool for native builds.
      
      One subtle enhancement over previous makefiles is that we create dynamic
      dependencies between the crunched-and-squished program and its untokenised
      source files.
      c07ca290