Commit ee10b29f authored by Ben Avison's avatar Ben Avison Committed by ROOL
Browse files

Add tokenised help file functionality to `CModule`

`TOKHELPSRC`, `HELPSRC` and `TOKENS` have the same meaning as in `AAsmModule`.
Because `CModule`, unlike `AAsmModule`, can build a binary from multiple
linked object files, it is also necessary to specify which object file(s)
depend on the autogenerated source file. This is achieved with the new input
variable `TOKHELPDEPENDS`. This defaults to `OBJS` which in turn defaults to
`TARGET`, which should mean that any components converted from `AAsmModule`
will not require any such line to be specified in their master makefile.

Requires RiscOS/Sources/Programmer/Debugger!4
parent ba7efe4d
......@@ -56,6 +56,10 @@ INCLUDED_CMODULE = YES
# DBG_LIBS (opt) (extra debug libraries in addition to SA_LIBS and DEBUGLIBS)
# ROM_DEPEND (opt) (any extra dependency to assert on ROM_TARGET)
# SA_DEPEND (opt) (any extra dependency to assert on SA_TARGET and DBG_TARGET)
# TOKHELPDEPENDS (opt) (set to any source files which need to include any autogenerated tokenised help file - otherwise ${OBJS})
# TOKHELPSRC (opt) (set equal to ${TOKENSOURCE} to indicate that the binary depends on autogenerated tokenised help source file of that name)
# HELPSRC (opt) (set to filename containing untokenised help messages if ${TOKHELPSRC} = ${TOKENSOURCE})
# TOKENS (opt) (set to filename containing help message tokens - otherwise ${HDRDIR}/Global/Tokens)
# CUSTOMEXP (opt) (set to "custom" to override the export rules)
# CUSTOMRES (opt) (set to "custom" to override the resources rules, or "no" for no resources)
# CUSTOMROM (opt) (set to "custom" to override the rom rules)
......@@ -166,6 +170,7 @@ RESDIR ?= ${MERGEDRDIR}
SA_OBJS += ${RES_OBJ}
DBG_OBJS += ${RES_OBJ}
endif
TOKHELPDEPENDS ?= ${OBJS}
ROM_LIBS ?= ${LIBS}
SA_LIBS ?= ${LIBS}
ROM_LIBS += ${ROMCSTUBS}
......@@ -197,6 +202,10 @@ ifneq ($(filter debug%,${MAKECMDGOALS}),)
CMHGFLAGS += ${CMHGDFLAGS} # Affects both object and header generation
endif
TOKENS ?= ${HDRDIR}/Global/Tokens
# Unlike with AAsmModule, we enforce this filename, to prevent any cross-compilation issues being introduced
TOKENSOURCE := TokHelpSrc.s
SOURCES_TO_SYMLINK += $(wildcard c/*) $(wildcard c++/*) $(wildcard cmhg/*) $(wildcard h/*) $(wildcard hdr/*) $(wildcard s/*) VersionNum VersionASM
ifneq (objs,$(notdir ${CURDIR}))
......@@ -314,6 +323,14 @@ CMHGDEPENDS_ = $(addsuffix .o,${CMHGDEPENDS}) $(addsuffix .od,${CMHGDEPENDS}) $(
${CMHGDEPENDS_}: ${CMHGFILE}.h
endif
ifeq (${TOKHELPSRC},${TOKENSOURCE})
TOKHELPDEPENDS_ = $(addsuffix .o,${TOKHELPDEPENDS}) $(addsuffix .od,${TOKHELPDEPENDS})
${TOKHELPDEPENDS_}: ${TOKHELPSRC}
endif
${TOKENSOURCE}: ${HELPSRC} ${TOKENS}
${TOKENISE} ${TOKENS} ${HELPSRC} $@
ifeq ("${MODULEWRAP}","yes")
modulewrap.s: ${LIBDIR}/RISC_OSLib/modulewrap.s
${CP} $^ $@
......
......@@ -72,6 +72,10 @@ INCLUDED_CMODULE = YES
# DBG_LIBS (opt) (extra debug libraries in addition to SA_LIBS and DEBUGLIBS)
# ROM_DEPEND (opt) (any extra dependency to assert on ROM_TARGET)
# SA_DEPEND (opt) (any extra dependency to assert on SA_TARGET and DBG_TARGET)
# TOKHELPDEPENDS (opt) (set to any source files which need to include any autogenerated tokenised help file - otherwise ${OBJS})
# TOKHELPSRC (opt) (set equal to ${TOKENSOURCE} to indicate that the binary depends on autogenerated tokenised help source file of that name)
# HELPSRC (opt) (set to filename containing untokenised help messages if ${TOKHELPSRC} = ${TOKENSOURCE})
# TOKENS (opt) (set to filename containing help message tokens - otherwise Hdr:Tokens)
# CUSTOMEXP (opt) (set to "custom" to override the export rules)
# CUSTOMRES (opt) (set to "custom" to override the resources rules, or "no" for no resources)
# CUSTOMROM (opt) (set to "custom" to override the rom rules)
......@@ -187,6 +191,7 @@ RESDIR ?= ${MERGEDRDIR} # Place to internally collect up contents of RES_
SA_OBJS += ${RES_OBJ}
DBG_OBJS += ${RES_OBJ}
endif
TOKHELPDEPENDS ?= ${OBJS}
ROM_LIBS ?= ${LIBS}
SA_LIBS ?= ${LIBS}
ROM_LIBS += ${ROMCSTUBS}
......@@ -218,6 +223,10 @@ ifneq ($(filter debug%,${MAKECMDGOALS}),)
CMHGFLAGS += ${CMHGDFLAGS} # Affects both object and header generation
endif
TOKENS ?= Hdr:Tokens
# Unlike with AAsmModule, we enforce this filename, to prevent any cross-compilation issues being introduced
TOKENSOURCE := s.TokHelpSrc
ASM2TXT_BASE := $(word 1,${ASM2TXT})
ASM2TXT_EXT := $(word 2,${ASM2TXT})
ifneq ("${ASM2TXT_EXT}","")
......@@ -293,6 +302,7 @@ clean ::
@IfThere rm Then ${WIPE} rm ${WFLAGS}
@IfThere h.${CMHGFILE} Then ${ECHO} ${RM} h.${CMHGFILE}
@IfThere h.${CMHGFILE} Then ${RM} h.${CMHGFILE}
@-${RM} ${TOKENSOURCE}
ifneq ("${ASM2TXT}","")
@-${RM} ${ASM2TXT_SUBDIR}${ASM2TXT_EXT}${ASM2TXT_BASE}
endif
......@@ -335,6 +345,14 @@ CMHGDEPENDS_ = $(addprefix o.,${CMHGDEPENDS}) $(addprefix od.,${CMHGDEPENDS}) $(
${CMHGDEPENDS_}: h.${CMHGFILE}
endif
ifeq (${TOKHELPSRC},${TOKENSOURCE})
TOKHELPDEPENDS_ = $(addprefix o.,${TOKHELPDEPENDS}) $(addprefix od.,${TOKHELPDEPENDS})
${TOKHELPDEPENDS_}: ${TOKHELPSRC}
endif
${TOKENSOURCE}: ${HELPSRC} ${TOKENS}
${TOKENISE} ${TOKENS} ${HELPSRC} $@
ifeq ("${MODULEWRAP}","yes")
s.modulewrap: RISCOSLIB:s.modulewrap
${CP} RISCOSLIB:s.modulewrap $@ ${CPFLAGS}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment