Scanrules.mk revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/*
* Glenn Fowler
* AT&T Research
*
* scan strategies -- oh no, another little language
*
* except for .SCAN.c, which must differentiate "..." from <...>,
* .SOURCE.%.SCAN.<lang> should specify the binding dirs
*/
/*
* $(.INCLUDE. <lang> [<flag>])
*
* return <flag> option list for .SCAN.<lang>
* .SCAN.c is handled in .MAKEINIT
*/
/*
* .PFX.INCLUDE stuff needed for C #include "..." compatibility
* --noprefix-include to turn off the hack
*/
if "$(%:A=.DONTCARE)"
$(%:B:S) : .DONTCARE
return $(%:B:S)
if "$(%%)" != "/*" && "$(<<:O=1:P=U)" != "." && ( "$(-target-context)" || "$(-recurse)" == "combine" && "$(%%:P=U)" != "*/*" || "$(<<:A:A=.SCAN:O=1)" == "$(<<<:A:A=.SCAN:O=1)" && "$(%%:P=U:D)" == ".|../*" )
if ! "$(%%:T=XG)"
local B
B := $(<<`;O=1;P=U;D;B=$$(%%);P=C)
if B == "../*"
B := $(<<<:O=1:P=U:D)/$(B)
B := $(B:P=C)
if "$(%%:A=.DONTCARE)"
$(B) : .DONTCARE
return $(B)
return $(%%)
if ! "$(-prefix-include)" && ! "$(-target-context)"
local P S
if S = "$(P:P=U:D:U:N!=.)"
return $(P:P=D:X=$(S):T>FD:U)
O|S|
Q|/*|*/||C|
Q|//||\\|LC|
Q|"|"|\\|LQ|
Q|'|'|\\|LQ|
Q|\\|||CS|
D| \# define %|
B| \# if|
E| \# endif|
I| include '%'|
I| INCLUDE '%'|
O|M|
I|%|
Q|/*|*/||CW|
Q|"|"|\\|LQ|
Q|'|'|\\|LQ|
Q|\\|||CS|
B|if|
B| \# if|
E|end|
E| \# endif|
I|include "%"|M$$(%)|
I|include %|M$$(%)|
Q|(*|*)||C|
Q|{|}||C|
Q|"|"|\\|LQ|
I| \# include '%'|
I| include '%'|
I| include "%"|
I| include % |
I| INCLUDE '%'|
I| INCLUDE "%"|
I| INCLUDE % |
O|S|
Q|#||\\|LCW|
Q|'|'||Q|
Q|$'|'|\\|Q|
Q|\\|||QS|
if "$(%:N!=*.h)"
return $(%).h
Q|/*|*/||C|
Q|//||\\|LC|
Q|"|"|\\|LQ|
Q|'|'|\\|LQ|
Q|\\|||CS|
I| \## include "%"|
I| \## include % |M$$(%:/;.*//)|
I| $ include <%> |
I| $ include "%" |
I| $ include '%' |
I| $ include % |M$$(%:/;.*//)|
I| . % |A.DONTCARE|M$$(%:C%.*[`$&].*%%:C%['"]%%:C%["']$%%)|
I| *< % |A.DONTCARE|M$$(%:C%.*[`$&].*%%:C%['"]%%:C%["']$%%)|
local F L Q S T ignorecase
for L $(%)
if L == "--ignorecase"
ignorecase = 1
elif L != "--*"
break
F := $(%%:/ .*//:/\.$//:/'\(.*\)'/\1/)
Q := $("\"")
if F == "$(Q)*$(Q)"
F := $(F:/^$(Q)//:/$(Q)$//)
if ! "$(F:S)"
T := $(F)$(S)
$(T) : .SCAN.$(L)
if "$(T:T=F)"
F := $(T)
break
if ignorecase
if T != "*[[:lower:]]*"
Q := $(T:F=%(lower)s)
$(Q) : .SCAN.$(L)
if "$(Q:T=F)"
F := $(Q)
break
elif T != "[*[[:upper:]]*"
Q := $(T:F=%(upper)s)
$(Q) : .SCAN.$(L)
if "$(Q:T=F)"
F := $(Q)
break
return $(F)
I| include % |
I| inc % |