# Makefile fragment for assembler modules, previously built using AAsm but now using objasm
# Such modules are characterised by the use of position-independent code
# and multiple source files (if applicable) linked at the assembly stage
# (using LNK and GET directives) rather than at the link stage.

INCLUDED_AASMMODULE = YES

#
# This makefile provides the following phony targets:
#
#    all     rom           install_rom   rom_link           resources
#    export  export_libs   export_hdrs   standalone         install
#    clean   debug         gpa_debug
#
#
# This fragment uses the following macros set by the master makefile.
#
#
# COMPONENT             (the name of the component)
# TARGET          (opt) (the leafname of the module - otherwise ${COMPONENT})
# ROM_MODULE      (opt) (output filename - otherwise ${TARGET})
# ROM_OBJECT      (opt) (object file for romming - otherwise ${TARGET}.o)
# ROM_LIBS        (opt) (libraries to link again ROM_OBJECT to generate ROM_MODULE)
# ROM_DEPEND      (opt) (any extra dependency to assert on ROM_MODULE)
# DBG_MODULE      (opt) (output filename for debug - otherwise ${TARGET}D
# DBG_OBJECT      (opt) (object file for debug - otherwise ${TARGET}D.o
# DBG_LIBS        (opt) (libraries to link against DBG_OBJECT to generate DBG_MODULE - otherwise ${ROM_LIBS})
# SA_MODULE       (opt) (output filename for softload - otherwise ${TARGET}SA
# SA_OBJECT       (opt) (object file for softload - otherwise ${TARGET}SA.o
# SA_LIBS         (opt) (libraries to link against SA_OBJECT to generate SA_MODULE - otherwise ${ROM_LIBS})
# SA_DEPEND       (opt) (any extra dependency to assert on SA_MODULE and DBG_MODULE)
# DIRS            (opt) (magic target to ensure object directories are present - otherwise _dirs)
# HEADER[1-3]     (opt) (leafname of file in hdr to copy to ${EXPORTDIR} on export_hdrs)
# ASMCHEADER[1-3] (opt) (C-from-assembly auto-generated header files to export, no Hdr. prefix - otherwise none)
# CHEADER[1-3]    (opt) (C header files to export - otherwise none)
# EXPORTS         (opt) (list of C and C-from-assembly headers to export)
# C_EXP_HDR       (opt) (C header target directory - otherwise ${CEXPORTDIR}/Interface)
# EXP_HDR         (opt) (directory for exported assembler interface headers)
# INSTRES_FILES   (opt) (extra resource files in addition to Messages - use InstRes specification rules)
# INSTRAM_FILES   (opt) (RAM build specific resources - otherwise ${INSTRES_FILES})
# INSTROM_FILES   (opt) (ROM build specific resources - otherwise ${INSTRES_FILES})
# INSTR??_DEPENDS (opt) (any extra dependency to assert on INSTRES/INSTRAM/INSTROM_FILES)
# INSTRES_VERSION (opt) (if set to "Messages", automatically insert version into Messages file during resources phase)
# MERGEDMSGS      (r/o) (leafname of generated Messages file)
# RESFSDIR        (opt) (actual directory to export resources to - otherwise ${RESDIR}/${TARGET})
# 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)
# CUSTOMSA        (opt) (set to "custom" to override the standalone rules)
# CUSTOMDBG       (opt) (set to "custom" to override the debug rules)
# CUSTOMGPA       (opt) (set to "custom" to override the GPA rules)
# SOURCES_TO_SYMLINK opt) (files which need be linked to by the link farm, in addition to contents of hdr and s directories)
#
#
# It relies on the following from the build system:
#
#
# INSTDIR          (installation directory for ROM_MODULE or disc install)
# INSTALLDIR       (if INSTDIR was not specified by the build system)
# RESDIR           (installation directory for resources - cf. RESFSDIR)
# EXPORTDIR        (export directory for assembler interface headers)
# CEXPORTDIR       (export directory for C interface headers)
# HDRDIR           (top-level export directory for assembler headers)
# CMDHELP          (optional, set to None to exclude syntax errors from Messages)
# PHASE            (export phase discriminator)
# INSERTVERSION    (awk script to substitute from VersionNum)
#
#
# It relies on the following generic tool macros from the Tools makefile
#
# CP + CPFLAGS     (copy, cp etc.)
# AS + ASFLAGS     (assembler)
# MKDIR            (cdir/mkdir -p)
# RM + WIPE        (deletions)
# ECHO
# LD               (linker)
#
#

