From 684d01e340adda182a1e844dc459440b94afb257 Mon Sep 17 00:00:00 2001 From: Ben Avison <bavison@gitlab.riscosopen.org> Date: Thu, 31 Mar 2011 00:04:06 +0000 Subject: [PATCH] Improvements to shared makefiles Detail: * Some subtle bugs can be caused by including shared makefiles in the wrong order. To try to prevent further problems, and simplify main makefiles at the same time, CApp, CLibrary and CModule now include the makefiles they depend upon themselves, in the correct order: generally speaking, all macro (re)definitions should be before rule definitions. * Added sentry macro definitions to each makefile. These can be used to avoid repeated inclusion of makefiles - particularly important now that CApp, CLibrary and CModule do additional includes. This removes the majority of cases where amu produced warnings about multiple inclusion; a few components remain where this is still the case, but these warnings are harmless. If they bother you, simply remove the now-superfluous include statements from the relevant main makefile. * Created a CUtil shared makefile, for building transient utilities. The 'C' in the name is more for consistency with CApp/CLibrary/CModule than anything to do with the 'C' language, since all of these makefiles work equally well for assembler and 'C' - the 'C' is for historic reasons. * Tweaked the debug rules in CApp to avoid harmless but annoying linker warnings about stubs being included twice. * Added several new default switches to ASFLAGS. These enable us to start making assembler source files work under a cross-assembler, because statements like GET Hdr:Macros GET Hdr:Machine.<Machine> are not portable, and tweaking the cross-assembler to understand these types of constructs would not be pretty. Instead, with the extra command line switches now introduced, you can use GET Macros GET Machine/$Machine Admin: Tested in a ROM build Version 5.12. Tagged as 'BuildSys-5_12' --- Makefiles/AAsmModule | 3 +++ Makefiles/AppLibs | 3 +++ Makefiles/AppStdRule | 3 +++ Makefiles/BBEExport | 3 +++ Makefiles/CApp | 29 ++++++++++++++++++++++++----- Makefiles/CLibrary | 14 ++++++++++++++ Makefiles/CModule | 16 ++++++++++++++++ Makefiles/DbgRules | 3 +++ Makefiles/HostTools | 3 +++ Makefiles/ModStdRule | 3 +++ Makefiles/ModuleLibs | 3 +++ Makefiles/RAMCModule | 3 +++ Makefiles/RAMModule | 3 +++ Makefiles/ROMCModule | 3 +++ Makefiles/ROMModule | 3 +++ Makefiles/StdRules | 3 +++ Makefiles/StdTools | 5 +++++ VersionNum | 20 ++++++++++---------- 18 files changed, 108 insertions(+), 15 deletions(-) diff --git a/Makefiles/AAsmModule b/Makefiles/AAsmModule index 263cfac..e6053a8 100644 --- a/Makefiles/AAsmModule +++ b/Makefiles/AAsmModule @@ -14,6 +14,9 @@ # # Makefile fragment for assembler modules targetted at ROMming, previously built # using AAsm but now using objasm. + +INCLUDED_AASMMODULE = YES + # # $Id$ # diff --git a/Makefiles/AppLibs b/Makefiles/AppLibs index c74cee0..8322d9e 100644 --- a/Makefiles/AppLibs +++ b/Makefiles/AppLibs @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for libraries linked against RAM applications + +INCLUDED_APPLIBS = YES + # STDMAKEFILE=$Id$ # diff --git a/Makefiles/AppStdRule b/Makefiles/AppStdRule index f5492ca..0dfc872 100644 --- a/Makefiles/AppStdRule +++ b/Makefiles/AppStdRule @@ -14,6 +14,9 @@ # # Makefile fragment for defining standard rules for various tools # when building RAM applications + +INCLUDED_APPSTDRULE = YES + # # $Id$ # diff --git a/Makefiles/BBEExport b/Makefiles/BBEExport index 96cfc75..6d64a7c 100644 --- a/Makefiles/BBEExport +++ b/Makefiles/BBEExport @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for Binary Build Environment exporting. + +INCLUDED_BBEEXPORT = YES + # # This Makefile is included directly by srcbuild as the core implementation # of the binary build environment phase. diff --git a/Makefiles/CApp b/Makefiles/CApp index 91df8ff..3fbc9e4 100644 --- a/Makefiles/CApp +++ b/Makefiles/CApp @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for C and C++ applications + +INCLUDED_CAPP = YES + # # $Id$ # @@ -43,6 +46,7 @@ # INSTTYPE (opt) (use "tool" or "app" to install executable vs application - defaults to "tool") # INSTALLAPPFILES (opt) (list of files to be installed in application directory - use InstRes specification rules) # INSTALLAPP_DEPEND (opt) (list of dependencies to be satisfied before doing application install - ${TARGET} assumed if in INSTALLAPPFILES) +# CUSTOMLINK (opt) (set to "custom" to override the link rule) # CUSTOMINSTALLAPP (opt) (set to "custom" to override the install rule for resource files) # CUSTOMINSTALLTOOL (opt) (set to "custom" to override the install rule for target binary) # @@ -84,16 +88,31 @@ INSTDIR ?= ${INSTALLDIR}.${TARGET} DIRS ?= o._dirs OBJS ?= ${TARGET} DBG_OBJS ?= ${OBJS} +APP_LIBS ?= ${LIBS} DBG_LIBS ?= ${LIBS} ifeq (C++,${LINK_TYPE}) -LIBS += ${C++LIB} +APP_LIBS += ${C++LIB} DBG_LIBS += ${C++LIB} endif -LIBS += ${CLIB} +APP_LIBS += ${CLIB} DBG_LIBS += ${DEBUGLIBS} ${CLIB} APP_OBJS ?= $(addprefix o.,${OBJS}) APP_DBG_OBJS ?= $(addprefix od.,${DBG_OBJS}) +ifeq ("${INCLUDED_STDTOOLS}","") +include StdTools +endif +ifeq ("${INCLUDED_APPLIBS}","") +include AppLibs +endif + +ifeq ("${INCLUDED_APPSTDRULE}","") +include AppStdRule +endif +ifeq ("${INCLUDED_DBGRULES}","") +include DbgRules +endif + all: ${TARGET} @${ECHO} ${COMPONENT}: application built @@ -136,11 +155,11 @@ install_tool${CUSTOMINSTALLTOOL}: ${TARGET} debug: ${DBG_TARGET} @${ECHO} ${COMPONENT}: debug application built -${TARGET}: ${APP_OBJS} ${LIBS} ${DIRS} - ${LD} ${LDFLAGS} -o ${TARGET} ${APP_OBJS} ${LIBS} +${TARGET}${CUSTOMLINK}: ${APP_OBJS} ${APP_LIBS} ${DIRS} + ${LD} ${LDFLAGS} -o ${TARGET} ${APP_OBJS} ${APP_LIBS} ${SQZ} ${SQZFLAGS} $@ -${DBG_TARGET}: ${APP_DBG_OBJS} ${DBG_LIBS} ${DIRS} +${DBG_TARGET}${CUSTOMLINK}: ${APP_DBG_OBJS} ${DBG_LIBS} ${DIRS} ${LD} ${LDFLAGS} ${LDDFLAGS} -o ${DBG_TARGET} ${APP_DBG_OBJS} ${DBG_LIBS} # EOF diff --git a/Makefiles/CLibrary b/Makefiles/CLibrary index cffb480..796ffe8 100644 --- a/Makefiles/CLibrary +++ b/Makefiles/CLibrary @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for C and C++ libraries for applications and modules + +INCLUDED_CLIBRARY = YES + # # $Id$ # @@ -107,6 +110,17 @@ EXPORTING_ASMHDRS = $(addprefix expasm.,${ASMHDRS}) EXPORTING_LIBS = $(addprefix explib.,${LIBRARIES}) TARGET_LIBS = $(addprefix ${LIBEXT}.,${LIBRARIES}) +ifeq ("${INCLUDED_STDTOOLS}","") +include StdTools +endif + +ifeq ("${INCLUDED_STDRULES}","") +include StdRules +endif +ifeq ("${INCLUDED_DBGRULES}","") +include DbgRules +endif + all_libs: ${TARGET_LIBS} @${ECHO} ${COMPONENT}: library built diff --git a/Makefiles/CModule b/Makefiles/CModule index 0e86200..3a25982 100644 --- a/Makefiles/CModule +++ b/Makefiles/CModule @@ -1,4 +1,7 @@ # Makefile fragment for C and C++ modules + +INCLUDED_CMODULE = YES + # # $Id$ # @@ -174,6 +177,19 @@ CDEFINES += ${ROMCDEFINES} ASMDEFINES += ${ROMASMDEFINES} endif +ifeq ("${INCLUDED_STDTOOLS}","") +include StdTools +endif +ifeq ("${INCLUDED_MODULELIBS}","") +include ModuleLibs +endif + +ifeq ("${INCLUDED_MODSTDRULE}","") +include ModStdRule +endif +ifeq ("${INCLUDED_DBGRULES}","") +include DbgRules +endif # General rules diff --git a/Makefiles/DbgRules b/Makefiles/DbgRules index 104ee5a..eabecce 100644 --- a/Makefiles/DbgRules +++ b/Makefiles/DbgRules @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for defining standard debug rules for various tools + +INCLUDED_DBGRULES = YES + # # $Id$ # diff --git a/Makefiles/HostTools b/Makefiles/HostTools index afeba15..c5c5fde 100644 --- a/Makefiles/HostTools +++ b/Makefiles/HostTools @@ -14,6 +14,9 @@ # # Makefile fragment for C applications that run on the build host but which # are built during the main build + +INCLUDED_HOSTTOOLS = YES + # # # These are the tool definitions for RISC OS hosted builds. diff --git a/Makefiles/ModStdRule b/Makefiles/ModStdRule index 0db547d..c64b8af 100644 --- a/Makefiles/ModStdRule +++ b/Makefiles/ModStdRule @@ -14,6 +14,9 @@ # # Makefile fragment for defining standard rules for various tools # when building modules + +INCLUDED_MODSTDRULE = YES + # # $Id$ # diff --git a/Makefiles/ModuleLibs b/Makefiles/ModuleLibs index 6102b3d..d2c59da 100644 --- a/Makefiles/ModuleLibs +++ b/Makefiles/ModuleLibs @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for libraries linked against modules (RAM or ROM) + +INCLUDED_MODULELIBS = YES + # STDMAKEFILE=$Id$ # diff --git a/Makefiles/RAMCModule b/Makefiles/RAMCModule index 0e0d5f0..defa6c9 100644 --- a/Makefiles/RAMCModule +++ b/Makefiles/RAMCModule @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for C and C++ modules targetted at RAM. + +INCLUED_RAMCMODULE = YES + # # $Id$ # diff --git a/Makefiles/RAMModule b/Makefiles/RAMModule index eabe2cb..5c7b8d5 100644 --- a/Makefiles/RAMModule +++ b/Makefiles/RAMModule @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for assembler modules targetted at RAM, built using objasm + +INCLUDED_RAMMODULE = YES + # # $Id$ # diff --git a/Makefiles/ROMCModule b/Makefiles/ROMCModule index 63ac9bf..eedb547 100644 --- a/Makefiles/ROMCModule +++ b/Makefiles/ROMCModule @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for C and C++ modules targetted at ROMming. + +INCLUDED_ROMCMODULE = YES + # # $Id$ # diff --git a/Makefiles/ROMModule b/Makefiles/ROMModule index 49ae454..296fbc3 100644 --- a/Makefiles/ROMModule +++ b/Makefiles/ROMModule @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for assembler modules targetted at ROMming, built using objasm + +INCLUDED_ROMMODULE = YES + # # $Id$ # diff --git a/Makefiles/StdRules b/Makefiles/StdRules index 3c473bb..5f471fb 100644 --- a/Makefiles/StdRules +++ b/Makefiles/StdRules @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for defining standard rules for various tools + +INCLUDED_STDRULES = YES + # # $Id$ # diff --git a/Makefiles/StdTools b/Makefiles/StdTools index d0471eb..17dabd7 100644 --- a/Makefiles/StdTools +++ b/Makefiles/StdTools @@ -13,6 +13,9 @@ # limitations under the License. # # Makefile fragment for defining the various tools and their options + +INCLUDED_STDTOOLS = YES + # # $Id$ # @@ -100,6 +103,8 @@ STDTOOLOPTIONS = -depend !Depend ${THROWBACK} AASMFLAGS += -Stamp -quit ${STDTOOLOPTIONS} ${AASMDEFINES} ${AASMINCLUDES} ASFLAGS += -Stamp -quit ${STDTOOLOPTIONS} ${ASMDEFINES} ${ASMINCLUDES} +ASFLAGS += -ihdr -i<Hdr$Dir>.Global -i<Hdr$Dir>.Interface -i<Hdr$Dir>.Interface2 +ASFLAGS += -pd "APCS SETS \"${APCS}\"" -pd "Machine SETS \"${MACHINE}\"" -pd "UserIF SETS \"${USERIF}\"" CFLAGS += -c ${STDTOOLOPTIONS} ${CDEFINES} ${CINCLUDES} ${C_NO_FNAMES} ${C_WARNINGS} C++INCLUDES += -ICPP: C++FLAGS += -c ${STDTOOLOPTIONS} ${C++DEFINES} ${C++INCLUDES} diff --git a/VersionNum b/VersionNum index 13143e5..fddda45 100644 --- a/VersionNum +++ b/VersionNum @@ -1,23 +1,23 @@ -/* (5.11) +/* (5.12) * * This file is automatically maintained by srccommit, do not edit manually. * Last processed by srccommit version: 1.1. * */ -#define Module_MajorVersion_CMHG 5.11 +#define Module_MajorVersion_CMHG 5.12 #define Module_MinorVersion_CMHG -#define Module_Date_CMHG 19 Mar 2011 +#define Module_Date_CMHG 31 Mar 2011 -#define Module_MajorVersion "5.11" -#define Module_Version 511 +#define Module_MajorVersion "5.12" +#define Module_Version 512 #define Module_MinorVersion "" -#define Module_Date "19 Mar 2011" +#define Module_Date "31 Mar 2011" -#define Module_ApplicationDate "19-Mar-11" +#define Module_ApplicationDate "31-Mar-11" #define Module_ComponentName "BuildSys" #define Module_ComponentPath "castle/RiscOS/BuildSys" -#define Module_FullVersion "5.11" -#define Module_HelpVersion "5.11 (19 Mar 2011)" -#define Module_LibraryVersionInfo "5:11" +#define Module_FullVersion "5.12" +#define Module_HelpVersion "5.12 (31 Mar 2011)" +#define Module_LibraryVersionInfo "5:12" -- GitLab