switched to using bakefile_gen

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2003-08-28 20:23:28 +00:00
parent 7b5dfe6ce6
commit 2da409423d
4 changed files with 32 additions and 4485 deletions

File diff suppressed because it is too large Load Diff

26
build/bakefiles/README Normal file
View File

@@ -0,0 +1,26 @@
This directory contains Bakefile (see http://bakefile.sourceforge.net)
files needed to generate native makefiles for wxWindows library, contrib and
samples.
Use the bakefile_gen utility to regenerate the makefiles. If you run it with
no arguments, it will generate all makefiles that are not up to date.
Use "bakefile_gen -c" to clean generated files.
You can generate or clean only subset of files by specifying -f or -b flags
when invoking bakefile_gen. For example, "bakefile_gen -fborland,watcom" will
only regenerate Borland C++ and OpenWatcom makefiles. -b flag limits
regeneration only to specified bakefiles. For example,
"bakefile_gen -b wx.bkl" will only regenerate main library makefiles.
"bakefile_gen -b '../../samples/html/*/*.bkl' will regenerate makefiles for
all wxHTML samples. -b and -f can be combined.
You can customize the process of generating makefiles by adding file
Bakefiles.local.bkgen (same format as Bakefiles.bkgen) with further settings.
For example, you may disable output for compilers you don't use:
<del-formats>msvc,msvc6prj</del-formats>
Note: bakefile_gen creates file .bakefile_gen.state with dependencies
information. This file can be safely deleted, but it contains valuable
information that speed up regeneration process.

View File

@@ -1,248 +0,0 @@
#!/usr/bin/env python
#
# Generates Makefile that is used to regenerate native makefiles from
# bakefiles.
#
# $Id$
#
import string, os.path, copy
# list of files that should _not_ be generated even thought we could do it:
DONT_GENERATE = [
'../../samples/Makefile.in',
'../../samples/samples.dsw',
'../../demos/demos.dsw',
'../../samples/html/html_samples.dsw',
'../../samples/opengl/opengl_samples.dsw',
'../../samples/mobile/mobile_samples.dsw',
'../../utils/utils.dsw',
]
file = open('Makefile', 'wt')
file.write("""
# Generated by regenMakefile.py
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 opengl.bkl wxwin.py
DSWFLAGS = -DRUNTIME_LIBS=dynamic -DOFFICIAL_BUILD=0 -DUSE_HTML=1 \\
-DUSE_OPENGL=1 -DUSE_ODBC=1 -DMONOLITHIC=0 -DUSE_GUI=1 \\
-DDEBUG_INFO=default -DDEBUG_FLAG=default -DMSLU=0
COMPAT_TARGETS = ../../src/wxWindows.dsp
""")
lines = {}
all = {}
all['autoconf'] = []
linesCur = None
def addMakefile(bake, makedirs, deps=[], args={}):
"""Adds rules to regenerate native makefile in directory 'makedir' from
bakefiles 'bake'. 'deps' contains additional dependencies (bakefiles
other than 'bake'."""
print 'adding %s...' % bake
global linesCur
linesCur = ['\n']
def add(bake, makedirs, make, dep, format, args={}):
global linesCur
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)
if tfile in DONT_GENERATE: return
linesCur.append('%s: %s' % (tfile, dep))
linesCur.append('\t$(BAKEFILE) -f%s -o$@ %s %s' % (format, a, bake))
linesCur.append('\ttouch $@')
if format not in all: all[format] = []
all[format].append(tfile)
dep = string.join(deps + [bake], ' ')
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)
add(bake, makedirs,
(bake[1+bake.rfind('/'):]).replace('.bkl','.dsw'),
dep, 'msvc6prj', args)
lines[bake] = linesCur
# -----------------------------------------------
# Add the makefiles:
# -----------------------------------------------
# main makefile:
addMakefile('wx.bkl', {'all':'../msw','autoconf':'../..'}, [ '$(MDEPS)' ],
args={
'borland':'-DOPTIONS_FILE=config.bcc',
'msvc':'-DOPTIONS_FILE=config.vc',
'mingw':'-DOPTIONS_FILE=config.gcc',
'watcom':'-DOPTIONS_FILE=config.wat',
'msvc6prj':'$(DSWFLAGS)',
})
# samples main makefile:
addMakefile('../../samples/samples.bkl', {'all':'../../samples'},
args={
'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
})
addMakefile('../../demos/demos.bkl', {'all':'../../demos'},
args={
'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
})
addMakefile('../../utils/utils.bkl', {'all':'../../utils'},
args={
'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
})
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
bakes.sort()
dirname = dirname.replace(os.sep, '/')
depth = dirname.count('/') - 2
if depth <= 0: return
if type==SAMPLES_DIR:
prefix = ''.join(['../' for i in range(0,depth)])
topdirflags = '-DWXTOPDIR=%s../' % prefix
srcdirflags = ''
cfgbase = '%s../build/msw/config.' % prefix
elif type==CONTRIB_DIR:
srcdirflags = '-DSRCDIR=../../src/%s' % dirname.split('/')[-1]
topdirflags = ' -DWXTOPDIR=../../../'
cfgbase = '../../../build/msw/config.'
args = {
'all':topdirflags,
'not_autoconf':srcdirflags,
'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
'msvc':'-DOPTIONS_FILE='+cfgbase+'vc -DWRITE_OPTIONS_FILE=0',
'mingw':'-DOPTIONS_FILE='+cfgbase+'gcc -DWRITE_OPTIONS_FILE=0',
'borland':'-DOPTIONS_FILE='+cfgbase+'bcc -DWRITE_OPTIONS_FILE=0',
'watcom':'-DOPTIONS_FILE='+cfgbase+'wat -DWRITE_OPTIONS_FILE=0',
'msvc6prj':'$(DSWFLAGS)',
}
for bake in bakes:
if type==CONTRIB_DIR:
acdir = '../../contrib/src/%s' % dirname.split('/')[-1]
ruledep = '$(CDEPS)'
else:
acdir = dirname
ruledep = '$(SDEPS)'
addMakefile('%s/%s' % (dirname, bake),
{'all':dirname,'autoconf':acdir}, deps=[ruledep],
args=args)
os.path.walk(os.path.join('..','..','samples'),
onSubmakefile, SAMPLES_DIR)
os.path.walk(os.path.join('..','..','demos'),
onSubmakefile, SAMPLES_DIR)
os.path.walk(os.path.join('..','..','utils'),
onSubmakefile, SAMPLES_DIR)
os.path.walk(os.path.join('..','..','contrib','build'),
onSubmakefile, CONTRIB_DIR)
os.path.walk(os.path.join('..','..','contrib','samples'),
onSubmakefile, SAMPLES_DIR)
os.path.walk(os.path.join('..','..','contrib','utils'),
onSubmakefile, SAMPLES_DIR)
cleanCmds = ''
allK = all.keys()
allK.sort()
cleanList = []
for f in allK:
all[f].sort()
for f in allK:
for i in all[f]:
cleanList.append('\trm -f %s\n' % i)
cleanCmds = ''.join(cleanList)
for f in allK:
var = '%s_ALL' % f.upper()
file.write('%s = \\\n\t%s\n' % (var,' \\\n\t'.join(all[f])))
file.write('\nall: $(COMPAT_TARGETS)')
for f in allK:
file.write(' %s' % f)
file.write('\n\n')
for f in allK:
file.write('%s: $(%s_ALL)\n' % (f, f.upper()))
file.write("""
clean:
\trm -f ../../autoconf_inc.m4
\trm -f $(COMPAT_TARGETS)
%s
library: ../../Makefile.in\\
../msw/makefile.bcc\\
../msw/makefile.vc\\
../msw/makefile.wat\\
../msw/makefile.gcc\\
../msw/wx.dsw\\
../../src/wxWindows.dsp
../../autoconf_inc.m4: ../../Makefile.in
../../src/wxWindows.dsp: monolithic.bkl files.bkl
\t$(BAKEFILE) -Icompat -fwx24dsp -DUSE_GUI=1 -DWXUNIV=0 -o$@ wx.bkl
\ttouch $@
Makefile: regenMakefile.py
\t./regenMakefile.py
\t@echo
\t@echo -------------------------------------------
\t@echo Please rerun make, Makefile was regenerated
\t@echo -------------------------------------------
\t@echo
\t@exit 1
""" % cleanCmds)
linesK = lines.keys()
linesK.sort()
for lk in linesK:
for l in lines[lk]:
file.write('%s\n' % l)
file.close()