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 = "" ;
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 ; }
30 if $(fname) ~= '^!!' {
31 fname = [ Match '^!([^\s]+)' : $(fname) ] ;
34 if $(lastfile) { res += $(lastfile) ; }
35 lastfile = [ FGristFiles $(fname) ] ;
38 if $(lastfile) { res += $(lastfile) ; }
39 res = $(have_attrs) [ ListRemoveDuplicates $(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
55 for local fname in $(<) {
56 local fm = [ Match '^!([^!].+)$' : $(fname) ] ;
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) ;
65 Exit 'FATAL: invalid attribute' $(fm) 'for file' $(lfm) ;
70 if $(fname) ~= '^!!' {
71 fname = [ Match '^!([^\s]+)' : $(fname) ] ;
82 . Jambase.main.attrs.def