* Added a Bison and a LexC++ rule.
* Override the Jambase version of the Object rule to optionally generate intermediate .cpp instead of .c files for .y and .l input. The GENERATE_C++ variable must be set to enable that behavior. * Added a ResComp rule using the shiny new rc to compile .rdef files into .rsrc files. * Adjusted AddResources to accept both, .rsrc and .rdef files. The rule also grists the input files now, avoiding problems with equally named resource files in different directories. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2739 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -183,6 +183,57 @@ rule SetupR5Includes
|
|||||||
# Things Jam needs in order to work :)
|
# Things Jam needs in order to work :)
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
rule Object
|
||||||
|
{
|
||||||
|
# This is basically the original Jambase 2.4 Object rule stripped by
|
||||||
|
# comments. Only the final switch statement has been changed to allow
|
||||||
|
# intermediate C++ files for Yacc and Lex.
|
||||||
|
|
||||||
|
LocalClean clean : $(<) ;
|
||||||
|
|
||||||
|
MakeLocate $(<) : $(LOCATE_TARGET) ;
|
||||||
|
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
||||||
|
|
||||||
|
HDRS on $(<) = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
|
||||||
|
|
||||||
|
HDRRULE on $(>) = HdrRule ;
|
||||||
|
HDRSCAN on $(>) = $(HDRPATTERN) ;
|
||||||
|
HDRSEARCH on $(>) =
|
||||||
|
$(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ;
|
||||||
|
|
||||||
|
HDRGRIST on $(>) = $(HDRGRIST) ;
|
||||||
|
|
||||||
|
DEFINES on $(<) += $(DEFINES) ;
|
||||||
|
|
||||||
|
# if source is not .c, generate .c with specific rule
|
||||||
|
|
||||||
|
switch $(>:S)
|
||||||
|
{
|
||||||
|
case .asm : As $(<) : $(>) ;
|
||||||
|
case .c : Cc $(<) : $(>) ;
|
||||||
|
case .C : C++ $(<) : $(>) ;
|
||||||
|
case .cc : C++ $(<) : $(>) ;
|
||||||
|
case .cpp : C++ $(<) : $(>) ;
|
||||||
|
case .f : Fortran $(<) : $(>) ;
|
||||||
|
case .l : if [ on $(2) return $(GENERATE_C++) ] {
|
||||||
|
C++ $(<) : $(<:S=.cpp) ;
|
||||||
|
LexC++ $(<:S=.cpp) : $(>) ;
|
||||||
|
} else {
|
||||||
|
Cc $(<) : $(<:S=.c) ;
|
||||||
|
Lex $(<:S=.c) : $(>) ;
|
||||||
|
}
|
||||||
|
case .s : As $(<) : $(>) ;
|
||||||
|
case .y : if [ on $(2) return $(GENERATE_C++) ] {
|
||||||
|
C++ $(<) : $(<:S=.cpp) ;
|
||||||
|
Bison $(<:S=.cpp) : $(>) ;
|
||||||
|
} else {
|
||||||
|
Cc $(<) : $(<:S=$(YACCGEN)) ;
|
||||||
|
Yacc $(<:S=$(YACCGEN)) : $(>) ;
|
||||||
|
}
|
||||||
|
case * : UserObject $(<) : $(>) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rule UserObject
|
rule UserObject
|
||||||
{
|
{
|
||||||
switch $(2)
|
switch $(2)
|
||||||
@@ -665,22 +716,23 @@ rule MergeObject
|
|||||||
|
|
||||||
rule SharedLibraryFromObjects
|
rule SharedLibraryFromObjects
|
||||||
{
|
{
|
||||||
# SharedLibraryFromObjects <name> : <objects> ;
|
# SharedLibraryFromObjects <name> : <objects> : <libraries> ;
|
||||||
local _lib = lib$(1).so ;
|
local _lib = lib$(1).so ;
|
||||||
MainFromObjects $(_lib) : $(2) ;
|
MainFromObjects $(_lib) : $(2) ;
|
||||||
MakeLocate $(_lib) : $(OBOS_SHLIB_DIR) ;
|
MakeLocate $(_lib) : $(OBOS_SHLIB_DIR) ;
|
||||||
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
||||||
-nostart -Xlinker -soname=\"$(_lib)\" ;
|
-nostart -Xlinker -soname=\"$(_lib)\" ;
|
||||||
|
LinkSharedOSLibs $(_lib) : $(3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule SharedLibrary
|
rule SharedLibrary
|
||||||
{
|
{
|
||||||
# SharedLibrary <name> : <sources> ;
|
# SharedLibrary <name> : <sources> : <libraries> ;
|
||||||
SetupIncludes ;
|
SetupIncludes ;
|
||||||
SetupObjectsDir ;
|
SetupObjectsDir ;
|
||||||
MakeLocateObjects $(2) ;
|
MakeLocateObjects $(2) ;
|
||||||
Objects $(2) ;
|
Objects $(2) ;
|
||||||
SharedLibraryFromObjects $(1) : $(2:S=$(SUFOBJ)) ;
|
SharedLibraryFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule LinkSharedOSLibs
|
rule LinkSharedOSLibs
|
||||||
@@ -731,8 +783,37 @@ rule AddResources
|
|||||||
{
|
{
|
||||||
# AddResources <name> : <resourcefiles> ;
|
# AddResources <name> : <resourcefiles> ;
|
||||||
|
|
||||||
|
local resfiles = [ FGristFiles $(2) ] ;
|
||||||
|
SEARCH on $(resfiles) += $(SEARCH_SOURCE) ;
|
||||||
|
|
||||||
|
for file in $(resfiles) {
|
||||||
|
if $(file:S) = .rdef {
|
||||||
|
local rdef = $(file) ;
|
||||||
|
file = $(rdef:S=.rsrc) ;
|
||||||
|
ResComp $(file) : $(rdef) ;
|
||||||
|
}
|
||||||
|
RESFILES on $(1) += $(file) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rule ResComp
|
||||||
|
{
|
||||||
|
# ResComp <resource file> : <rdef file> ;
|
||||||
|
#
|
||||||
|
# <resource file> and <rdef file> must be gristed.
|
||||||
|
|
||||||
|
SetupObjectsDir ;
|
||||||
|
|
||||||
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
||||||
RESFILES on $(1) += $(2) ;
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
||||||
|
Depends $(1) : $(2) rc ;
|
||||||
|
LocalClean clean : $(1) ;
|
||||||
|
ResComp1 $(1) : rc $(2) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
actions ResComp1
|
||||||
|
{
|
||||||
|
$(2[1]) -o $(1:S=) $(2[2-])
|
||||||
}
|
}
|
||||||
|
|
||||||
rule SourceHdrs
|
rule SourceHdrs
|
||||||
@@ -1034,6 +1115,9 @@ rule SetupObjectsDir
|
|||||||
# do not want to include that :)
|
# do not want to include that :)
|
||||||
rel_objectsdir = [ FDirName $(SUBDIR_TOKENS[2-]) ] ;
|
rel_objectsdir = [ FDirName $(SUBDIR_TOKENS[2-]) ] ;
|
||||||
LOCATE_TARGET = [ FDirName $(OBOS_OBJECT_TARGET) $(rel_objectsdir) ] ;
|
LOCATE_TARGET = [ FDirName $(OBOS_OBJECT_TARGET) $(rel_objectsdir) ] ;
|
||||||
|
LOCATE_SOURCE = $(LOCATE_TARGET) ;
|
||||||
|
SEARCH_SOURCE = [ Filter $(SEARCH_SOURCE) : $(LOCATE_TARGET) ]
|
||||||
|
$(LOCATE_TARGET) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@@ -1056,6 +1140,41 @@ actions Link bind NEEDLIBS
|
|||||||
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(2)" "$(NEEDLIBS)" $(LINKLIBS) ;
|
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(2)" "$(NEEDLIBS)" $(LINKLIBS) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rule LexC++
|
||||||
|
{
|
||||||
|
Depends $(1) : $(2) ;
|
||||||
|
MakeLocate $(1) : $(LOCATE_SOURCE) ;
|
||||||
|
LocalClean clean : $(1) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
actions LexC++
|
||||||
|
{
|
||||||
|
$(LEX) -o$(1) $(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
rule Bison
|
||||||
|
{
|
||||||
|
local _h ;
|
||||||
|
|
||||||
|
_h = $(1).h ;
|
||||||
|
|
||||||
|
MakeLocate $(<) $(_h) : $(LOCATE_SOURCE) ;
|
||||||
|
|
||||||
|
Depends $(<) $(_h) : $(>) ;
|
||||||
|
Bison1 $(<) $(_h) : $(>) ;
|
||||||
|
LocalClean clean : $(<) $(_h) ;
|
||||||
|
|
||||||
|
# make sure someone includes $(_h) else it will be
|
||||||
|
# a deadly independent target
|
||||||
|
|
||||||
|
Includes $(<) : $(_h) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
actions Bison1
|
||||||
|
{
|
||||||
|
bison $(YACCFLAGS) -o $(1[1]) $(2)
|
||||||
|
}
|
||||||
|
|
||||||
# BeOS specific rules
|
# BeOS specific rules
|
||||||
|
|
||||||
rule XRes
|
rule XRes
|
||||||
|
|||||||
Reference in New Issue
Block a user