~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to genmk.rb

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/ruby -w
2
 
#
3
 
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
4
 
#
5
 
# This genmk.rb is free software; the author
6
 
# gives unlimited permission to copy and/or distribute it,
7
 
# with or without modifications, as long as this notice is preserved.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11
 
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
 
# PARTICULAR PURPOSE.
13
 
 
14
 
module Enumerable
15
 
  def collect_with_index
16
 
    ret = []
17
 
    self.each_with_index do |item, index|
18
 
      ret.push(yield(item, index))
19
 
    end
20
 
    ret
21
 
  end
22
 
end
23
 
 
24
 
class String
25
 
  def to_var
26
 
    self.gsub(/[^a-zA-Z0-9_@]/, '_')
27
 
  end
28
 
 
29
 
  def suffix(str)
30
 
    self.sub(/\.[^\.]*$/, '') + '.' + str
31
 
  end
32
 
 
33
 
  def to_obj
34
 
    self.sub(/\.[^\.]*$/, '').to_var + '.o'
35
 
  end
36
 
end
37
 
 
38
 
class Image
39
 
  def initialize(dir, name)
40
 
    @dir = dir
41
 
    @name = name
42
 
    @rule_count = 0
43
 
  end
44
 
  attr_reader :dir, :name
45
 
 
46
 
  def rule(sources)
47
 
    prefix = @name.to_var
48
 
    @rule_count += 1
49
 
    exe = @name.suffix('exec')
50
 
    objs = sources.collect do |src|
51
 
      raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
52
 
      prefix + '-' + src.to_obj
53
 
    end
54
 
    objs_str = objs.join(' ')
55
 
    deps = objs.collect {|obj| obj.suffix('d')}
56
 
    deps_str = deps.join(' ')
57
 
 
58
 
"
59
 
clean-image-#{@name}.#{@rule_count}:
60
 
        rm -f #{@name} #{exe} #{objs_str}
61
 
 
62
 
CLEAN_IMAGE_TARGETS += clean-image-#{@name}.#{@rule_count}
63
 
 
64
 
mostlyclean-image-#{@name}.#{@rule_count}:
65
 
        rm -f #{deps_str}
66
 
 
67
 
MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count}
68
 
 
69
 
ifneq ($(TARGET_APPLE_CC),1)
70
 
#{@name}: #{exe}
71
 
        $(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@
72
 
else
73
 
ifneq (#{exe},kernel.exec)
74
 
#{@name}: #{exe} ./grub-macho2img
75
 
        ./grub-macho2img $< $@
76
 
else
77
 
#{@name}: #{exe} ./grub-macho2img
78
 
        ./grub-macho2img --bss $< $@
79
 
endif
80
 
endif
81
 
 
82
 
#{exe}: #{objs_str}
83
 
        $(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
84
 
 
85
 
" + objs.collect_with_index do |obj, i|
86
 
      src = sources[i]
87
 
      fake_obj = File.basename(src).suffix('o')
88
 
      dep = deps[i]
89
 
      flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
90
 
      extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
91
 
      dir = File.dirname(src)
92
 
 
93
 
      "#{obj}: #{src} $(#{src}_DEPENDENCIES)
94
 
        $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
95
 
-include #{dep}
96
 
 
97
 
"
98
 
    end.join('')
99
 
  end
100
 
end
101
 
 
102
 
# Use PModule instead Module, to avoid name conflicting.
103
 
class PModule
104
 
  def initialize(dir, name)
105
 
    @dir = dir
106
 
    @name = name
107
 
    @rule_count = 0
108
 
  end
109
 
  attr_reader :dir, :name
110
 
 
111
 
  def rule(sources)
112
 
    prefix = @name.to_var
113
 
    @rule_count += 1
114
 
    objs = sources.collect do |src|
115
 
      raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
116
 
      prefix + '-' + src.to_obj
117
 
    end
118
 
    objs_str = objs.join(' ')
119
 
    deps = objs.collect {|obj| obj.suffix('d')}
120
 
    deps_str = deps.join(' ')
121
 
    pre_obj = 'pre-' + @name.suffix('o')
122
 
    mod_src = 'mod-' + @name.suffix('c')
123
 
    mod_obj = mod_src.suffix('o')
124
 
    defsym = 'def-' + @name.suffix('lst')
125
 
    undsym = 'und-' + @name.suffix('lst')
126
 
    mod_name = File.basename(@name, '.mod')
127
 
    symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
128
 
 
129
 
"
130
 
clean-module-#{@name}.#{@rule_count}:
131
 
        rm -f #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
132
 
 
133
 
CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count}
134
 
 
135
 
clean-module-#{@name}-symbol.#{@rule_count}:
136
 
        rm -f #{defsym}
137
 
 
138
 
CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count}
139
 
DEFSYMFILES += #{defsym}
140
 
mostlyclean-module-#{@name}.#{@rule_count}:
141
 
        rm -f #{deps_str}
142
 
 
143
 
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
144
 
UNDSYMFILES += #{undsym}
145
 
 
146
 
ifneq ($(TARGET_APPLE_CC),1)
147
 
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
148
 
        -rm -f $@
149
 
        $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
150
 
        if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
151
 
        $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
152
 
else
153
 
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
154
 
        -rm -f $@
155
 
        -rm -f $@.bin
156
 
        $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj}
