4 # Generates Makefile that is used to regenerate native makefiles from
10 import string
, os
.path
, copy
12 # list of files that should _not_ be generated even thought we could do it:
14 '../../samples/Makefile.in',
15 '../../samples/samples.dsw',
16 '../../demos/demos.dsw',
17 '../../samples/html/html_samples.dsw',
18 '../../samples/opengl/opengl_samples.dsw',
19 '../../samples/mobile/mobile_samples.dsw',
20 '../../utils/utils.dsw',
23 file = open('Makefile', 'wt')
25 # Generated by regenMakefile.py
27 BAKEFILE = bakefile -v
30 CDEPS = config.bkl common.bkl common_contrib.bkl
31 SDEPS = config.bkl common.bkl common_samples.bkl
32 MDEPS = common.bkl config.bkl files.bkl monolithic.bkl multilib.bkl opengl.bkl wxwin.py
34 DSWFLAGS = -DRUNTIME_LIBS=dynamic -DOFFICIAL_BUILD=0 -DUSE_HTML=1 \\
35 -DUSE_OPENGL=1 -DUSE_ODBC=1 -DMONOLITHIC=0 -DUSE_GUI=1 \\
36 -DDEBUG_INFO=default -DDEBUG_FLAG=default -DMSLU=0
38 COMPAT_TARGETS = ../../src/wxWindows.dsp
48 def addMakefile(bake
, makedirs
, deps
=[], args
={}):
49 """Adds rules to regenerate native makefile in directory 'makedir' from
50 bakefiles 'bake'. 'deps' contains additional dependencies (bakefiles
52 print 'adding %s...' % bake
56 def add(bake
, makedirs
, make
, dep
, format
, args
={}):
59 if 'all' in args
: a
+= ' %s' % args
['all']
60 if format
in args
: a
+= ' %s' % args
[format
]
61 if format
!= 'autoconf' and 'not_autoconf' in args
:
62 a
+= ' %s' % args
['not_autoconf']
63 if format
in makedirs
:
64 makedir
= makedirs
[format
]
66 makedir
= makedirs
['all']
67 tfile
= '%s/%s' % (makedir
, make
)
69 if tfile
in DONT_GENERATE
: return
71 linesCur
.append('%s: %s' % (tfile
, dep
))
72 linesCur
.append('\t$(BAKEFILE) -f%s -o$@ %s %s' % (format
, a
, bake
))
73 linesCur
.append('\ttouch $@')
74 if format
not in all
: all
[format
] = []
75 all
[format
].append(tfile
)
77 dep
= string
.join(deps
+ [bake
], ' ')
79 add(bake
, makedirs
, 'Makefile.in', dep
, 'autoconf', args
)
80 add(bake
, makedirs
, 'makefile.bcc', dep
, 'borland', args
)
81 add(bake
, makedirs
, 'makefile.vc', dep
, 'msvc', args
)
82 add(bake
, makedirs
, 'makefile.gcc', dep
, 'mingw', args
)
83 add(bake
, makedirs
, 'makefile.wat', dep
, 'watcom', args
)
85 (bake
[1+bake
.rfind('/'):]).replace('.bkl','.dsw'),
86 dep
, 'msvc6prj', args
)
88 lines
[bake
] = linesCur
92 # -----------------------------------------------
94 # -----------------------------------------------
97 addMakefile('wx.bkl', {'all':'../msw','autoconf':'../..'}
, [ '$(MDEPS)' ],
99 'borland':'-DOPTIONS_FILE=config.bcc',
100 'msvc':'-DOPTIONS_FILE=config.vc',
101 'mingw':'-DOPTIONS_FILE=config.gcc',
102 'watcom':'-DOPTIONS_FILE=config.wat',
103 'msvc6prj':'$(DSWFLAGS)',
106 # samples main makefile:
107 addMakefile('../../samples/samples.bkl', {'all':'../../samples'}
,
109 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
110 'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
111 'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
112 'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
113 'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
115 addMakefile('../../demos/demos.bkl', {'all':'../../demos'}
,
117 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
118 'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
119 'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
120 'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
121 'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
123 addMakefile('../../utils/utils.bkl', {'all':'../../utils'}
,
125 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
126 'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
127 'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
128 'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
129 'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
136 def onSubmakefile(type, dirname
, names
):
137 bakes
= [x
for x
in names
if x
.endswith('.bkl')]
138 if len(bakes
) == 0: return
140 dirname
= dirname
.replace(os
.sep
, '/')
141 depth
= dirname
.count('/') - 2
142 if depth
<= 0: return
144 if type==SAMPLES_DIR
:
145 prefix
= ''.join(['../' for i
in range(0,depth
)])
146 topdirflags
= '-DWXTOPDIR=%s../' % prefix
148 cfgbase
= '%s../build/msw/config.' % prefix
149 elif type==CONTRIB_DIR
:
150 srcdirflags
= '-DSRCDIR=../../src/%s' % dirname
.split('/')[-1]
151 topdirflags
= ' -DWXTOPDIR=../../../'
152 cfgbase
= '../../../build/msw/config.'
156 'not_autoconf':srcdirflags
,
157 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
158 'msvc':'-DOPTIONS_FILE='+cfgbase
+'vc -DWRITE_OPTIONS_FILE=0',
159 'mingw':'-DOPTIONS_FILE='+cfgbase
+'gcc -DWRITE_OPTIONS_FILE=0',
160 'borland':'-DOPTIONS_FILE='+cfgbase
+'bcc -DWRITE_OPTIONS_FILE=0',
161 'watcom':'-DOPTIONS_FILE='+cfgbase
+'wat -DWRITE_OPTIONS_FILE=0',
162 'msvc6prj':'$(DSWFLAGS)',
166 if type==CONTRIB_DIR
:
167 acdir
= '../../contrib/src/%s' % dirname
.split('/')[-1]
172 addMakefile('%s/%s' % (dirname
, bake
),
173 {'all':dirname,'autoconf':acdir}
, deps
=[ruledep
],
176 os
.path
.walk(os
.path
.join('..','..','samples'),
177 onSubmakefile
, SAMPLES_DIR
)
178 os
.path
.walk(os
.path
.join('..','..','demos'),
179 onSubmakefile
, SAMPLES_DIR
)
180 os
.path
.walk(os
.path
.join('..','..','utils'),
181 onSubmakefile
, SAMPLES_DIR
)
182 os
.path
.walk(os
.path
.join('..','..','contrib','build'),
183 onSubmakefile
, CONTRIB_DIR
)
184 os
.path
.walk(os
.path
.join('..','..','contrib','samples'),
185 onSubmakefile
, SAMPLES_DIR
)
186 os
.path
.walk(os
.path
.join('..','..','contrib','utils'),
187 onSubmakefile
, SAMPLES_DIR
)
200 cleanList
.append('\trm -f %s\n' % i
)
201 cleanCmds
= ''.join(cleanList
)
204 var
= '%s_ALL' % f
.upper()
205 file.write('%s = \\\n\t%s\n' % (var
,' \\\n\t'.join(all
[f
])))
207 file.write('\nall: $(COMPAT_TARGETS)')
209 file.write(' %s' % f
)
212 file.write('%s: $(%s_ALL)\n' % (f
, f
.upper()))
216 \trm -f ../../autoconf_inc.m4
217 \trm -f $(COMPAT_TARGETS)
220 library: ../../Makefile.in\\
221 ../msw/makefile.bcc\\
223 ../msw/makefile.wat\\
224 ../msw/makefile.gcc\\
226 ../../src/wxWindows.dsp
228 ../../autoconf_inc.m4: ../../Makefile.in
230 ../../src/wxWindows.dsp: monolithic.bkl files.bkl
231 \t$(BAKEFILE) -Icompat -fwx24dsp -DUSE_GUI=1 -DWXUNIV=0 -o$@ wx.bkl
234 Makefile: regenMakefile.py
237 \t@echo -------------------------------------------
238 \t@echo Please rerun make, Makefile was regenerated
239 \t@echo -------------------------------------------
243 linesK
= lines
.keys()
247 file.write('%s\n' % l
)