TARGET     ?= ${COMPONENT}
INSTDIR    ?= ${INSTALLDIR}
ROM_MODULE ?= ${TARGET}${SUFFIX_MODULE}
ROM_SOURCE ?= ${TARGET}.s
ROM_OBJECT ?= ${TARGET}.o
DIRS       ?= _dirs
EXP_HDR    ?= ${EXPORTDIR}
C_EXP_HDR  ?= ${CEXPORTDIR}/Interface

SA_MODULE  ?= ${TARGET}SA${SUFFIX_MODULE}
SA_OBJECT  ?= ${TARGET}SA.o
INSTRAM_FILES   ?= ${INSTRES_FILES}
INSTRAM_DEPENDS ?= ${INSTRES_DEPENDS}
INSTROM_FILES   ?= ${INSTRES_FILES}
INSTROM_DEPENDS ?= ${INSTRES_DEPENDS}
MERGEDRDIR ?= _ResData_
MERGEDMSGS ?= ${MERGEDRDIR}/${TARGET}/Messages
RESFSDIR   ?= ${RESDIR}/${TARGET}
RESAPPDIR  ?= ${RESDIR}/../Apps/${APP}
ifeq (${CMDHELP},None)
SA_FLAGS   ?= -PD "standalone SETL {TRUE}" -PD "MergedMsgs SETS \"${MERGEDMSGS}\"" -PD "international_help SETL {FALSE}"
else
SA_FLAGS   ?= -PD "standalone SETL {TRUE}" -PD "MergedMsgs SETS \"${MERGEDMSGS}\""
endif
SA_LIBS    ?= ${ROM_LIBS}

DBG_MODULE ?= ${TARGET}D${SUFFIX_MODULE}
DBG_OBJECT ?= ${TARGET}D.o
DBG_LIBS   ?= ${ROM_LIBS}

#GPA_FILE   ?= ${TARGET}.gpa
#GPA_AIF    ?= ${TARGET}.aif

TOKENS     ?= ${HDRDIR}/Global/Tokens

TOKENSOURCE ?= TokHelpSrc.s

ifeq ($(filter rom%,${MAKECMDGOALS}),)
RES_FILES_    = ${INSTRAM_FILES}
RES_DEPENDS_  = ${INSTRAM_DEPENDS}
else
RES_FILES_    = ${INSTROM_FILES}
RES_DEPENDS_  = ${INSTROM_DEPENDS}
endif