157
 
        $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@
158
 
        -rm -f $@.bin
159
 
endif
160
 
 
161
 
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
162
 
        -rm -f $@
163
 
        $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
164
 
 
165
 
#{mod_obj}: #{mod_src}
166
 
        $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
167
 
 
168
 
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
169
 
        sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
170
 
 
171
 
ifneq ($(TARGET_APPLE_CC),1)
172
 
#{defsym}: #{pre_obj}
173
 
        $(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
174
 
else
175
 
#{defsym}: #{pre_obj}
176
 
        $(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]'  | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
177
 
endif
178
 
 
179
 
#{undsym}: #{pre_obj}
180
 
        echo '#{mod_name}' > $@
181
 
        $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
182
 
 
183
 
" + objs.collect_with_index do |obj, i|
184
 
      src = sources[i]
185
 
      fake_obj = File.basename(src).suffix('o')
186
 
      extra_target = obj.sub(/\.[^\.]*$/, '') + '-extra'
187
 
      command = 'cmd-' + obj.suffix('lst')
188
 
      fs = 'fs-' + obj.suffix('lst')
189
 
      partmap = 'partmap-' + obj.suffix('lst')
190
 
      handler = 'handler-' + obj.suffix('lst')
191
 
      terminal = 'terminal-' + obj.suffix('lst')
192
 
      parttool = 'parttool-' + obj.suffix('lst')
193
 
      video = 'video-' + obj.suffix('lst')
194
 
      dep = deps[i]
195
 
      flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
196
 
      extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
197
 
      dir = File.dirname(src)
198
 
 
199
 
      "#{obj}: #{src} $(#{src}_DEPENDENCIES)
200
 
        $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
201
 
-include #{dep}
202
 
 
203
 
clean-module-#{extra_target}.#{@rule_count}:
204
 
        rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video}
205
 
 
206
 
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
207
 
 
208
 
COMMANDFILES += #{command}
209
 
FSFILES += #{fs}
210
 
PARTTOOLFILES += #{parttool}
211
 
PARTMAPFILES += #{partmap}
212
 
HANDLERFILES += #{handler}
213
 
TERMINALFILES += #{terminal}
214
 
VIDEOFILES += #{video}
215
 
 
216
 
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
217
 
        set -e; \
218
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
219
 
          | sh $(srcdir)/gencmdlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
220
 
 
221
 
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
222
 
        set -e; \
223
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
224
 
          | sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
225
 
 
226
 
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
227
 
        set -e; \
