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',
22 file = open('Makefile', 'wt')
24 # Generated by regenMakefile.py
26 BAKEFILE = bakefile -v
29 CDEPS = config.bkl common.bkl common_contrib.bkl
30 SDEPS = config.bkl common.bkl common_samples.bkl
31 MDEPS = common.bkl config.bkl files.bkl monolithic.bkl multilib.bkl opengl.bkl wxwin.py
33 DSWFLAGS = -DRUNTIME_LIBS=dynamic -DOFFICIAL_BUILD=0 -DUSE_HTML=1 \\
34 -DUSE_OPENGL=1 -DUSE_ODBC=1 -DMONOLITHIC=0 -DUSE_GUI=1 \\
35 -DDEBUG_INFO=default -DDEBUG_FLAG=default -DMSLU=0
37 COMPAT_TARGETS = ../../src/wxWindows.dsp
47 def addMakefile(bake
, makedirs
, deps
=[], args
={}):
48 """Adds rules to regenerate native makefile in directory 'makedir' from
49 bakefiles 'bake'. 'deps' contains additional dependencies (bakefiles
51 print 'adding %s...' % bake
55 def add(bake
, makedirs
, make
, dep
, format
, args
={}):
58 if 'all' in args
: a
+= ' %s' % args
['all']
59 if format
in args
: a
+= ' %s' % args
[format
]
60 if format
!= 'autoconf' and 'not_autoconf' in args
:
61 a
+= ' %s' % args
['not_autoconf']
62 if format
in makedirs
:
63 makedir
= makedirs
[format
]
65 makedir
= makedirs
['all']
66 tfile
= '%s/%s' % (makedir
, make
)
68 if tfile
in DONT_GENERATE
: return
70 linesCur
.append('%s: %s' % (tfile
, dep
))
71 linesCur
.append('\t$(BAKEFILE) -f%s -o$@ %s %s' % (format
, a
, bake
))
72 linesCur
.append('\ttouch $@')
73 if format
not in all
: all
[format
] = []
74 all
[format
].append(tfile
)
76 dep
= string
.join(deps
+ [bake
], ' ')
78 add(bake
, makedirs
, 'Makefile.in', dep
, 'autoconf', args
)
79 add(bake
, makedirs
, 'makefile.bcc', dep
, 'borland', args
)
80 add(bake
, makedirs
, 'makefile.vc', dep
, 'msvc', args
)
81 add(bake
, makedirs
, 'makefile.gcc', dep
, 'mingw', args
)
82 add(bake
, makedirs
, 'makefile.wat', dep
, 'watcom', args
)
84 (bake
[1+bake
.rfind('/'):]).replace('.bkl','.dsw'),
85 dep
, 'msvc6prj', args
)
87 lines
[bake
] = linesCur
91 # -----------------------------------------------
93 # -----------------------------------------------
96 addMakefile('wx.bkl', {'all':'../msw','autoconf':'../..'}
, [ '$(MDEPS)' ],
98 'borland':'-DOPTIONS_FILE=config.bcc',
99 'msvc':'-DOPTIONS_FILE=config.vc',
100 'mingw':'-DOPTIONS_FILE=config.gcc',
101 'watcom':'-DOPTIONS_FILE=config.wat',
102 'msvc6prj':'$(DSWFLAGS)',
105 # samples main makefile:
106 addMakefile('../../samples/samples.bkl', {'all':'../../samples'}
,
108 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
109 'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
110 'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
111 'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
112 'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
114 addMakefile('../../demos/demos.bkl', {'all':'../../demos'}
,
116 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
117 'borland':'-DOPTIONS_FILE=../build/msw/config.bcc -DWRITE_OPTIONS_FILE=0',
118 'msvc':'-DOPTIONS_FILE=../build/msw/config.vc -DWRITE_OPTIONS_FILE=0',
119 'mingw':'-DOPTIONS_FILE=../build/msw/config.gcc -DWRITE_OPTIONS_FILE=0',
120 'watcom':'-DOPTIONS_FILE=../build/msw/config.wat -DWRITE_OPTIONS_FILE=0',
127 def onSubmakefile(type, dirname
, names
):
128 bakes
= [x
for x
in names
if x
.endswith('.bkl')]
129 if len(bakes
) == 0: return
131 dirname
= dirname
.replace(os
.sep
, '/')
132 depth
= dirname
.count('/') - 2
133 if depth
<= 0: return
135 if type==SAMPLES_DIR
:
136 prefix
= ''.join(['../' for i
in range(0,depth
)])
137 topdirflags
= '-DWXTOPDIR=%s../' % prefix
139 cfgbase
= '%s../build/msw/config.' % prefix
140 elif type==CONTRIB_DIR
:
141 srcdirflags
= '-DSRCDIR=../../src/%s' % dirname
.split('/')[-1]
142 topdirflags
= ' -DWXTOPDIR=../../../'
143 cfgbase
= '../../../build/msw/config.'
147 'not_autoconf':srcdirflags
,
148 'autoconf':'-DAUTOCONF_MACROS_FILE=../../autoconf_inc.m4',
149 'msvc':'-DOPTIONS_FILE='+cfgbase
+'vc -DWRITE_OPTIONS_FILE=0',
150 'mingw':'-DOPTIONS_FILE='+cfgbase
+'gcc -DWRITE_OPTIONS_FILE=0',
151 'borland':'-DOPTIONS_FILE='+cfgbase
+'bcc -DWRITE_OPTIONS_FILE=0',
152 'watcom':'-DOPTIONS_FILE='+cfgbase
+'wat -DWRITE_OPTIONS_FILE=0',
153 'msvc6prj':'$(DSWFLAGS)',
157 if type==CONTRIB_DIR
:
158 acdir
= '../../contrib/src/%s' % dirname
.split('/')[-1]
163 addMakefile('%s/%s' % (dirname
, bake
),
164 {'all':dirname,'autoconf':acdir}
, deps
=[ruledep
],
167 os
.path
.walk(os
.path
.join('..','..','samples'),
168 onSubmakefile
, SAMPLES_DIR
)
169 os
.path
.walk(os
.path
.join('..','..','demos'),
170 onSubmakefile
, SAMPLES_DIR
)
171 os
.path
.walk(os
.path
.join('..','..','utils'),
172 onSubmakefile
, SAMPLES_DIR
)
173 os
.path
.walk(os
.path
.join('..','..','contrib','build'),
174 onSubmakefile
, CONTRIB_DIR
)
175 os
.path
.walk(os
.path
.join('..','..','contrib','samples'),
176 onSubmakefile
, SAMPLES_DIR
)
177 os
.path
.walk(os
.path
.join('..','..','contrib','utils'),
178 onSubmakefile
, SAMPLES_DIR
)
191 cleanList
.append('\trm -f %s\n' % i
)
192 cleanCmds
= ''.join(cleanList
)
195 var
= '%s_ALL' % f
.upper()
196 file.write('%s = \\\n\t%s\n' % (var
,' \\\n\t'.join(all
[f
])))
198 file.write('\nall: $(COMPAT_TARGETS)')
200 file.write(' %s' % f
)
203 file.write('%s: $(%s_ALL)\n' % (f
, f
.upper()))
207 \trm -f ../../autoconf_inc.m4
208 \trm -f $(COMPAT_TARGETS)
211 library: ../../Makefile.in\\
212 ../msw/makefile.bcc\\
214 ../msw/makefile.wat\\
215 ../msw/makefile.gcc\\
217 ../../src/wxWindows.dsp
219 ../../autoconf_inc.m4: ../../Makefile.in
221 ../../src/wxWindows.dsp: monolithic.bkl files.bkl
222 \t$(BAKEFILE) -Icompat -fwx24dsp -DUSE_GUI=1 -DWXUNIV=0 -o$@ wx.bkl
225 Makefile: regenMakefile.py
228 \t@echo -------------------------------------------
229 \t@echo Please rerun make, Makefile was regenerated
230 \t@echo -------------------------------------------
234 linesK
= lines
.keys()
238 file.write('%s\n' % l
)