cosmetix in Jambase: use single-quoted string where appropriate
[k8jam.git] / defaults / main / Jambase.main.attrs
blob68f4e0e8f4cdff6f2437cdefa67ad5185f63758b
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15 # /--main-preprocess-attrs-- flist ;
17 # flist: list from *Main and so on with changed suffixes (i.e. ready to be gristed)
19 # returns file list suitable for Objects rule (gristed) prepended with 'have-attrs' flag
21 rule --main-preprocess-attrs-- {
22   local have_attrs = "" ;
23   local lastfile = ;
24   local res = ;
25   # rebuild list removing any attributes
26   for local fname in $(<) {
27     if $(fname) ~= '^![^!]' {
28       if $(fname:S=) = '!dont-link' { lastfile = ; } else { have_attrs = tan ; }
29     } else {
30       if $(fname) ~= '^!!' {
31         fname = [ Match '^!([^\s]+)' : $(fname) ] ;
32         fname = $(fname[1]) ;
33       }
34       if $(lastfile) { res += $(lastfile) ; }
35       lastfile = [ FGristFiles $(fname) ] ;
36     }
37   }
38   if $(lastfile) { res += $(lastfile) ; }
39   res = $(have_attrs) [ ListRemoveDuplicates $(res) ] ;
40   return $(res) ;
45 # /--main-postprocess-attrs-- origlist ;
47 # origlist: list from *Main and so on WITHOUT changed suffixes (i.e. original list)
49 # returns list with removed attrs.
50 # side effect: sets attrs on object file (by calling --main-option-...--
52 rule --main-postprocess-attrs-- {
53   local lfm = ; # last file met, unmodified
54   local res = ;
55   for local fname in $(<) {
56     local fm = [ Match '^!([^!].+)$' : $(fname) ] ;
57     if $(fm) {
58       if $(lfm) {
59         fm = $(fm[1]);
60         #Echo 'ATTR:' $(fm) 'for file:' $(lfm) 'ungristed:' $(lfm) ;
61         if $(fm) != 'dont-link' {
62           if [ HaveRule --main-option-$(fm)-- ] {
63             --main-option-$(fm)-- [ FGristFiles $(lfm:S=$(SUFOBJ)) ] : $(lfm) ;
64           } else {
65             Exit 'FATAL: invalid attribute' $(fm) 'for file' $(lfm) ;
66           }
67         }
68       }
69     } else {
70       if $(fname) ~= '^!!' {
71         fname = [ Match '^!([^\s]+)' : $(fname) ] ;
72         fname = $(fname[1]) ;
73       }
74       res += $(fname) ;
75       lfm = $(fname) ;
76     }
77   }
78   return $(res) ;
82 . Jambase.main.attrs.def