228
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
229
 
          | sh $(srcdir)/genparttoollist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
230
 
 
231
 
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
232
 
        set -e; \
233
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
234
 
          | sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
235
 
 
236
 
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
237
 
        set -e; \
238
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
239
 
          | sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
240
 
 
241
 
#{terminal}: #{src} $(#{src}_DEPENDENCIES) genterminallist.sh
242
 
        set -e; \
243
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
244
 
          | sh $(srcdir)/genterminallist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
245
 
 
246
 
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
247
 
        set -e; \
248
 
          $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
249
 
          | sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
250
 
 
251
 
"
252
 
    end.join('')
253
 
  end
254
 
end
255
 
 
256
 
class Utility
257
 
  def initialize(dir, name)
258
 
    @dir = dir
259
 
    @name = name
260
 
    @rule_count = 0
261
 
  end
262
 
  def print_tail()
263
 
    prefix = @name.to_var
264
 
    print "#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
265
 
        $(CC) -o $@ $(#{prefix}_OBJECTS) $(LDFLAGS) $(#{prefix}_LDFLAGS)
266
 
 
267
 
"
268
 
  end
269
 
  attr_reader :dir, :name
270
 
 
271
 
  def rule(sources)
272
 
    prefix = @name.to_var
273
 
    @rule_count += 1
274
 
    objs = sources.collect do |src|
275
 
      raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
276
 
      prefix + '-' + src.to_obj
277
 
    end
278
 
    objs_str = objs.join(' ');
279
 
    deps = objs.collect {|obj| obj.suffix('d')}
280
 
    deps_str = deps.join(' ');
281
 
 
282
 
    "
283
 
clean-utility-#{@name}.#{@rule_count}:
284
 
        rm -f #{@name}$(EXEEXT) #{objs_str}
285
 
 
286
 
CLEAN_UTILITY_TARGETS += clean-utility-#{@name}.#{@rule_count}
287
 
 
288
 
mostlyclean-utility-#{@name}.#{@rule_count}:
289
 
        rm -f #{deps_str}
290
 
 
291
 
MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count}
292
 
 
293
 
#{prefix}_OBJECTS += #{objs_str}
294
 
 
295
 
" + objs.collect_with_index do |obj, i|
296
 
      src = sources[i]
297
 
      fake_obj = File.basename(src).suffix('o')
298
 
      dep = deps[i]
299
 
      dir = File.dirname(src)
300
 
 
301
 
      "#{obj}: #{src} $(#{src}_DEPENDENCIES)
