# Copyright 2008 Castle Technology Ltd # # 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. # # Makefile fragment for C and C++ modules targetted at ROMming. INCLUDED_ROMCMODULE = YES # # $Id$ # # This makefile provides the following phony targets: # # rom install_rom rom_link # # # This fragment relies on srcbuild to set FORCEROMLINK if it really wants the # relink of the ROM target to occur. This is used to generate correct commands # in the BBE phase. # # # This fragment uses the following macros set by the master makefile. # # # COMPONENT (the name of the component) # TARGET (leafname of component being build) # ROM_MODULE(opt) (output filename of partially linked module - otherwise aof.${TARGET}) # LNK_MODULE(opt) (output filename of fixed-position module - otherwise linked.${TARGET}) # ROM_OBJS (opt) (component's object files for romming) # ROM_LIBS (opt) (libraries to link again ROM_OBJS to generate ROM_MODULE) # DIRS (opt) (magic target to ensure object directories are present) # ROMCSTUBS (the C library) # ABSSYM (C library symbols file for position-dependent link) # ROM_DEPEND (opt) (any extra dependency to assert on ${ROM_MODULE} # # # It relies on the following from the build system: # # # INSTDIR (installation directory for ROM_MODULE - never used!) # LINKDIR (installation directory for LNK_MODULE) # ADDRESS (base address for LNK_MODULE) # # # It relies on the following generic tool macros from the Tools makefile # # CP + CPFLAGS (copy, cp etc.) # MKDIR (cdir/mkdir -p) # ECHO # LD + LDFLAGS (linker) # LDROMFLAGS (more linker flags) # LDLINKFLAGS (flags for the rom_link phase) ROM_MODULE ?= aof.${TARGET} LNK_MODULE ?= linked.${TARGET} ROM_OBJS ?= ${OBJS} ROM_LIBS ?= ${LIBS} # # RISC OS ROM build rules: # rom: ${ROM_MODULE} @${ECHO} ${COMPONENT}: rom module built install_rom: ${ROM_MODULE} ${CP} ${ROM_MODULE} ${INSTDIR}.${TARGET} ${CPFLAGS} @${ECHO} ${COMPONENT}: rom module installed # # Actually make the partially linked ROM target # ${ROM_MODULE}: ${ROM_OBJS} ${ROM_LIBS} ${ROMCSTUBS} ${DIRS} ${ROM_DEPEND} ${MKDIR} aof ${LD} -o $@ -aof ${ROM_OBJS} ${ROM_LIBS} ${ROMCSTUBS} # # Final link for the ROM Image (using given base address) # rom_link: ${ROM_MODULE} ${ABSSYM} ${FORCEROMLINK} ${MKDIR} linked ${LD} ${LDFLAGS} ${LDLINKFLAGS} -o ${LNK_MODULE} -rmf -base ${ADDRESS} ${ROM_MODULE} ${ABSSYM} ${CP} ${LNK_MODULE} ${LINKDIR}.${TARGET} ${CPFLAGS} @${ECHO} ${COMPONENT}: rom_link complete ${LNK_MODULE}: ${ROM_MODULE} ${ABSSYM} ${FORCEROMLINK} ${MKDIR} linked ${LD} ${LDFLAGS} ${LDLINKFLAGS} -o $@ -rmf -base ${ADDRESS} ${ROM_MODULE} ${ABSSYM} EOFSTDMKFILE=$Id$ # EOF