file.write("""
# Generated by regenMakefile.py
-BAKEFILE = bakefile
-BAKEARGS = -v
+BAKEFILE = bakefile -v
+CDEPS = config.bkl common.bkl common_contrib.bkl
+SDEPS = config.bkl common.bkl common_samples.bkl
+MDEPS = common.bkl config.bkl files.bkl monolithic.bkl multilib.bkl wxwin.py
""")
lines = []
other than 'bake'."""
print 'adding %s...' % bake
lines.append('')
- lines.append('# from %s' % bake)
def add(bake, makedirs, make, dep, format, args={}):
a = ''
if 'all' in args: a += ' %s' % args['all']
if format in args: a += ' %s' % args[format]
+ if format != 'autoconf' and 'not_autoconf' in args:
+ a += ' %s' % args['not_autoconf']
if format in makedirs:
makedir = makedirs[format]
else:
makedir = makedirs['all']
tfile = '%s/%s' % (makedir, make)
lines.append('%s: %s' % (tfile, dep))
- lines.append('\t$(BAKEFILE) $(BAKEARGS) -f%s -o%s%s %s' % \
- (format, tfile, a, bake))
- lines.append('\ttouch %s' % tfile)
+ lines.append('\t$(BAKEFILE) -f%s -o$@ %s %s' % (format, a, bake))
+ lines.append('\ttouch $@')
if format not in all: all[format] = []
all[format].append(tfile)
add(bake, makedirs, 'Makefile.in', dep, 'autoconf', args)
add(bake, makedirs, 'makefile.bcc', dep, 'borland', args)
add(bake, makedirs, 'makefile.vc', dep, 'msvc', args)
+ add(bake, makedirs, 'makefile.gcc', dep, 'mingw', args)
+ add(bake, makedirs, 'makefile.wat', dep, 'watcom', args)
# -----------------------------------------------
# main makefile:
-addMakefile('wx.bkl', {'all':'..','autoconf':'../..'},
- ['common.bkl', 'config.bkl', 'files.bkl', 'monolithic.bkl',
- 'multilib.bkl', 'wxwin.py'])
+addMakefile('wx.bkl', {'all':'..','autoconf':'../..'}, [ '$(MDEPS)' ])
# samples main makefile:
addMakefile('../../samples/samples.bkl', {'all':'../../samples'},
CONTRIB_DIR = 1
+SAMPLES_DIR = 2
def onSubmakefile(type, dirname, names):
bakes = [x for x in names if x.endswith('.bkl')]
if len(bakes) == 0: return
+ dirname = dirname.replace(os.sep, '/')
depth = dirname.count('/') - 2
if depth <= 0: return
- prefix = ''.join(['../' for i in range(0,depth)])
+
+ if type==SAMPLES_DIR:
+ prefix = ''.join(['../' for i in range(0,depth)])
+ dirflags = '-DWXTOPDIR=%s../' % prefix
+ elif type==CONTRIB_DIR:
+ dirflags = '-DSRCDIR=../../src/%s' % dirname.split('/')[-1]
+ dirflags += ' -DWXTOPDIR=../../../'
args = {
- 'all':'-DWXTOPDIR=%s../' % prefix,
+ 'not_autoconf':dirflags,
'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
}
for bake in bakes:
if type==CONTRIB_DIR:
acdir = '../../contrib/src/%s' % dirname.split('/')[-1]
- ruledep = 'common_contrib.bkl'
+ ruledep = '$(CDEPS)'
else:
acdir = dirname
- ruledep = 'common_samples.bkl'
+ ruledep = '$(SDEPS)'
addMakefile('%s/%s' % (dirname, bake),
- {'all':dirname,'autoconf':acdir},
- deps=['common.bkl',ruledep,'config.bkl'],
+ {'all':dirname,'autoconf':acdir}, deps=[ruledep],
args=args)
-os.path.walk('../../samples', onSubmakefile, None)
-os.path.walk('../../contrib/build', onSubmakefile, CONTRIB_DIR)
+os.path.walk(os.path.join('..','..','samples'),
+ onSubmakefile, SAMPLES_DIR)
+os.path.walk(os.path.join('..','..','contrib','build'),
+ onSubmakefile, CONTRIB_DIR)
cleanCmds = ''