302
 
        $(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
303
 
-include #{dep}
304
 
 
305
 
"
306
 
    end.join('')
307
 
  end
308
 
end
309
 
 
310
 
class Program
311
 
  def initialize(dir, name)
312
 
    @dir = dir
313
 
    @name = name
314
 
  end
315
 
  attr_reader :dir, :name
316
 
 
317
 
  def rule(sources)
318
 
    prefix = @name.to_var
319
 
    objs = sources.collect do |src|
320
 
      raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
321
 
      prefix + '-' + src.to_obj
322
 
    end
323
 
    objs_str = objs.join(' ');
324
 
    deps = objs.collect {|obj| obj.suffix('d')}
325
 
    deps_str = deps.join(' ');
326
 
 
327
 
    "CLEANFILES += #{@name} #{objs_str}
328
 
MOSTLYCLEANFILES += #{deps_str}
329
 
 
330
 
ifeq ($(#{prefix}_RELOCATABLE),yes)
331
 
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
332
 
        $(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
333
 
        $(STRIP) --strip-unneeded -K start -R .note -R .comment $@
334
 
else
335
 
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
336
 
        $(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
337
 
        $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@
338
 
endif
339
 
 
340
 
" + objs.collect_with_index do |obj, i|
341
 
      src = sources[i]
342
 
      fake_obj = File.basename(src).suffix('o')
343
 
      dep = deps[i]
344
 
      flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
345
 
      extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
346
 
      dir = File.dirname(src)
347
 
 
348
 
      "#{obj}: #{src} $(#{src}_DEPENDENCIES)
349
 
        $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
350
 
 
351
 
-include #{dep}
352
 
 
353
 
"
354
 
    end.join('')
355
 
  end
356
 
end
357
 
 
358
 
class Script
359
 
  def initialize(dir, name)
360
 
    @dir = dir
361
 
    @name = name
362
 
  end
363
 
  attr_reader :dir, :name
364
 
 
365
 
  def rule(sources)
366
 
    if sources.length != 1
367
 
      raise "only a single source file must be specified for a script"
368
 
    end
369
 
    src = sources[0]
370
 
    if /\.in$/ !~ src
371
 
      raise "unknown source file `#{src}'"
372
 
    end
373
 
 
374
 
    "CLEANFILES += #{@name}
375
 
 
376
 
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
377
 
        ./config.status --file=-:#{src} | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
378
 
        chmod +x $@
379
 
 
380
 
"
381
 
  end
382
 
end
383
 
 
384
 
images = []
385
 
utils = []
386
 
pmodules = []
387
 
programs = []
388
 
scripts = []
389
 
 
390
 
l = gets
391
 
print l
392
 
print "# Generated by genmk.rb, please don't edit!\n"
393
 
 
394
 
cont = false
395
 
str = nil
396
 
while l = gets
397
 
  if cont
398
 
    str += l
399
 
  else
400
 
    str = l
401
 
  end
402
 
 
403
 
  print l
404
 
  cont = (/\\$/ =~ l)
405
 
  unless cont
406
 
    str.gsub!(/\\\n/, ' ')
407
 
 
408
 
    if /^([a-zA-Z0-9_]+)\s*\+?=\s*(.*?)\s*$/ =~ str
409
 
      var, args = $1, $2
410
 
 
411
 
      if var =~ /^([a-zA-Z0-9_]+)_([A-Z]+)$/
412
 
        prefix, type = $1, $2
413
 
 
414
 
        case type
415
 
        when 'IMAGES'
416
 
          images += args.split(/\s+/).collect do |img|
417
 
            Image.new(prefix, img)
418
 
          end
419
 
 
420
 
        when 'MODULES'
421
 
          pmodules += args.split(/\s+/).collect do |pmod|
422
 
            PModule.new(prefix, pmod)
423
 
          end
424
 
 
425
 
        when 'UTILITIES'
426
 
          utils += args.split(/\s+/).collect do |util|
427
 
            Utility.new(prefix, util)
428
 
          end
429
 
 
430
 
        when 'PROGRAMS'
431
 
          programs += args.split(/\s+/).collect do |prog|
432
 
            Program.new(prefix, prog)
433
 
          end
434
 
 
435
 
        when 'SCRIPTS'
436
 
          scripts += args.split(/\s+/).collect do |script|
437
 
            Script.new(prefix, script)
438
 
          end
439
 
 
440
 
        when 'SOURCES'
441
 
          if img = images.detect() {|i| i.name.to_var == prefix}
442
 
            print img.rule(args.split(/\s+/))
443
 
          elsif pmod = pmodules.detect() {|m| m.name.to_var == prefix}
444
 
            print pmod.rule(args.split(/\s+/))
445
 
          elsif util = utils.detect() {|u| u.name.to_var == prefix}
446
 
            print util.rule(args.split(/\s+/))
447
 
          elsif program = programs.detect() {|u| u.name.to_var == prefix}
448
 
            print program.rule(args.split(/\s+/))
449
 
          elsif script = scripts.detect() {|s| s.name.to_var == prefix}
450
 
            print script.rule(args.split(/\s+/))
451
 
          end
452
 
        end
453
 
      end
454
 
 
455
 
    end
456
 
 
457
 
  end
458
 
 
459
 
end
460
 
utils.each {|util| util.print_tail()}
461