Skip to content

Instantly share code, notes, and snippets.

@rygorous
Last active September 12, 2015 04:36
Embed
What would you like to do?
FUCK NO CDEP 2
$define(dorunoneatatime,
$set(temp,$2)
$if( $LogMode, , $echo($0) )
$while( $set(cur,$split(temp,$char(32))),
$// NOTE(fg): Somewhat-parallel builds. (Not ideal but better than fully serial)
$if($LogMode,1,$runback($platformify($1), $dorunparams($cur,$3), $4, , [oneatatimesync]) )
$// NOTE(fg): This is the serial variant
$//$if($if($LogMode,1,$run($platformify($1), $dorunparams($cur,$3), $4) ),,$error(Error$0))
)
$// NOTE(fg): We issued all builds of this type in parallel and now sync waiting for them
$// all to complete so subsequent CDep commands that depend on the result work. This is
$// conservative enough not to have caused problems in about a year of usage. Good enough!
$waiton([oneatatimesync])
)
$define( RunIfAny, $if($0,$if($LogMode, , $echo($1) ) $runmultiple( $if($buildgraph,$if($cluster, :$cluster :, :$buildplatform :), )$platformify($2),$3,$0,$4,$platformify($5),$platformify($6)), ) )
$// convertlistseparator($list,$first,$other)
$// $convertlistseparator(a b c d,X,Y) = XaYbYcYd
$define(convertlistseparator,
$if(
$set(temp,$0)
$set(tempb, )
$while( $set(cur,$split(temp,$char(32)))$temp,
$if($tempb,$set(tempb,$tempb$2$cur),$set(tempb,$1$cur)))
,
$tempb,
$tempb)
)
$// $converttosemi(a b c d) = a;b;c;d
$define(converttosemi,$convertlistseparator($0, ,;))
$// $converttodashi(a b c d) = -i a -i b -i c -i d
$define(converttodashi,$convertlistseparator($0,-i , -i ))
$default(TakeCPP,*.h,pre
$if($NoAutoInclude, ,
$if($wildcard($file,$NoAutoIncludeMatch), ,
$set(tccfile,$extension($file,c))
$set(tccppfile,$extension($file,cpp))
$if($exists($tccfile),
$requires($tccfile)
,
$if($exists($tccppfile),
$requires($tccppfile)
,
)
)
$set(tccfile,$clipfilename($file)/$BuildPlatform/$clipdir($tccfile))
$set(tccppfile,$clipfilename($file)/$BuildPlatform/$clipdir($tccppfile))
$if($exists($tccfile),
$requires($tccfile)
,
$if($exists($tccppfile),
$requires($tccppfile)
,
$set(tccfile,$clipfilename($file)/$BuildPlatform/$BuildPlatform_$clipdir($tccfile))
$set(tccppfile,$clipfilename($file)/$BuildPlatform/$BuildPlatform_$clipdir($tccppfile))
$if($exists($tccfile),
$requires($tccfile)
,
$if($exists($tccppfile),
$requires($tccppfile)
,
$set(tccfile,$clipfilename($file)/ansi/$extension($clipdir($file),c))
$set(tccppfile,$clipfilename($file)/ansi/$extension($clipdir($file),cpp))
$if($exists($tccfile),
$requires($tccfile)
,
$if($exists($tccppfile),
$requires($tccppfile)
,
$set(tccfile,$clipfilename($file)/ansi/ansi_$extension($clipdir($file),c))
$set(tccppfile,$clipfilename($file)/ansi/ansi_$extension($clipdir($file),cpp))
$if($exists($tccfile),
$requires($tccfile)
,
$if($exists($tccppfile),
$requires($tccppfile)
,
)
)
)
)
)
)
)
)
)
)
)
$define( BuildPSThreeLib,
$if($ispresent($doingplatforms,PS3),
$if($exists($psThreec)$LogMode,
$RunIfAny($Cs, Compiling..., $psThreec, $psThreecopts $psThreecswitches -D__RADINSTATICLIB__ $INCs ?eval(?clipdir(?currentfile)_switches) ?currentfile -o ?extension(?clipdir(?currentfile),obj), $TempsTo, [start C $outname], [in $outname] )
$RunIfAny($CPPs, Compiling..., $psThreecpp, $psThreecppopts $psThreecswitches -D__RADINSTATICLIB__ $INCs ?eval(?clipdir(?currentfile)_switches) ?currentfile -o ?extension(?clipdir(?currentfile),obj), $TempsTo, [start C $outname], [in $outname] )
$RunIfAny($ASMs, Assembling..., $psThreea, $psThreeaswitches -D__RADINSTATICLIB__ $INCs ?currentfile -o ?extension(?clipdir(?currentfile),obj), $TempsTo, [start A $outname], [in $outname] )
$RemoveLibs(LinkBins,$LinkBins)
$if($printoutname, $echo(outname: $outname), )
$if($CPPs $Cs $ASMs $NEWOBJs $NewLinkBins $Not($exists($outname)), $removefile($outname) $dorunback( Linking..., $psthreelib, -c -q $outname $dosify($OBJs) $LinkBins, $BuildDir, [in $outname];$LinkBinsSemi, $outname ), )
, $warnmissing( No PS3 tools installed ) )
, )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment