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