Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
B BuildSys
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • RiscOS
  • BuildSys
  • Merge requests
  • !62

Open
Created Jan 31, 2023 by Ben Avison@bavisonDeveloper
  • Report abuse
Report abuse

Draft: Change how top-level phony rules are overridden

  • Overview 0
  • Commits 1
  • Changes 10

A common pattern previously in use was for a shared makefile to define a top-level phony rule (the sort of thing that srcbuild or a !Mk file would use as the target to pass to amu) but with a macro expansion within the rule name. This allowed clients to override the rule by assigning any value to the macro.

However, this approach makes it relatively difficult for clients to be adapted to support cross-compilation. This is because when cross-compiling, the shared makefiles utilise nested invocations of the make tool in order to facilitate an out-of-tree build directory layout. Therefore, clients need to determine whether they are cross-compiling, and if so, whether they are in the context of the inner or outer make invocation, before they can decide whether or not to redefine the phony target. This can be achieved in as little as 3 extra lines:

CURDIR ?= objs
ifeq (objs,$(notdir ${CURDIR}))
# redefinitions of top-level phony rules placed here
endif

but this wasn't universally popular. Instead, taking inspiration from INSTTYPE, we can chain from each ${PHONY} rule to a ${PHONY}_custom rule and have the client makefile define the ${PHONY}_custom rule instead. Crucially, in the cross-compiling case, the shared makefile can then take care of ensuring this only happens on the inner make invocation.

In summary:

When setting CUSTOMEXP to custom, clients should henceforth

  • define export_hdrs_custom and export_libs_custom rather than redefine export
  • define export_hdrs_custom rather than redefine export_hdrs
  • define export_libs_custom rather than redefine export_libs

When setting CUSTOMROM to custom, clients should henceforth

  • define install_rom_custom rather than redefine install_rom
  • define rom_custom rather than redefine rom
  • define rom_link_custom rather than redefine rom_link

When setting CUSTOMSA to custom, clients should henceforth

  • define install_custom rather than redefine install
  • define standalone_custom rather than redefine standalone

CUSTOMDBG and CUSTOMGPA are now removed. These were not being used by any client makefiles, but it seems probable that the rules they related to (debug and gpa_debug respectively) would have needed overriding in precisely the same circumstances as install and standalone, so in future CUSTOMSA should be used for these also.

Merge requests have also been raised for all the affected client makefiles to prepare them for this change. These should be merged first:

  • RiscOS/Sources/FileSys/ADFS/ADFSFiler!6
  • RiscOS/Sources/Networking/AUN/AUNMsgs!2
  • RiscOS/Sources/Networking/Ethernet/EtherCPSW!4
  • RiscOS/Sources/Networking/Ethernet/EtherGENET!3
  • RiscOS/Sources/Networking/Ethernet/EtherK!1
  • RiscOS/Sources/Networking/Ethernet/EtherUSB!4
  • RiscOS/Sources/Networking/Ethernet/EtherY!1
  • RiscOS/Sources/FileSys/FSLock!5
  • RiscOS/Sources/Networking/Fetchers/Gopher!2 (closed)
  • RiscOS/Sources/SystemRes/InetRes!24
  • RiscOS/Sources/Kernel!69
  • RiscOS/Sources/Internat/Territory/TerritoryModule!2
  • RiscOS/Sources/Toolbox/ToolAction!3
  • RiscOS/Sources/HWSupport/USB/USBDriver!11
  • RiscOS/Sources/Desktop/Wimp!35

Once this MR is merged, amu will start to emit warnings when building each of them about redefinition of the affected phony targets in those client makefiles, however, those are harmless and can safely be ignored. It is proposed that as and when each of those makefiles is updated to support cross-compilation, the redundant phony target rules be removed.

A ROM build has been completed successfully to ensure the merge requests work in conjunction.

Edited Feb 01, 2023 by Ben Avison
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: targets