Define two pseudo targets for the target and build platform.

* The main build rules now cause their targets to depend on the
  platform such that global per-platform intializations can be
  set up by making the platform pseudo target depend on the
  target returned by the initialization rule.
This commit is contained in:
Oliver Tappe 2014-07-31 14:13:01 +02:00
parent ed25955ada
commit a07cdb6e9f
4 changed files with 18 additions and 8 deletions

View File

@ -861,6 +861,15 @@ PLATFORM = $(TARGET_PLATFORM) ;
SUPPORTED_PLATFORMS = haiku ;
# Define two pseudo targets for the target and buildhost platform. The main
# build rules (Cc, C++, As, ...) depend on these pseude targets such that global
# initializations that are required before anything is built for a specific
# platform can be forced by depending the pseudo target for the platform on the
# initializations.
NotFile $(TARGET_PLATFORM) ;
NotFile host ;
# Instructs the Library rule to not make its object files temporary.
# This is needed as some objects are used in a static library and for an
# executable.

View File

@ -168,7 +168,7 @@ rule StaticLibraryFromObjects
rule AssembleNasm
{
Depends $(<) : $(>) ;
Depends $(<) : $(>) [ on $(<) return $(PLATFORM) ] ;
}
actions AssembleNasm
@ -343,7 +343,7 @@ rule CreateAsmStructOffsetsHeader header : source
# locate object, search for source, and set on target variables
Depends $(header) : $(source) ;
Depends $(header) : $(source) $(PLATFORM) ;
SEARCH on $(source) += $(SEARCH_SOURCE) ;
MakeLocateArch $(header) ;
LocalClean clean : $(header) ;

View File

@ -210,7 +210,7 @@ rule As
= $(TARGET_SYSTEM_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
}
Depends $(<) : $(>) ;
Depends $(<) : $(>) [ on $(1) return $(PLATFORM) ] ;
ASFLAGS on $(<) += $(flags) $(SUBDIRASFLAGS) ;
ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) : $(localIncludesOption) ]
$(includesSeparator)
@ -227,7 +227,7 @@ actions As
rule Lex
{
Depends $(1) : $(2) ;
Depends $(1) : $(2) [ on $(1) return $(PLATFORM) ] ;
MakeLocateArch $(1) ;
LocalClean clean : $(1) ;
}
@ -245,7 +245,8 @@ rule Yacc
MakeLocateArch $(source) $(header) ;
Depends $(source) $(header) : $(yaccSource) ;
Depends $(source) $(header)
: $(yaccSource) [ on $(source) return $(PLATFORM) ] ;
Yacc1 $(source) $(header) : $(yaccSource) ;
LocalClean clean : $(source) $(header) ;
@ -263,7 +264,7 @@ actions Yacc1
rule Cc
{
Depends $(<) : $(>) ;
Depends $(<) : $(>) [ on $(1) return $(PLATFORM) ] ;
on $(1) {
local flags ;
@ -341,7 +342,7 @@ actions Cc
rule C++
{
Depends $(<) : $(>) ;
Depends $(<) : $(>) [ on $(1) return $(PLATFORM) ] ;
on $(1) {
local flags ;

View File

@ -35,7 +35,7 @@ rule PreprocessSyscalls preprocessedHeader : header : architecture
{
# PreprocessSyscalls <preprocessedHeader> : <header> : <architecture> ;
Depends $(preprocessedHeader) : $(header) ;
Depends $(preprocessedHeader) : $(header) $(PLATFORM) ;
local headers = [ on $(preprocessedHeader)
return $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ] ;