targets = env['BUILD_TARGETS']
build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets or 'all' in targets)
-
-
-if env['INCLUDED_BOOST'] or 'boost' in targets:
+build_boost = env['INCLUDED_BOOST'] or 'boost' in targets
+build_intl = env['INCLUDED_GETTEXT'] or 'intl' in targets
+build_supports = build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]
+build_mathed = build_lyx or 'mathed' in targets
+build_insets = build_lyx or 'insets' in targets
+build_frontends = build_lyx or 'frontends' in targets
+build_graphics = build_lyx or 'graphics' in targets
+build_controllers = build_lyx or 'controllers' in targets
+build_client = 'client' in targets or 'install' in targets or 'all' in targets
+build_tex2lyx = 'tex2lyx' in targets or 'install' in targets or 'all' in targets
+build_lyxbase = build_lyx or 'lyxbase' in targets
+build_po = 'po' in targets or 'install' in targets or 'all' in targets
+build_qt3 = (build_lyx and env['frontend'] == 'qt3') or 'qt3' in targets
+build_qt4 = (build_lyx and env['frontend'] == 'qt4') or 'qt4' in targets
+
+
+# now, if rebuild_targets is specified, do not rebuild some targets
+rebuild_targets = env['REBUILD_TARGETS']
+if rebuild_targets:
+ def ifBuildLib(name, libname, old_value):
+ # explicitly asked to rebuild
+ if name in rebuild_targets:
+ return True
+ # else if not rebuild, and if the library already exists
+ elif os.path.isfile(File(env.subst('$LOCALLIBPATH/${LIBPREFIX}%s$LIBSUFFIX'%libname)).abspath):
+ return False
+ # do not change the original value
+ else:
+ return old_value
+ build_boost = ifBuildLib('boost', 'included_boost_filesystem', build_boost)
+ build_intl = ifBuildLib('intl', 'included_intl', build_intl)
+ build_supports = ifBuildLib('supports', 'supports', build_supports)
+ build_mathed = ifBuildLib('mathed', 'mathed', build_mathed)
+ build_insets = ifBuildLib('insets', 'insets', build_insets)
+ build_frontends = ifBuildLib('frontends', 'frontends', build_frontends)
+ build_graphics = ifBuildLib('graphics', 'graphics', build_graphics)
+ build_controllers = ifBuildLib('controllers', 'controllers', build_controllers)
+ build_lyxbase = ifBuildLib('lyxbase', 'lyxbase_pre', build_lyxbase)
+ build_qt3 = ifBuildLib('qt3', 'qt3', build_qt3)
+ build_qt4 = ifBuildLib('qt4', 'qt4', build_qt4)
+
+# sync frontend and env['frontend'] (maybe build qt4 with frontend=qt3)
+if build_qt3:
+ frontend = 'qt3'
+ env['frontend'] = 'qt4'
+elif build_qt4:
+ frontend = 'qt4'
+ env['frontend'] = 'qt4'
+
+
+if build_boost:
#
# boost libraries
#
Alias('boost', iostreams)
-if env['INCLUDED_GETTEXT'] or 'intl' in targets:
+if build_intl:
#
# intl
#
env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
-if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]:
+if build_supports:
#
# src/support
#
Alias('supports', supports)
-if build_lyx or 'mathed' in targets:
+if build_mathed:
#
# src/mathed
#
Alias('mathed', mathed)
-if build_lyx or 'insets' in targets:
+if build_insets:
#
# src/insets
#
Alias('insets', insets)
-if build_lyx or 'frontends' in targets:
+if build_frontends:
#
# src/frontends
#
Alias('frontends', frontends)
-if build_lyx or 'graphics' in targets:
+if build_graphics:
#
# src/graphics
#
Alias('graphics', graphics)
-if build_lyx or 'controllers' in targets:
+if build_controllers:
#
# src/frontends/controllers
#
#
# src/frontend/qt3/4
#
-if build_lyx or env['frontend'] in targets:
- frontend = env['frontend']
+if build_qt3 or build_qt4:
env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0)
-else:
- # frontend is qt3, but specify target qt4, OK
- if 'qt3' in targets:
- frontned = 'qt3'
- elif 'qt4' in targets:
- frontend = 'qt4'
- else:
- frontend = None
-
-if frontend == 'qt3':
+if build_qt3:
print "Processing files in src/frontends/qt3..."
qt3env = env.Copy()
Alias('qt3', qt3)
-elif frontend == 'qt4':
+if build_qt4:
print "Processing files in src/frontends/qt4..."
qt4env = env.Copy()
Alias('qt4', qt4)
-if 'client' in targets or 'install' in targets or 'all' in targets:
+if build_client:
#
# src/client
#
Alias('client', client)
-if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
+if build_tex2lyx:
#
# tex2lyx
#
Alias('tex2lyx', tex2lyx)
-if build_lyx or 'lyxbase' in targets:
+if build_lyxbase:
#
# src/
#
Alias('lyxbase', lyxbase_post)
-if build_lyx or 'lyx' in targets:
+if build_lyx:
#
# Build lyx with given frontend
#
Alias('lyx', lyx)
-if 'po' in targets or 'install' in targets or 'all' in targets:
+if build_po:
#
# po/
#
PathOption('extra_inc_path1', 'Extra include path', None),
#
PathOption('extra_lib_path1', 'Extra library path', None),
+ # rebuild only specifed, comma separated targets
+ ('rebuild', 'rebuild only specifed, comma separated targets', None),
# can be set to a non-existing directory
('prefix', 'install architecture-independent files in PREFIX', None),
# will install to dest_dir if defined. Otherwise, prefix will be used.
env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
-if not env.has_key('nls') or env['nls']:
- env['ENABLE_NLS'] = True
+env['ENABLE_NLS'] = not env.has_key('nls') or env['nls']
if not fast_start:
if not env['ENABLE_NLS']:
#env.CacheDir('%s/Cache/%s' % (env['BUILDDIR'], frontend))
env['BUILD_TARGETS'] = BUILD_TARGETS
+if env.has_key('rebuild'):
+ env['REBUILD_TARGETS'] = env['rebuild'].split(',')
+else:
+ env['REBUILD_TARGETS'] = None
print "Building all targets recursively"