partial patch/partial by-hand merge of 2.X commits 3169&3170 to 3.X codebase
[ardour.git] / gtk2_ardour / SConscript
1 # -*- python -*-
2
3 import os
4 import os.path
5 import glob
6
7 Import('env install_prefix final_prefix config_prefix libraries i18n ardour_version')
8
9 gtkardour = env.Clone()
10 gtkmmtests = env.Clone()
11
12 #
13 # this defines the version number of the GTK interface to ardour
14 #
15
16 domain = 'gtk2_ardour'
17
18 gtkardour.Append(DOMAIN=domain, MAJOR=1,MINOR=0,MICRO=2)
19 gtkardour.Append(CCFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
20 gtkardour.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
21 gtkardour.Append(CXXFLAGS=["-DLIBSIGC_DISABLE_DEPRECATED", "-DGLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED", "-DGLIBMM_EXCEPTIONS_ENABLED", "-DGLIBMM_PROPERTIES_ENABLED"])
22 gtkardour.Append(CPPPATH="#/")  # for top level svn_revision.h
23 #gtkardour.Append(CXXFLAGS="-DFLOWCANVAS_AA")
24 gtkardour.Append(PACKAGE=domain)
25 gtkardour.Append(POTFILE=domain + '.pot')
26
27 if gtkardour['IS_OSX']:
28        gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048 -framework CoreAudio")
29
30 gtkardour.Merge ([
31     libraries['ardour'],
32     libraries['ardour_cp'],
33     libraries['asound'],
34     libraries['atkmm'],
35     libraries['cairomm'],
36     libraries['fftw3'],
37     libraries['fftw3f'],
38     libraries['freetype2'],
39     libraries['gdkmm2'],
40     libraries['glib2'],
41     libraries['glibmm2'],
42     libraries['gtk2'],
43     libraries['gtkmm2'],
44     libraries['gtkmm2ext'],
45     libraries['jack'],
46     libraries['libgnomecanvas2'],
47     libraries['libgnomecanvasmm'],
48     libraries['lrdf'],
49     libraries['midi++2'],
50     libraries['evoral'],
51     libraries['pangomm'],
52     libraries['pbd'],
53     libraries['samplerate'],
54     libraries['sigc2'],
55     libraries['sndfile'],
56     libraries['taglib'],
57     libraries['sysmidi'],
58     libraries['vamp'],
59     libraries['vamphost'],
60     libraries['xml'],
61     libraries['xslt']
62 ])
63
64 gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
65
66 gtkmmtests.Merge ([
67     libraries['atkmm'],
68     libraries['gdkmm2'],
69     libraries['glib2'],
70     libraries['glibmm2'],
71     libraries['gtk2'],
72     libraries['gtkmm2'],
73     libraries['pangomm'],
74     libraries['sigc2']
75 ])
76
77 if gtkardour['DMALLOC']:
78         gtkardour.Merge([libraries['dmalloc']])
79         gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
80
81 if gtkardour['FREESOUND']:
82         gtkardour.Merge ([libraries['curl']])
83         gtkardour.Append(CCFLAGS='-DFREESOUND')
84
85 if gtkardour['RUBBERBAND']:
86         gtkardour.Merge ([ libraries['rubberband'] ])
87 else:
88         gtkardour.Merge ([ libraries['soundtouch'] ])
89
90 skipped_files=Split("""
91 connection_editor.cc
92 """)
93
94 audiounit_files=Split("""
95 au_pluginui.mm
96 """)
97
98 gtkosx_files=Split("""
99 cocoacarbon.mm
100 """)
101
102 x11_files=Split("""
103 x11.cc
104 """)
105
106 gtkardour_files=Split("""
107 about.cc
108 actions.cc
109 add_midi_cc_track_dialog.cc
110 add_route_dialog.cc
111 analysis_window.cc
112 ardour_dialog.cc
113 ardour_ui.cc
114 ardour_ui2.cc
115 ardour_ui_dependents.cc
116 ardour_ui_dialogs.cc
117 ardour_ui_ed.cc
118 ardour_ui_mixer.cc
119 ardour_ui_options.cc
120 audio_clock.cc
121 audio_region_editor.cc
122 audio_region_view.cc
123 audio_streamview.cc
124 audio_time_axis.cc
125 automation_controller.cc
126 automation_line.cc
127 automation_region_view.cc
128 automation_streamview.cc
129 automation_time_axis.cc
130 axis_view.cc
131 bundle_manager.cc
132 canvas-note-event.cc
133 canvas-note.cc
134 canvas-program-change.cc
135 canvas-simpleline.c
136 canvas-simplerect.c
137 canvas-waveview.c
138 control_point.cc
139 crossfade_edit.cc
140 crossfade_view.cc
141 curvetest.cc
142 diamond.cc
143 editing.cc
144 editor.cc
145 editor_actions.cc
146 editor_audio_import.cc
147 editor_audiotrack.cc
148 editor_canvas.cc
149 editor_canvas_events.cc
150 editor_cursors.cc
151 editor_edit_groups.cc
152 editor_export_audio.cc
153 editor_hscroller.cc
154 editor_keyboard.cc
155 editor_keys.cc
156 editor_markers.cc
157 editor_mixer.cc
158 editor_mouse.cc
159 editor_nudge.cc
160 editor_ops.cc
161 editor_region_list.cc
162 editor_route_list.cc
163 editor_rulers.cc
164 editor_scrub.cc
165 editor_selection.cc
166 editor_selection_list.cc
167 editor_tempodisplay.cc
168 editor_timefx.cc
169 engine_dialog.cc
170 enums.cc
171 export_channel_selector.cc
172 export_dialog.cc
173 export_filename_selector.cc
174 export_file_notebook.cc
175 export_format_dialog.cc
176 export_format_selector.cc
177 export_preset_selector.cc
178 export_timespan_selector.cc
179 fft.cc
180 fft_graph.cc
181 fft_result.cc
182 plugin_eq_gui.cc
183 gain_meter.cc
184 generic_pluginui.cc
185 ghostregion.cc
186 gtk-custom-hruler.c
187 gtk-custom-ruler.c
188 io_selector.cc
189 keyboard.cc
190 keyeditor.cc
191 latency_gui.cc
192 level_meter.cc
193 lineset.cc
194 location_ui.cc
195 main.cc
196 marker.cc
197 matrix.cc
198 midi_channel_selector.cc
199 midi_port_dialog.cc
200 midi_region_view.cc
201 midi_scroomer.cc
202 midi_streamview.cc
203 midi_time_axis.cc
204 midi_patch_manager.cc
205 mixer_strip.cc
206 mixer_ui.cc
207 new_session_dialog.cc
208 option_editor.cc
209 opts.cc
210 panner.cc
211 panner2d.cc
212 panner_ui.cc
213 piano_roll_header.cc
214 playlist_selector.cc
215 plugin_selector.cc
216 plugin_ui.cc
217 port_matrix.cc
218 processor_box.cc
219 prompter.cc
220 public_editor.cc
221 region_gain_line.cc
222 region_selection.cc
223 region_view.cc
224 rhythm_ferret.cc
225 route_params_ui.cc
226 route_processor_selection.cc
227 route_time_axis.cc
228 route_ui.cc
229 selection.cc
230 send_ui.cc
231 session_import_dialog.cc
232 session_metadata_dialog.cc
233 sfdb_ui.cc
234 simpleline.cc
235 simplerect.cc
236 splash.cc
237 streamview.cc
238 tape_region_view.cc
239 tempo_dialog.cc
240 tempo_lines.cc
241 theme_manager.cc
242 time_axis_view.cc
243 time_axis_view_item.cc
244 time_selection.cc
245 ui_config.cc
246 utils.cc
247 version.cc
248 waveview.cc
249 """)
250
251 freesound_files=Split("""
252 sfdb_freesound_mootcher.cc
253 """)
254
255 pixmap_files = glob.glob('pixmaps/*.xpm')
256 icon_files = glob.glob ('icons/*.png')
257
258 intl_files = gtkardour_files + glob.glob('*.h')
259
260 evtest_files=Split("""
261 evtest.cc
262 """)
263
264 mtest_files=Split("""
265 mtest.cc
266 """)
267
268
269 rcu_files=Split("""
270 rcu.cc
271 """)
272
273 itest_files=Split("""
274 itest.cc
275 """)
276
277 stest_files=Split("""
278 stest.cc
279 """)
280
281 tt_files=Split ("""
282 tt.cc
283 """)
284
285 extra_sources = []
286
287 vst_files = [ 'vst_pluginui.cc' ]
288
289 if env['VST']:
290         extra_sources += vst_files
291         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
292
293 lv2_files = [ 'lv2_plugin_ui.cc' ]
294
295 if env['LV2']:
296         extra_sources += lv2_files
297         gtkardour.Append (CCFLAGS="-DHAVE_LV2")
298         gtkardour.Merge ([libraries['slv2']])
299
300
301 if gtkardour['GTKOSX']:
302         extra_sources += gtkosx_files
303         gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
304         gtkardour.Append (LINKFLAGS=" -framework AppKit -framework CoreAudioKit")
305
306         if gtkardour['AUDIOUNITS']:
307                 extra_sources += audiounit_files
308                 gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
309                 gtkardour.Merge([libraries['appleutility']])
310
311 else:
312    extra_sources += x11_files
313         
314  
315 if env['FREESOUND']:
316         extra_sources += freesound_files
317
318 intl_files += extra_sources
319
320 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
321 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
322
323 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
324
325 gtkardour.Append(CXXFLAGS=versionflag)
326
327 executable = 'ardour-' + ardour_version
328
329 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
330 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
331
332 evest = gtkmmtests.Program(target = 'evtest', source = evtest_files)
333 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
334 itest = gtkardour.Program(target = 'itest', source = itest_files)
335 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
336 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
337
338 my_font_dict = { }
339
340 if gtkardour['IS_OSX']:
341         #
342         # OS X font rendering is different even with X11
343         #
344
345         font_sizes = {
346                 'TINY' : '7',
347                 'SMALLER' : '9',
348                 'SMALL' : '10',
349                 'NORMAL' : '11',
350                 'BIG' : '12',
351                 'BIGGER' : '14',
352                 'LARGE' : '18',
353                 'LARGER' : '28',
354                 'HUGER' : '36',
355                 'MASSIVE' : '60'
356                 }
357         basefont = "Lucida Grande"
358
359 else:
360         #
361         # Linux/X11 font rendering
362         #
363         
364         if gtkardour['OLDFONTS']:
365                 font_sizes = {
366                         'TINY' : '4',
367                         'SMALLER' : '6',
368                         'SMALL' : '7',
369                         'NORMAL' : '8',
370                         'BIG' : '12',
371                         'BIGGER' : '14',
372                         'LARGE' : '18',
373                         'LARGER' : '24',
374                         'HUGER' : '34',
375                         'MASSIVE' : '60'
376                         }
377         else:
378                 font_sizes = {
379                         'TINY' : '6',
380                         'SMALLER' : '8',
381                         'SMALL' : '9',
382                         'NORMAL' : '10',
383                         'BIG' : '14',
384                         'BIGGER' : '16',
385                         'LARGE' : '18',
386                         'LARGER' : '24',
387                         'HUGER' : '34',
388                         'MASSIVE' : '60'
389                         }
390
391         basefont = "sans"
392
393 for style in ['', 'BOLD', 'ITALIC']:
394         for sizename,points in font_sizes.iteritems():
395                 if (len (style)):
396                         key = "_".join (['FONT',style,sizename])
397                         fontstyle = " ".join ([basefont,style.lower(),points])
398                 else:
399                         key = "_".join (['FONT',sizename])
400                         fontstyle = " ".join ([basefont,points])
401
402                 key = '%' + key + '%'
403                 my_font_dict[key] = fontstyle
404
405 ardour_dark_theme = env.SubstInFile ('ardour3_ui_dark.rc', 'ardour3_ui_dark.rc.in', SUBST_DICT = my_font_dict)
406 ardour_light_theme = env.SubstInFile ('ardour3_ui_light.rc', 'ardour3_ui_light.rc.in', SUBST_DICT = my_font_dict)
407
408 my_subst_dict = { }
409
410 #
411 # null substitution just to avoid ardour.bindings being in svn
412 #
413
414 keybindings_dict = { }
415
416 if gtkardour['GTKOSX']:
417         #
418         # Command(Meta), Alt(Mod1), Ctrl, Shift
419         # **** as of february 4th 2008, OUR VERSION OF *****
420         # Gtk/Quartz maps:
421         #  NSCommand (aka "Command" aka "Apple" aka "Cauliflower") -> Meta
422         #  NSAlternate (aka "Option")  -> Mod1
423         #
424         keybindings_dict['%PRIMARY%'] = 'Meta'
425         keybindings_dict['%SECONDARY%'] = 'Mod1'
426         keybindings_dict['%TERTIARY%'] = 'Shift'
427         keybindings_dict['%LEVEL4%'] = 'Ctrl'
428         keybindings_dict['%WINDOW%'] = 'Mod1'
429 else:
430         #
431         # Ctrl, Alt, Shift, Mod4(Super/Windows/Hyper)
432         #
433         keybindings_dict['%PRIMARY%'] = 'Ctrl'
434         keybindings_dict['%SECONDARY%'] = 'Alt'
435         keybindings_dict['%TERTIARY%'] = 'Shift'
436         keybindings_dict['%LEVEL4%'] = env['WINDOWS_KEY']
437         keybindings_dict['%WINDOW%'] = 'Alt'
438
439 for b in [ 'SAE-de',  'SAE-us', 'mnemonic-us', 'ergonomic-us' ]:
440         target_file = b + '.bindings'
441         src_file = target_file + '.in'
442         Default (env.SubstInFile (target_file, src_file, SUBST_DICT = keybindings_dict))
443
444 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
445 my_subst_dict['%LIBDIR%'] = env['LIBDIR']
446 my_subst_dict['%VERSION%'] = ardour_version
447
448 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
449 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
450
451 ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
452 env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
453
454 Default(ardourdev)
455 Default(ardoursh)
456 Default(ardour_dark_theme)
457 Default(ardour_light_theme)
458
459 if env['VST']:
460         Default(ardourlib)
461         # the library - into the library dir
462         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour3'), ardourlib))
463 else:
464
465         if env['VERSIONED']:
466                 Default (env.VersionedExecutable ('tagged_executable', ardour))
467         else:
468                 Default(ardour)
469
470         #install
471
472         # the executable - into the library dir
473         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour3'), ardour))
474         # the script - into the bin dir
475         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour3', ardoursh))
476
477 if env['NLS']:
478         i18n (gtkardour, gtkardour_files+skipped_files, env)
479     
480 # configuration files
481 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_dark_theme))
482 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_light_theme))
483 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour3_ui_default.conf'))
484 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour.menus'))
485 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour-sae.menus'))
486 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ergonomic-us.bindings'))
487 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'mnemonic-us.bindings'))
488 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'SAE-de.bindings'))
489 # data files
490 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3'), 'splash.png'))
491 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3', 'pixmaps'), pixmap_files))
492 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3', 'icons'), icon_files))
493 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
494 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
495
496 # This will install icons and MIME type as per freedesktop.org specs. #
497 if env['FREEDESKTOP']:
498         desktop_icon_install_prefix = install_prefix + '/share/icons/hicolor'
499         # Install the desktop icons to the default locations #
500         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '16x16', 'apps', 'ardour2.png'), 'icons/ardour_icon_16px.png'))
501         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'apps', 'ardour2.png'), 'icons/ardour_icon_22px.png'))
502         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'apps', 'ardour2.png'), 'icons/ardour_icon_32px.png'))
503         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'apps', 'ardour2.png'), 'icons/ardour_icon_48px.png'))
504         # Install the mime type xml file and its icon #
505         env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'mime', 'packages'), 'ardour2.xml'))
506         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '16x16', 'mimetypes', 'application-x-ardour2.png'), 'icons/application-x-ardour_16px.png'))
507         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'mimetypes', 'application-x-ardour2.png'), 'icons/application-x-ardour_22px.png'))
508         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'mimetypes', 'application-x-ardour2.png'), 'icons/application-x-ardour_32px.png'))
509         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'mimetypes', 'application-x-ardour2.png'), 'icons/application-x-ardour_48px.png'))
510         env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'mime'), [], 'update-mime-database $TARGET'))
511         # Update the icon cache #
512         env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'touch --no-create $TARGET'))
513         env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'gtk-update-icon-cache $TARGET'))
514         # Make the ardour2.desktop file and install it #
515         env.Alias('install', env.Command ('ardour2.desktop', 'ardour2.desktop.in', 'cat $SOURCES  > $TARGET'))
516         env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'applications'), 'ardour2.desktop'))
517         env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'applications'), [], 'update-desktop-database $TARGET'))
518         # uninstall target.. needed to run  update-mime-database and update-desktop-database after removal. #`
519         remove_desktop_files = env.Command ('another_frobnicatory_decoy', [],
520                              [ Delete (install_prefix + '/share/mime/packages/ardour2.xml'),
521                                Delete (install_prefix + '/share/applications/ardour2.desktop'),
522                                Delete (desktop_icon_install_prefix + '/16x16/apps/ardour2.png'),
523                                Delete (desktop_icon_install_prefix + '/22x22/apps/ardour2.png'),
524                                Delete (desktop_icon_install_prefix + '/32x32/apps/ardour2.png'),
525                                Delete (desktop_icon_install_prefix + '/48x48/apps/ardour2.png'),
526                                Delete (desktop_icon_install_prefix + '/16x16/mimetypes/application-x-ardour2.png'),
527                                Delete (desktop_icon_install_prefix + '/22x22/mimetypes/application-x-ardour2.png'),
528                                Delete (desktop_icon_install_prefix + '/32x32/mimetypes/application-x-ardour2.png'),
529                                Delete (desktop_icon_install_prefix + '/48x48/mimetypes/application-x-ardour2.png'),
530                                Action ('update-mime-database ' + install_prefix + '/share/mime'),
531                                Action ('gtk-update-icon-cache ' + desktop_icon_install_prefix),
532                                Action ('update-desktop-database ' + install_prefix + '/share/applications')])
533         env.Alias('uninstall', remove_desktop_files)
534
535 #dist
536 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
537                                       [ 'SConscript',
538                                         'i18n.h', 'gettext.h',
539                                         'ardour.sh.in',
540                                         'ardev_common.sh.in',
541                                         'ardev', 'ardbg',
542                                         'ardour3_ui_dark.rc.in', 'ardour3_ui_light.rc.in', 'splash.png',
543                                         'ardour.menus', 'ardour-sae.menus', 
544                                         'mnemonic-us.bindings.in', 
545                                         'ergonomic-us.bindings.in', 
546                                         'SAE-us.bindings.in', 
547                                         'SAE-de.bindings.in', 
548                                         'ardour3_ui_default.conf',
549                                         'editor_xpms',
550                                         'ardour2.xml',
551                                         'ardour2.desktop.in'
552                                         ] +
553                                       gtkardour_files +
554                                       vst_files +
555                                       pixmap_files +
556                                       icon_files +
557                                       skipped_files +
558                                       audiounit_files + 
559                                       gtkosx_files +
560                                       x11_files +
561                                       freesound_files +
562                                       glob.glob('po/*.po') + glob.glob('*.h')))
563
564 # generate a prototype full-featured ardour_ui.rc file
565
566 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
567      grep set_name $SOURCES | \
568 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
569 grep -v '\\.' | sort | uniq | \
570 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
571   fg[NORMAL] =   { 0, 0, 0 }\\n\
572   fg[ACTIVE] =   { 0, 0, 0 }\\n\
573   fg[SELECTED] = { 0, 0, 0 }\\n\
574   bg[NORMAL] =   { 0, 0, 0 }\\n\
575   bg[ACTIVE] =   { 0, 0, 0 }\\n\
576   bg[SELECTED] = { 0, 0, 0 }\\n\
577 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
578   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
579      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
580  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
581  sort | uniq | \
582  awk '{ printf ("style \\"%s\\"\\n{\\n\
583   fg[NORMAL] =   { 0, 0, 0 }\\n\
584   fg[ACTIVE] =   { 0, 0, 0 }\\n\
585 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
586 """
587 ))