]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/distrib/build.py
Some cleanup
[wxWidgets.git] / utils / wxPython / distrib / build.py
1 #!/usr/bin/env python
2 #----------------------------------------------------------------------------
3 # Name: build.py
4 # Purpose: This script is used to build wxPython. It reads a build
5 # configuration file in the requested project directory and
6 # based on the contents of the file can build Makefiles for
7 # unix or win32, and can execute make with various options
8 # potentially automating the entire build/install/clean process
9 # from a single command.
10 #
11 # Author: Robin Dunn
12 #
13 # Created: 18-Aug-1999
14 # RCS-ID: $Id$
15 # Copyright: (c) 1999 by Total Control Software
16 # Licence: wxWindows license
17 #----------------------------------------------------------------------------
18 """
19 build.py
20
21 This script is used to build wxPython. It reads a build configuration
22 file in the requested project directory and based on the contents of
23 the file can build Makefiles for unix or win32, and can execute make
24 with various options potentially automating the entire
25 build/install/clean process from a single command.
26
27 The default action is to build the Makefile and exit.
28
29 Options
30 -C dir CD to dir before doing anything
31 -B file Use file as the build configuration (default ./build.cfg)
32 -M file Use file as the name of the makefile to create
33 (default Makefile)
34
35 -b Build the module (runs make)
36 -i Install the module (runs make install)
37 -c Cleanup (runs make clean)
38 -u Uninstall (runs make uninstall)
39
40 -h Show help and exit
41
42
43 Configuration Files
44
45 The build configuration file lists targets, source files and options
46 for the the build process. The contents of the build.cfg are used to
47 dynamically generate the Makefile.
48
49 To prevent you from getting screwed when the default build.cfg is
50 updated, you can override the values in build.cfg by putting your
51 custom definitions in a file named build.local. You can also place a
52 build.local file in the parent directory, or even in the grandparent
53 directory for project-wide overrides. Finally, command-line arguments
54 of the form NAME=VALUE can also be used to override simple configuration
55 values. The order of evaluation is:
56
57 0. comman-line flags (-M, -b, etc.)
58 1. ./build.cfg
59 2. ../../build.local (if present)
60 3. ../build.local (if present)
61 4. ./build.local (if present)
62 5. command-line NAME=VALUEs
63
64 The config files are actually just Python files that get exec'ed in a
65 separate namespace which is then used later as a configuration object.
66 This keeps the build script simple in that it doesn't have to parse
67 anything, and the config files can be much more than just names and
68 values as any pretty much any python code can be executed. The global
69 variables set in the config namespace are what are used later as
70 configuation values.
71
72
73 Configuration Options
74
75 The following variables can be set in the config files. Only a few are
76 required, the rest will either have suitable defaults or will be
77 calculated from your current Python runtime environment.
78
79 MODULE The name of the extension module to produce
80 SWIGFILES A list of files that should be run through SWIG
81 SWIGFLAGS Flags for SWIG
82 SOURCES Other C/C++ sources that should be part of the module
83 PYFILES Other Python files that should be installed with the module
84 CFLAGS Flags to be used by the compiler
85 LFLAGS Flags to be used at the link step
86 LIBS Libraries to be linked with
87
88 OTHERCFLAGS Extra flags to append to CFLAGS
89 OTHERLFLAGS Extra flags to append to LFLAGS
90 OTHERSWIGFLAGS Extra flags to append to SWIGFLAGS
91 OTHERLIBS Other libraries to be linked with, in addition to LIBS
92 OTHERTARGETS Other targets to be placed on the default rule line
93 OTHERINSTALLTARGETS
94 Other targets to be placed on the install rule line
95 OTHERRULES This text is placed at the end of the makefile and
96 will typically be used for adding rules and such
97 DEFAULTRULE Text to be used for the default rule in the makefile
98
99 TARGETDIR Destination for the install step
100
101 MAKE The make program to use
102 MAKEFILE The name of the makefile
103
104 runBuild Setting this to 1 is eqivalent to the -b flag
105 runInstall Setting this to 1 is eqivalent to the -i flag
106 runClean Setting this to 1 is eqivalent to the -c flag
107 runUninstall Setting this to 1 is eqivalent to the -u flag
108
109 PYVERSION Version number of Python used in pathnames
110 PYPREFIX The root of the Python install
111 EXECPREFIX The root of the Python install for binary files
112 PYTHONLIB The Python link library
113
114 """
115
116 import sys, os, string, getopt
117
118 #----------------------------------------------------------------------------
119 # This is really the wxPython version number, and will be placed in the
120 # Makefiles for use with the distribution related targets.
121
122 __version__ = '2.1b3'
123
124 #----------------------------------------------------------------------------
125
126 def main(args):
127 try:
128 opts, args = getopt.getopt(args[1:], 'C:B:M:bicu')
129 except getopt.error:
130 usage()
131 sys.exit(1)
132
133 if not os.environ.has_key('WXWIN'):
134 print "WARNING: WXWIN is not set in the environment. WXDIR may not\n"\
135 " be set properly in the makefile, you will have to \n"\
136 " set the environment variable or override in build.local."
137
138 bldCfg = 'build.cfg'
139 bldCfgLocal = 'build.local'
140 MAKEFILE = 'Makefile'
141 runBuild = 0
142 runInstall = 0
143 runClean = 0
144 runUninstall = 0
145
146 for flag, value in opts:
147 if flag == '-C': os.chdir(value)
148 elif flag == '-B': bldCfgFile = value
149 elif flag == '-M': makefile = value
150 elif flag == '-b': runBuild = 1
151 elif flag == '-c': runClean = 1
152 elif flag == '-i': runInstall = 1
153 elif flag == '-u': runUninstall = 1
154
155 elif flag == '-h': usage(); sys.exit(1)
156 else: usage(); sys.exit(1)
157
158 config = BuildConfig(bldCfg = bldCfg,
159 bldCfgLocal = bldCfgLocal,
160 MAKEFILE = MAKEFILE,
161 runBuild = runBuild,
162 runInstall = runInstall,
163 runClean = runClean,
164 runUninstall = runUninstall)
165
166 if config.readConfigFiles(args):
167 config.makeMakefile()
168 err = 0
169
170 if config.runBuild:
171 cmd = "%s -f %s" % (config.MAKE, config.MAKEFILE)
172 print "Running:", cmd
173 err = os.system(cmd)
174
175 if not err and config.runInstall:
176 cmd = "%s -f %s install" % (config.MAKE, config.MAKEFILE)
177 print "Running:", cmd
178 err = os.system(cmd)
179
180
181 if not err and config.runClean:
182 cmd = "%s -f %s clean" % (config.MAKE, config.MAKEFILE)
183 print "Running:", cmd
184 err = os.system(cmd)
185
186 if not err and config.runUninstall:
187 cmd = "%s -f %s uninstall" % (config.MAKE, config.MAKEFILE)
188 print "Running:", cmd
189 err = os.system(cmd)
190
191
192
193 #----------------------------------------------------------------------------
194
195 def usage():
196 print __doc__
197
198 #----------------------------------------------------------------------------
199
200 def swapslash(st):
201 if sys.platform != 'win32':
202 st = string.join(string.split(st, '\\'), '/')
203 return st
204
205 #----------------------------------------------------------------------------
206
207 def splitlines(st):
208 return string.join(string.split(string.strip(st), ' '), ' \\\n\t')
209
210 #----------------------------------------------------------------------------
211
212 class BuildConfig:
213 def __init__(self, **kw):
214 self.__dict__.update(kw)
215 self.setDefaults()
216
217 #------------------------------------------------------------
218 def setDefaults(self):
219 self.VERSION = __version__
220 self.MODULE = ''
221 self.SWIGFILES = []
222 self.SWIGFLAGS = '-c++ -shadow -python -dnone -I$(WXPSRCDIR)'
223 self.SOURCES = []
224 self.PYFILES = []
225 self.LFLAGS = ''
226 self.OTHERCFLAGS = ''
227 self.OTHERLFLAGS = ''
228 self.OTHERSWIGFLAGS = ''
229 self.OTHERLIBS = ''
230 self.OTHERTARGETS = ''
231 self.OTHERINSTALLTARGETS = ''
232 self.OTHERRULES = ''
233 self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)'
234 self.PYVERSION = sys.version[:3]
235 self.PYPREFIX = sys.prefix
236 self.EXECPREFIX = sys.exec_prefix
237 self.WXDIR = '$(WXWIN)'
238 self.FINAL = '0'
239 self.WXP_USE_THREAD = '1'
240 self.WXUSINGDLL = '1'
241 self.OTHERDEP = ''
242 self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src'
243
244
245 if sys.platform == 'win32':
246 self.MAKE = 'nmake'
247 self.PYTHONLIB = '$(PYPREFIX)\\libs\\python15.lib'
248 self.TARGETDIR = '$(PYPREFIX)\\wxPython'
249 self.LIBS = '$(PYTHONLIB) $(WXPSRCDIR)\wxc.lib'
250 self.GENCODEDIR = 'msw'
251 self.SWIGTOOLKITFLAG = '-D__WXMSW__'
252 self.OBJEXT = '.obj'
253 self.TARGET = '$(MODULE).pyd'
254 self.CFLAGS = '-I$(PYPREFIX)\include -I$(WXPSRCDIR) -I. /Fp$(MODULE).pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) '
255 self.LFLAGS = '$(DEBUGLFLAGS) /DLL /subsystem:windows,3.50 /machine:I386 /nologo'
256 self.RESFILE = ''
257 self.RESRULE = ''
258 self.OVERRIDEFLAGS = '/GX-'
259
260 else:
261 self.MAKE = 'make'
262 self.PYLIB = '$(EXECPREFIX)/lib/python$(PYVERSION)'
263 self.LIBPL = '$(PYLIB)/config'
264 self.PYTHONLIB = '$(LIBPL)/libpython$(PYVERSION).a'
265 self.TARGETDIR = '$(EXECPREFIX)/lib/python$(PYVERSION)/site-packages/wxPython'
266 self.TARGET = '$(MODULE)module$(SO)'
267 self.OBJEXT = '.o'
268 self.HELPERLIB = 'wxPyHelpers'
269 self.HELPERLIBDIR = '/usr/local/lib'
270 self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\
271 '`wx-config --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\
272 '-I$(WXPSRCDIR)'
273 self.LFLAGS = '-L$(WXPSRCDIR) `wx-config --libs`'
274 self.LIBS = '-l$(HELPERLIB)'
275
276 # **** what to do when I start supporting Motif, etc.???
277 self.GENCODEDIR = 'gtk'
278 self.SWIGTOOLKITFLAG = '-D__WXGTK__'
279
280 # Extract a few things from Python's Makefile...
281 try:
282 filename = os.path.join(self.EXECPREFIX,
283 'lib/python'+self.PYVERSION,
284 'config/Makefile')
285 mfText = string.split(open(filename, 'r').read(), '\n')
286 except IOError:
287 raise SystemExit, "Python development files not found"
288
289 self.CCC = self.findMFValue(mfText, 'CCC')
290 self.CC = self.findMFValue(mfText, 'CC')
291 self.OPT = self.findMFValue(mfText, 'OPT')
292 self.SO = self.findMFValue(mfText, 'SO')
293 self.LDSHARED = self.findMFValue(mfText, 'LDSHARED')
294 self.CCSHARED = self.findMFValue(mfText, 'CCSHARED')
295 #self.LINKFORSHARED = self.findMFValue(mfText, 'LINKFORSHARED')
296 #self. = self.findMFValue(mfText, '')
297 #self. = self.findMFValue(mfText, '')
298
299
300 # The majority of cases will require LDSHARED to be
301 # modified to use the C++ driver instead of the C driver
302 # for linking. We'll try to do it here and if we goof up
303 # then the user can correct it in their build.local file.
304 self.LDSHARED = string.join(['$(CCC)'] +
305 string.split(self.LDSHARED, ' ')[1:],
306 ' ')
307
308
309 #------------------------------------------------------------
310 def findMFValue(self, mfText, st):
311 # Find line begining with st= and return the value
312 # Regex would probably be to cooler way to do this, but
313 # I think this is the most understandable.
314 for line in mfText:
315 if string.find(line, st+'=') == 0:
316 st = string.strip(line[len(st)+1:])
317 return st
318 return None
319
320 #------------------------------------------------------------
321 def makeMakefile(self):
322
323 # make a list of object file names
324 objects = ""
325 for name in self.SWIGFILES:
326 objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' '
327 for name in self.SOURCES:
328 objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' '
329 self.OBJECTS = splitlines(objects)
330
331
332 # now build the text for the dependencies
333 depends = ""
334 for name in self.SWIGFILES:
335 text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i\n' \
336 '$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \
337 tuple([os.path.splitext(name)[0]] * 5)
338 depends = depends + text
339 for name in self.PYFILES:
340 text = '$(TARGETDIR)\\%s.py : %s.py\n' % \
341 tuple([os.path.splitext(name)[0]] * 2)
342 depends = depends + text
343 self.DEPENDS = swapslash(depends)
344
345
346 # and the list of .py files
347 pymodules = ""
348 for name in self.SWIGFILES:
349 pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
350 for name in self.PYFILES:
351 pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
352 self.PYMODULES = splitlines(swapslash(pymodules))
353
354
355
356 # finally, build the makefile
357 if sys.platform == 'win32':
358 if self.RESFILE:
359 self.RESFILE = '$(MODULE).res'
360 self.RESRULE = '$(MODULE).res : $(MODULE).rc $(WXDIR)\\include\\wx\\msw\\wx.rc\n\t'\
361 '$(rc) -r /i$(WXDIR)\\include -fo$@ $(MODULE).rc'
362 text = win32Template % self.__dict__
363 else:
364 text = unixTemplate % self.__dict__
365 f = open(self.MAKEFILE, 'w')
366 f.write(text)
367 f.close()
368
369 print "Makefile created: ", self.MAKEFILE
370
371
372 #------------------------------------------------------------
373 def readConfigFiles(self, args):
374 return self.processFile(self.bldCfg, 1) and \
375 self.processFile(os.path.join('../..', self.bldCfgLocal)) and \
376 self.processFile(os.path.join('..', self.bldCfgLocal)) and \
377 self.processFile(os.path.join('.', self.bldCfgLocal)) and \
378 self.processArgs(args)
379
380 #------------------------------------------------------------
381 def processFile(self, filename, required=0):
382 try:
383 text = open(filename, 'r').read()
384 except IOError:
385 if required:
386 print "Unable to open %s" % filename
387 return 0
388 else:
389 return 1
390
391 try:
392 exec(text, self.__dict__)
393 except:
394 print "Error evaluating %s" % filename
395 import traceback
396 traceback.print_exc()
397 return 0
398 return 1
399
400
401 #------------------------------------------------------------
402 def processArgs(self, args):
403 try:
404 for st in args:
405 pair = string.split(st, '=')
406 name = pair[0]
407 value = pair[1]
408 self.__dict__[name] = value
409 except:
410 print "Error parsing command-line: %s" % st
411 return 0
412
413 return 1
414
415
416 #------------------------------------------------------------
417
418
419
420
421
422 #----------------------------------------------------------------------------
423 #----------------------------------------------------------------------------
424
425 win32Template = '''
426 #----------------------------------------------------------------------
427 # This makefile was autogenerated from build.py. Your changes will be
428 # lost if the generator is run again. You have been warned.
429 #----------------------------------------------------------------------
430
431 WXDIR = %(WXDIR)s
432 VERSION = %(VERSION)s
433 MODULE = %(MODULE)s
434 SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
435 CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s
436 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
437 PYVERSION = %(PYVERSION)s
438 PYPREFIX = %(PYPREFIX)s
439 EXECPREFIX = %(EXECPREFIX)s
440 PYTHONLIB = %(PYTHONLIB)s
441 FINAL = %(FINAL)s
442 WXP_USE_THREAD = %(WXP_USE_THREAD)s
443 WXUSINGDLL = %(WXUSINGDLL)s
444 GENCODEDIR = %(GENCODEDIR)s
445 RESFILE = %(RESFILE)s
446 WXPSRCDIR = %(WXPSRCDIR)s
447
448
449 TARGETDIR = %(TARGETDIR)s
450
451 OBJECTS = %(OBJECTS)s
452 PYMODULES = %(PYMODULES)s
453 TARGET = %(TARGET)s
454
455
456
457
458 !if "$(FINAL)" == "0"
459 DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES
460 !else
461 DEBUGLFLAGS = /INCREMENTAL:NO
462 !endif
463 !if "$(WXP_USE_THREAD)" == "1"
464 THREAD=-DWXP_USE_THREAD=1
465 !endif
466
467
468
469
470 NOPCH=1
471 OVERRIDEFLAGS=%(OVERRIDEFLAGS)s %(OTHERCFLAGS)s
472 EXTRAFLAGS = %(CFLAGS)s
473
474 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
475 EXTRALIBS = %(LIBS)s %(OTHERLIBS)s
476
477 #----------------------------------------------------------------------
478
479 !include $(WXDIR)\\src\\makevc.env
480
481 #----------------------------------------------------------------------
482
483 %(DEFAULTRULE)s %(OTHERTARGETS)s
484
485
486
487 install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
488
489 clean:
490 -erase *.obj
491 -erase *.exe
492 -erase *.res
493 -erase *.map
494 -erase *.sbr
495 -erase *.pdb
496 -erase *.pch
497 -erase $(MODULE).exp
498 -erase $(MODULE).lib
499 -erase $(MODULE).ilk
500 -erase $(TARGET)
501
502
503 uninstall:
504 -erase $(TARGETDIR)\\$(TARGET)
505 -erase $(PYMODULES)
506
507 #----------------------------------------------------------------------
508 # implicit rule for compiling .cpp and .c files
509 {}.cpp{}.obj:
510 $(cc) @<<
511 $(CPPFLAGS) /c /Tp $<
512 <<
513
514 {$(GENCODEDIR)}.cpp{}.obj:
515 $(cc) @<<
516 $(CPPFLAGS) /c /Tp $<
517 <<
518
519 {}.c{}.obj:
520 $(cc) @<<
521 $(CPPFLAGS) /c $<
522 <<
523
524 .SUFFIXES : .i .py
525
526 # Implicit rules to run SWIG
527 {}.i{$(GENCODEDIR)}.cpp:
528 swig $(SWIGFLAGS) -c -o $@ $<
529
530 {}.i{$(GENCODEDIR)}.py:
531 swig $(SWIGFLAGS) -c -o $(GENCODEDIR)\\tmp_wrap.cpp $<
532 -erase $(GENCODEDIR)\\tmp_wrap.cpp
533
534
535 {$(GENCODEDIR)}.py{$(TARGETDIR)}.py:
536 copy $< $@
537
538 {}.py{$(TARGETDIR)}.py:
539 copy $< $@
540
541 #----------------------------------------------------------------------
542
543 $(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE)
544 $(link) @<<
545 /out:$@
546 $(LFLAGS) /def:$(MODULE).def /implib:./$(MODULE).lib
547 $(DUMMYOBJ) $(OBJECTS) $(RESFILE)
548 $(LIBS)
549 <<
550
551
552 %(RESRULE)s
553
554
555 $(TARGETDIR)\\$(TARGET) : $(TARGET)
556 copy $(TARGET) $@
557
558
559 pycfiles : $(PYMODULES)
560 $(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR)
561 $(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR)
562
563
564 $(TARGETDIR) :
565 mkdir $(TARGETDIR)
566
567 $(GENCODEDIR):
568 mkdir $(GENCODEDIR)
569
570 #----------------------------------------------------------------------
571
572 %(DEPENDS)s
573
574 #----------------------------------------------------------------------
575
576
577 %(OTHERRULES)s
578 '''
579
580 #----------------------------------------------------------------------------
581 #----------------------------------------------------------------------------
582 #----------------------------------------------------------------------------
583
584 unixTemplate = '''
585 #----------------------------------------------------------------------
586 # This makefile was autogenerated from build.py. Your changes will be
587 # lost if the generator is run again. You have been warned.
588 #----------------------------------------------------------------------
589
590
591
592 WXDIR = %(WXDIR)s
593 VERSION = %(VERSION)s
594 MODULE = %(MODULE)s
595 SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
596 CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s
597 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
598 LIBS = %(LIBS)s %(OTHERLIBS)s
599 PYVERSION = %(PYVERSION)s
600 PYPREFIX = %(PYPREFIX)s
601 EXECPREFIX = %(EXECPREFIX)s
602 PYINCLUDE = $(PYPREFIX)/include/python$(PYVERSION)
603 EXECINCLUDE = $(EXECPREFIX)/include/python$(PYVERSION)
604 PYLIB = %(PYLIB)s
605 LIBPL = %(LIBPL)s
606 PYTHONLIB = %(PYTHONLIB)s
607 FINAL = %(FINAL)s
608 WXP_USE_THREAD = %(WXP_USE_THREAD)s
609 GENCODEDIR = %(GENCODEDIR)s
610 WXPSRCDIR = %(WXPSRCDIR)s
611 HELPERLIB = %(HELPERLIB)s
612 HELPERLIBDIR = %(HELPERLIBDIR)s
613
614 TARGETDIR = %(TARGETDIR)s
615
616
617 CCC = %(CCC)s
618 CC = %(CC)s
619 OPT = %(OPT)s
620 SO = %(SO)s
621 LDSHARED = %(LDSHARED)s
622 CCSHARED = %(CCSHARED)s
623
624
625 OBJECTS = %(OBJECTS)s
626 PYMODULES = %(PYMODULES)s
627 TARGET = %(TARGET)s
628
629
630 ifeq ($(WXP_USE_THREAD), 1)
631 THREAD=-DWXP_USE_THREAD
632 endif
633
634 #----------------------------------------------------------------------
635
636 %(DEFAULTRULE)s %(OTHERTARGETS)s
637
638 install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
639
640 clean:
641 -rm -f *.o *.so *~
642 -rm -f $(TARGET)
643
644 uninstall:
645 -rm -f $(TARGETDIR)/$(TARGET)
646 -rm -f $(PYMODULES)
647
648
649 #----------------------------------------------------------------------
650
651 %%.o : %%.cpp
652 $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
653
654 %%.o : $(GENCODEDIR)/%%.cpp
655 $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
656
657 %%.o : %%.c
658 $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
659
660 %%.o : $(GENCODEDIR)/%%.c
661 $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
662
663 $(GENCODEDIR)/%%.cpp : %%.i
664 swig $(SWIGFLAGS) -c -o $@ $<
665
666 $(GENCODEDIR)/%%.py : %%.i
667 swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
668 rm $(GENCODEDIR)/tmp_wrap.cpp
669
670 $(TARGETDIR)/%% : %%
671 cp -f $< $@
672
673 $(TARGETDIR)/%% : $(GENCODEDIR)/%%
674 cp -f $< $@
675
676 #----------------------------------------------------------------------
677
678 %(DEPENDS)s
679
680 #----------------------------------------------------------------------
681
682 $(TARGET) : $(OBJECTS)
683 $(LDSHARED) $(OBJECTS) $(LFLAGS) $(LIBS) $(OTHERLIBS) -o $(TARGET)
684
685
686
687 pycfiles : $(PYMODULES)
688 $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR)
689 $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR)
690
691
692 $(TARGETDIR) :
693 mkdir $(TARGETDIR)
694
695 $(GENCODEDIR):
696 mkdir $(GENCODEDIR)
697
698 #----------------------------------------------------------------------
699
700
701 %(OTHERRULES)s
702
703
704
705 '''
706
707
708 #----------------------------------------------------------------------------
709
710 if __name__ == '__main__':
711 main(sys.argv)
712
713 #----------------------------------------------------------------------------
714
715
716
717
718
719
720
721