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/>.
14 # /GenFile target : image sources [: dependencies ] ;
16 # Runs the command "_image_ _target_ _sources_" to create _target_ from
17 # _sources_ and _image_ (where _image_ is an executable built by the @Main rule).
18 # 'source' starts with '-' or '/' is an option, don't include it in dependency graph.
19 # 'source' starts with '*' switches generator to GenFile2, which will not automatically
20 # add target to argument list.
21 # 'source' equals to $$ means '_target_' and switches to GenFile2.
22 # if 'image' starts with ':', this is standalone file, don't append any suffix to it.
25 ### Echo 'my GenFile!' ;
28 ### Echo ' exe:' $(>[1]) ;
29 local _exe = [ Match '^:(.+)$' : $(>[1]) ] ;
30 if ! $(_exe) { _exe = [ FAppendSuffix $(>[1]) : $(SUFEXE) ] ; } else { _exe = $(_exe[1]) ; }
31 local _t = [ FGristFiles $(<) ] ;
32 ### Echo $(_t) 'depends on' $(_exe) $(3) ;
33 Depends $(_t) : $(_exe) $(3) ;
34 local target_rule = GenFile1 ;
36 for local s in $(>[2-]) {
38 # don't add "$$" to 'dependency list', add real target to arguments
40 target_rule = GenFile2 ;
41 } else if ! ( $(s) ~= '^[-/]' ) {
42 local t = [ Match '^\*(.*)$' : $(s) ] ;
47 Depends $(_t) : $(t) ;
49 target_rule = GenFile2 ;
52 Depends $(_t) : $(s) ;
55 ### Echo 'option skipped:' $(s) ;
61 #Depends $(_t) : $(_exe) $(>[2-]) ;
62 ### Echo ' _t:' $(_t) ;
63 ### Echo ' sl:' $(sl) ;
64 $(target_rule) $(_t) : $(_exe) $(sl) ;
70 MakeLocate $(<) : $(LOCATE_SOURCE) ;
71 SEARCH on $(>) = $(SEARCH_SOURCE) ;
80 MakeLocate $(<) : $(LOCATE_SOURCE) ;
81 SEARCH on $(>) = $(SEARCH_SOURCE) ;
90 local _t = [ FGristFiles $(<) ] ;
91 Includes $(_t) : $(>) ;