SOURCES_TO_SYMLINK += $(wildcard h/*) $(wildcard hdr/*) $(wildcard s/*) Resources VersionNum VersionASM

ifeq ("${INCLUDED_STDTOOLS}","")
include StdTools
endif

ifneq (objs,$(notdir ${CURDIR}))

# Makefile invoked from same directory
# Create link farm, then execute the makefile from within it

ifeq (clean,${MAKECMDGOALS})
# With a double-colon rule which can have additional actions assigned from the
# master makefile, we'd normally need the master makefile to include the
# ${CURDIR} check to ensure that it's performed on the same invocation as us.
# However, there's no real benefit to performing clean from within the objs
# directory, and it adds an ordering problem between the different double-colon
# rules (the one that deletes the objs directory has to be last otherwise the
# cwd is invalid for the others) so to simplify things, we only ever do cleans
# from the same directory as the Makefile.
clean::
	@echo Cleaning...
	@rm -rf objs
	@echo ${COMPONENT}: cleaned
else
ifneq (,${SYMLINK_EXT_FIRST})
SYMLINK_SED_PATTERN = 's,^\([^/]\+\)/\(.\+\),\2.\1,'
else
SYMLINK_SED_PATTERN = 's,\([^/]\+\)/\([^/]\+\)$$,\2.\1,'
endif
all debug export export_hdrs export_libs gpa_debug install install_rom rom_link links resources rom standalone: ${SYMLINK_DEPEND}
	$(foreach linksource,${SOURCES_TO_SYMLINK}, \
		$(shell \
			linkdest=`echo ${linksource} | sed -e ${SYMLINK_SED_PATTERN} -e 's,^,objs/,'`; \
			linkdestdir=`echo $$linkdest | sed -e 's,/[^/]\+$$,,'`; \
			linkbackpath=`echo $$linkdestdir | sed -e 's,[^/]\+,..,g'`; \
			[ -d ${linksource} ] || [ -L $$linkdest ] || mkdir -p $$linkdestdir; \
			[ -d ${linksource} ] || [ -L $$linkdest ] || ln -s $$linkbackpath/${linksource} $$linkdest; \
		 ) \
	)
	@[ -L objs/Resources ] || ln -s ../Resources objs/Resources
	@mkdir -p objs
ifneq (links,${MAKECMDGOALS})
	@${MAKE} -C objs -f ../$(firstword ${MAKEFILE_LIST}) ${MAKECMDGOALS}
endif
endif

else

# Makefile invoked from objs subdirectory

all: rom debug standalone

# GNU make seems to treat any double-colon rule with no dependencies as
# always out-of-date, therefore always rebuilds it and anything which in turn
# depends on the target of the double-colon rule. So use a single-colon rule
# instead. If any cross builds need to create extra directories on a
# per-component basis, we'll cross that bridge when we get to it.
${DIRS}:
	${TOUCH} $@

#
# ROM build rules
#
rom${CUSTOMROM}: ${ROM_MODULE}
	@${ECHO} ${COMPONENT}: rom module built

install_rom${CUSTOMROM}: ${ROM_MODULE}
	${CP} ${ROM_MODULE} ${INSTDIR}/${TARGET} ${CPFLAGS}
	#${CP} ${ROM_MODULE}_gpa ${INSTDIR}/${TARGET}_gpa ${CPFLAGS}
	@${ECHO} ${COMPONENT}: rom module installed

rom_link${CUSTOMROM}: ${ROM_MODULE}
ifeq (GNU,${TOOLCHAIN})
	${CP} ${ROM_MODULE} ${LINKDIR}/${TARGET} ${CPFLAGS}
else
	${LD} -rmf -o ${LINKDIR}/${TARGET} ${ROM_OBJECT} ${ROM_LIBS} -Symbols ${LINKDIR}/${TARGET}_sym -base ${ADDRESS}
endif
	@${ECHO} ${COMPONENT}: rom_link complete

${ROM_MODULE}: ${ROM_DEPEND} ${DIRS} ${ROM_LIBS} ${ROM_OBJECT}
ifeq (GNU,${TOOLCHAIN})
	${LDBIN} $@ ${ROM_OBJECT} ${ROM_LIBS}
else
	${LD} -rmf -o $@ ${ROM_OBJECT} ${ROM_LIBS}
	#${LD} -aif -bin -d -Entry 0 -o ${ROM_MODULE}_aif ${ROM_OBJECT} ${ROM_LIBS}
	#${TOGPA} -s ${ROM_MODULE}_aif ${ROM_MODULE}_gpa
endif

${ROM_OBJECT}: ${DIRS} ${TOKHELPSRC} ${ROM_SOURCE}
	${AS} ${ASFLAGS} -depend $(subst .o,.d,$@) -g -o $@ ${ROM_SOURCE}

#
# Standalone builds
#
standalone${CUSTOMSA}: ${SA_MODULE}
	@${ECHO} ${COMPONENT}: standalone module built

${SA_MODULE}: ${SA_DEPEND} ${DIRS} ${SA_LIBS} ${SA_OBJECT}
ifeq (GNU,${TOOLCHAIN})
	${LDBIN} $@ ${SA_OBJECT} ${SA_LIBS}
else
	${LD} -rmf -o $@ ${SA_OBJECT} ${SA_LIBS}
endif
	${MODSQZ} -f ${MODSQZFLAGS} $@

${SA_OBJECT}: ${DIRS} ${TOKHELPSRC} ${MERGEDMSGS} ${ROM_SOURCE}
	${AS} ${ASFLAGS} -depend $(subst .o,.d,$@) -o $@ ${ROM_SOURCE} ${SA_FLAGS}

ifeq ($(filter no custom,${CUSTOMRES}),)
${MERGEDMSGS}:
	${MKDIR} ${MERGEDRDIR}/tmp
	${MKDIR} ${MERGEDRDIR}/${TARGET}
	${TOUCH} ${MERGEDRDIR}/tmp/Messages
	${TOUCH} ${MERGEDRDIR}/tmp/CmdHelp
	${INSTRES} -I Resources.${USERIF}.${LOCALE},Resources.${USERIF}.UK,Resources.${LOCALE},Resources.UK,Resources ${MERGEDRDIR}/tmp [Messages] [CmdHelp]
	${CAT} ${MERGEDRDIR}/tmp/Messages ${MERGEDRDIR}/tmp/CmdHelp > $@
	${WIPE} ${MERGEDRDIR}/tmp
else
${MERGEDMSGS}::
	@${NOP}
endif

install${CUSTOMSA}: ${SA_MODULE}
	${MKDIR} ${INSTDIR}
	${CP} ${SA_MODULE} ${INSTDIR}/${TARGET} ${CPFLAGS}
	@${ECHO} ${COMPONENT}: standalone module installed

debug${CUSTOMDBG}: ${DBG_MODULE}
	@${ECHO} ${COMPONENT}: standalone debug module built

${DBG_MODULE}: ${DBG_OBJECT} ${DBG_LIBS} ${DIRS} ${SA_DEPEND}
ifeq (GNU,${TOOLCHAIN})
	${LDBIN} $@ ${DBG_OBJECT} ${DBG_LIBS}
else
	${LD} -rmf -o $@ ${DBG_OBJECT} ${DBG_LIBS}
endif

${DBG_OBJECT}: ${ROM_SOURCE} ${MERGEDMSGS} ${TOKHELPSRC} ${DIRS}
	${AS} ${ASFLAGS} ${ASDFLAGS} -g -pd "debugging SETL {TRUE}" -depend $(subst .o,.d,$@) -o $@ ${ROM_SOURCE} ${SA_FLAGS}

#gpa_debug${CUSTOMGPA}: ${GPA_FILE}
#	@${ECHO} ${COMPONENT}: GPA debug listing generated
#
#${GPA_FILE}: ${GPA_AIF}
#	${TOGPA} -s ${GPA_AIF} ${GPA_FILE}
#
#${GPA_AIF}: ${DBG_OBJECT}
#	${LD} -aif -bin -d -o ${GPA_AIF} ${DBG_OBJECT}

#
# Export phases
#

export_hdrs: ${EXPORTS}
	@if [ -e ${HEADER1}.hdr ]; then ${ECHO} ${CP} ${HEADER1}.hdr ${EXP_HDR}/${HEADER1} ${CPFLAGS}; fi
	@if [ -e ${HEADER1}.hdr ]; then ${CP} ${HEADER1}.hdr ${EXP_HDR}/${HEADER1} ${CPFLAGS}; fi
	@if [ -e ${HEADER2}.hdr ]; then ${ECHO} ${CP} ${HEADER2}.hdr ${EXP_HDR}/${HEADER2} ${CPFLAGS}; fi
	@if [ -e ${HEADER2}.hdr ]; then ${CP} ${HEADER2}.hdr ${EXP_HDR}/${HEADER2} ${CPFLAGS}; fi
	@if [ -e ${HEADER3}.hdr ]; then ${ECHO} ${CP} ${HEADER3}.hdr ${EXP_HDR}/${HEADER3} ${CPFLAGS}; fi
	@if [ -e ${HEADER3}.hdr ]; then ${CP} ${HEADER3}.hdr ${EXP_HDR}/${HEADER3} ${CPFLAGS}; fi
	@if [ -e ${HEADER4}.hdr ]; then ${ECHO} ${CP} ${HEADER4}.hdr ${EXP_HDR}/${HEADER4} ${CPFLAGS}; fi
	@if [ -e ${HEADER4}.hdr ]; then ${CP} ${HEADER4}.hdr ${EXP_HDR}/${HEADER4} ${CPFLAGS}; fi
	@if [ -e ${HEADER5}.hdr ]; then ${ECHO} ${CP} ${HEADER5}.hdr ${EXP_HDR}/${HEADER5} ${CPFLAGS}; fi
	@if [ -e ${HEADER5}.hdr ]; then ${CP} ${HEADER5}.hdr ${EXP_HDR}/${HEADER5} ${CPFLAGS}; fi
	@if [ -e ${HEADER6}.hdr ]; then ${ECHO} ${CP} ${HEADER6}.hdr ${EXP_HDR}/${HEADER6} ${CPFLAGS}; fi
	@if [ -e ${HEADER6}.hdr ]; then ${CP} ${HEADER6}.hdr ${EXP_HDR}/${HEADER6} ${CPFLAGS}; fi
	@if [ -e ${HEADER7}.hdr ]; then ${ECHO} ${CP} ${HEADER7}.hdr ${EXP_HDR}/${HEADER7} ${CPFLAGS}; fi
	@if [ -e ${HEADER7}.hdr ]; then ${CP} ${HEADER7}.hdr ${EXP_HDR}/${HEADER7} ${CPFLAGS}; fi
	@if [ -e ${HEADER8}.hdr ]; then ${ECHO} ${CP} ${HEADER8}.hdr ${EXP_HDR}/${HEADER8} ${CPFLAGS}; fi
	@if [ -e ${HEADER8}.hdr ]; then ${CP} ${HEADER8}.hdr ${EXP_HDR}/${HEADER8} ${CPFLAGS}; fi
	@if [ -e ${HEADER9}.hdr ]; then ${ECHO} ${CP} ${HEADER9}.hdr ${EXP_HDR}/${HEADER9} ${CPFLAGS}; fi
	@if [ -e ${HEADER9}.hdr ]; then ${CP} ${HEADER9}.hdr ${EXP_HDR}/${HEADER9} ${CPFLAGS}; fi
	@if [ -e ${HEADER10}.hdr ]; then ${ECHO} ${CP} ${HEADER10}.hdr ${EXP_HDR}/${HEADER10} ${CPFLAGS}; fi
	@if [ -e ${HEADER10}.hdr ]; then ${CP} ${HEADER10}.hdr ${EXP_HDR}/${HEADER10} ${CPFLAGS}; fi
	@if [ -e ${HEADER11}.hdr ]; then ${ECHO} ${CP} ${HEADER11}.hdr ${EXP_HDR}/${HEADER11} ${CPFLAGS}; fi
	@if [ -e ${HEADER11}.hdr ]; then ${CP} ${HEADER11}.hdr ${EXP_HDR}/${HEADER11} ${CPFLAGS}; fi
	@if [ -e ${HEADER12}.hdr ]; then ${ECHO} ${CP} ${HEADER12}.hdr ${EXP_HDR}/${HEADER12} ${CPFLAGS}; fi
	@if [ -e ${HEADER12}.hdr ]; then ${CP} ${HEADER12}.hdr ${EXP_HDR}/${HEADER12} ${CPFLAGS}; fi
	@if [ -e ${HEADER13}.hdr ]; then ${ECHO} ${CP} ${HEADER13}.hdr ${EXP_HDR}/${HEADER13} ${CPFLAGS}; fi
	@if [ -e ${HEADER13}.hdr ]; then ${CP} ${HEADER13}.hdr ${EXP_HDR}/${HEADER13} ${CPFLAGS}; fi
	@if [ -e ${HEADER14}.hdr ]; then ${ECHO} ${CP} ${HEADER14}.hdr ${EXP_HDR}/${HEADER14} ${CPFLAGS}; fi
	@if [ -e ${HEADER14}.hdr ]; then ${CP} ${HEADER14}.hdr ${EXP_HDR}/${HEADER14} ${CPFLAGS}; fi
	@if [ -e ${HEADER15}.hdr ]; then ${ECHO} ${CP} ${HEADER15}.hdr ${EXP_HDR}/${HEADER15} ${CPFLAGS}; fi
	@if [ -e ${HEADER15}.hdr ]; then ${CP} ${HEADER15}.hdr ${EXP_HDR}/${HEADER15} ${CPFLAGS}; fi
	@if [ -e ${HEADER16}.hdr ]; then ${ECHO} ${CP} ${HEADER16}.hdr ${EXP_HDR}/${HEADER16} ${CPFLAGS}; fi
	@if [ -e ${HEADER16}.hdr ]; then ${CP} ${HEADER16}.hdr ${EXP_HDR}/${HEADER16} ${CPFLAGS}; fi
	@${ECHO} ${COMPONENT}: header export complete

export_libs:
	@${ECHO} ${COMPONENT}: library export complete

export${CUSTOMEXP}: export_${PHASE}
	@${NOP}

export_:: export_hdrs export_libs
	@${NOP}

# Need these to stop complaints about the rules below
ASMCHEADER1 ?= _!_x_!_
ASMCHEADER2 ?= _!_x_!_
ASMCHEADER3 ?= _!_x_!_
ASMCHEADER4 ?= _!_x_!_
ASMCHEADER5 ?= _!_x_!_
ASMCHEADER6 ?= _!_x_!_
ASMCHEADER7 ?= _!_x_!_
ASMCHEADER8 ?= _!_x_!_
CHEADER1    ?= _!_x_!_
CHEADER2    ?= _!_x_!_
CHEADER3    ?= _!_x_!_

${C_EXP_HDR}/${ASMCHEADER1}.h :: ${ASMCHEADER1}.hdr
	${HDR2H} ${ASMCHEADER1}.hdr $@

${C_EXP_HDR}/${ASMCHEADER2}.h :: ${ASMCHEADER2}.hdr
	${HDR2H} ${ASMCHEADER2}.hdr $@

${C_EXP_HDR}/${ASMCHEADER3}.h :: ${ASMCHEADER3}.hdr
	${HDR2H} ${ASMCHEADER3}.hdr $@

${C_EXP_HDR}/${ASMCHEADER4}.h :: ${ASMCHEADER4}.hdr
	${HDR2H} ${ASMCHEADER4}.hdr $@

${C_EXP_HDR}/${ASMCHEADER5}.h :: ${ASMCHEADER5}.hdr
	${HDR2H} ${ASMCHEADER5}.hdr $@

${C_EXP_HDR}/${ASMCHEADER6}.h :: ${ASMCHEADER6}.hdr
	${HDR2H} ${ASMCHEADER6}.hdr $@

${C_EXP_HDR}/${ASMCHEADER7}.h :: ${ASMCHEADER7}.hdr
	${HDR2H} ${ASMCHEADER7}.hdr $@

${C_EXP_HDR}/${ASMCHEADER8}.h :: ${ASMCHEADER8}.hdr
	${HDR2H} ${ASMCHEADER8}.hdr $@

${C_EXP_HDR}/${CHEADER1}.h :: ${CHEADER1}.h
	${CP} ${CHEADER1}.h $@ ${CPFLAGS}

${C_EXP_HDR}/${CHEADER2}.h :: ${CHEADER2}.h
	${CP} ${CHEADER2}.h $@ ${CPFLAGS}

${C_EXP_HDR}/${CHEADER3}.h :: ${CHEADER3}.h
	${CP} ${CHEADER3}.h $@ ${CPFLAGS}

#
# Resources
#
resources${CUSTOMRES}:: resources-${CMDHELP}
	@${ECHO} ${COMPONENT}: resources copied to Messages module

ifeq (${CUSTOMRES},no)
resources:
	@${ECHO} ${COMPONENT}: no resources to export
endif        

resources_extra: ${RES_DEPENDS_}
ifneq (${RES_FILES_},)
	${INSTRES} -I Resources.${USERIF}.${LOCALE},Resources.${USERIF}.UK,Resources.${LOCALE},Resources.UK,Resources ${RESFSDIR} ${RES_FILES_}
endif
ifneq (,$(filter Messages,${INSTRES_VERSION}))
	${INSERTVERSION} ${RESFSDIR}/Messages > ${RESFSDIR}/_Awk_
	${CP} ${RESFSDIR}/_Awk_ ${RESFSDIR}/Messages ${CPFLAGS}
	${RM} ${RESFSDIR}/_Awk_
	for path in ${USERIF}/${LOCALE} ${USERIF}/UK ${LOCALE} UK ""; do if [ -f Resources/$$path/Messages ]; then touch -r Resources/$$path/Messages ${RESFSDIR}/Messages; break; fi; done
endif
	@${NOP}

resources_common:
	${MKDIR} ${RESFSDIR}
	${INSTRES} -I Resources.${USERIF}.${LOCALE},Resources.${USERIF}.UK,Resources.${LOCALE},Resources.UK,Resources ${RESFSDIR} [Messages]

resources_cmdhelp: ${MERGEDMSGS}
	${CP} ${MERGEDMSGS} ${RESFSDIR}/Messages

resources-None: resources_common resources_extra
	@${NOP}

resources-: resources_common resources_cmdhelp resources_extra 
	@${NOP}

#
# Build the help tokens
#
${TOKENSOURCE}: ${TOKENS} ${HELPSRC}
	${TOKENISE} ${TOKENS} ${HELPSRC} $@

include $(wildcard *.d)

endif

# EOF