]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/distrib/build.py
Build tool updates
[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 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.doFixups()
168 config.makeMakefile()
169 err = 0
170
171 if config.runBuild:
172 cmd = "%s -f %s" % (config.MAKE, config.MAKEFILE)
173 print "Running:", cmd
174 err = os.system(cmd)
175
176 if not err and config.runInstall:
177 cmd = "%s -f %s install" % (config.MAKE, config.MAKEFILE)
178 print "Running:", cmd
179 err = os.system(cmd)
180
181
182 if not err and config.runClean:
183 cmd = "%s -f %s clean" % (config.MAKE, config.MAKEFILE)
184 print "Running:", cmd
185 err = os.system(cmd)
186
187 if not err and config.runUninstall:
188 cmd = "%s -f %s uninstall" % (config.MAKE, config.MAKEFILE)
189 print "Running:", cmd
190 err = os.system(cmd)
191
192
193
194 #----------------------------------------------------------------------------
195
196 def usage():
197 print __doc__
198
199 #----------------------------------------------------------------------------
200
201 def swapslash(st):
202 if sys.platform != 'win32':
203 st = string.join(string.split(st, '\\'), '/')
204 return st
205
206 #----------------------------------------------------------------------------
207
208 def splitlines(st):
209 return string.join(string.split(string.strip(st), ' '), ' \\\n\t')
210
211 #----------------------------------------------------------------------------
212
213 class BuildConfig:
214 def __init__(self, **kw):
215 self.__dict__.update(kw)
216 self.setDefaults()
217
218 #------------------------------------------------------------
219 def setDefaults(self):
220 self.VERSION = __version__
221 self.MODULE = ''
222 self.SWIGFILES = []
223 self.SWIGFLAGS = '-c++ -shadow -python -dnone -I$(WXPSRCDIR)'
224 self.SOURCES = []
225 self.PYFILES = []
226 self.LFLAGS = ''
227 self.OTHERCFLAGS = ''
228 self.OTHERLFLAGS = ''
229 self.OTHERSWIGFLAGS = ''
230 self.OTHERLIBS = ''
231 self.OTHERTARGETS = ''
232 self.OTHERINSTALLTARGETS = ''
233 self.OTHERRULES = ''
234 self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)'
235 self.PYVERSION = sys.version[:3]
236 self.PYPREFIX = sys.prefix
237 self.EXECPREFIX = sys.exec_prefix
238 self.WXDIR = '$(WXWIN)'
239 self.FINAL = '0'
240 self.WXP_USE_THREAD = '1'
241 self.WXUSINGDLL = '1'
242 self.OTHERDEP = ''
243 self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src'
244
245
246 if sys.platform == 'win32':
247 self.MAKE = 'nmake'
248 self.PYTHONLIB = '$(PYPREFIX)\\libs\\python15.lib'
249 self.TARGETDIR = '$(PYPREFIX)\\wxPython'
250 self.LIBS = '$(PYTHONLIB) $(WXPSRCDIR)\wxc.lib'
251 self.GENCODEDIR = 'msw'
252 self.SWIGTOOLKITFLAG = '-D__WXMSW__'
253 self.OBJEXT = '.obj'
254 self.TARGET = '$(MODULE).pyd'
255 self.CFLAGS = '-I$(PYPREFIX)\include -I$(WXPSRCDIR) -I. /Fp$(MODULE).pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) '
256 self.LFLAGS = '$(DEBUGLFLAGS) /DLL /subsystem:windows,3.50 /machine:I386 /nologo'
257 self.RESFILE = ''
258 self.RESRULE = ''
259 self.OVERRIDEFLAGS = '/GX-'
260
261 else:
262 self.MAKE = 'make'
263 self.PYLIB = '$(EXECPREFIX)/lib/python$(PYVERSION)'
264 self.LIBPL = '$(PYLIB)/config'
265 self.PYTHONLIB = '$(LIBPL)/libpython$(PYVERSION).a'
266 self.TARGETDIR = '$(EXECPREFIX)/lib/python$(PYVERSION)/site-packages/wxPython'
267 self.TARGET = '$(MODULE)module$(SO)'
268 self.OBJEXT = '.o'
269 self.HELPERLIB = 'wxPyHelpers'
270 self.HELPERLIBDIR = '/usr/local/lib'
271 self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\
272 '`wx-config --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\
273 '-I$(WXPSRCDIR)'
274 self.LFLAGS = '-L$(WXPSRCDIR) `wx-config --libs`'
275 self.LIBS = '-l$(HELPERLIB)'
276
277 # **** What to do when I start supporting Motif, etc.???
278 self.GENCODEDIR = 'gtk'
279 self.SWIGTOOLKITFLAG = '-D__WXGTK__'
280
281 # Extract a few things from Python's Makefile...
282 try:
283 filename = os.path.join(self.EXECPREFIX,
284 'lib/python'+self.PYVERSION,
285 'config/Makefile')
286 mfText = string.split(open(filename, 'r').read(), '\n')
287 except IOError:
288 raise SystemExit, "Python development files not found"
289
290 self.CCC = self.findMFValue(mfText, 'CCC')
291 self.CC = self.findMFValue(mfText, 'CC')
292 self.OPT = self.findMFValue(mfText, 'OPT')
293 self.SO = self.findMFValue(mfText, 'SO')
294 self.LDSHARED = self.findMFValue(mfText, 'LDSHARED')
295 self.CCSHARED = self.findMFValue(mfText, 'CCSHARED')
296 #self.LINKFORSHARED = self.findMFValue(mfText, 'LINKFORSHARED')
297 #self. = self.findMFValue(mfText, '')
298 #self. = self.findMFValue(mfText, '')
299
300
301 # The majority of cases will require LDSHARED to be
302 # modified to use the C++ driver instead of the C driver
303 # for linking. We'll try to do it here and if we goof up
304 # then the user can correct it in their build.local file.
305 self.LDSHARED = string.join(['$(CCC)'] +
306 string.split(self.LDSHARED, ' ')[1:],
307 ' ')
308
309
310 #------------------------------------------------------------
311 def doFixups(self):
312 # This is called after the config files have been evaluated
313 # so we can do some sanity checking...
314 if sys.platform != 'win32':
315 if not self.CCC:
316 print "Warning: C++ compiler not specified (CCC). Assuming c++"
317 self.CCC = 'c++'
318 if not self.CC:
319 print "Warning: C compiler not specified (CC). Assuming cc"
320 self.CC = 'cc'
321
322 #------------------------------------------------------------
323 def findMFValue(self, mfText, st):
324 # Find line begining with st= and return the value
325 # Regex would probably be to cooler way to do this, but
326 # I think this is the most understandable.
327 for line in mfText:
328 if string.find(line, st+'=') == 0:
329 st = string.strip(line[len(st)+1:])
330 return st
331 return None
332
333 #------------------------------------------------------------
334 def makeMakefile(self):
335
336 # make a list of object file names
337 objects = ""
338 for name in self.SWIGFILES:
339 objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' '
340 for name in self.SOURCES:
341 obj = os.path.basename(name)
342 objects = objects + os.path.splitext(obj)[0] + self.OBJEXT + ' '
343 self.OBJECTS = splitlines(objects)
344
345
346 # now build the text for the dependencies
347 depends = ""
348 for name in self.SWIGFILES:
349 text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i\n' \
350 '$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \
351 tuple([os.path.splitext(name)[0]] * 5)
352 depends = depends + text
353 for name in self.PYFILES:
354 text = '$(TARGETDIR)\\%s.py : %s.py\n' % \
355 tuple([os.path.splitext(name)[0]] * 2)
356 depends = depends + text
357 self.DEPENDS = swapslash(depends)
358
359
360 # and the list of .py files
361 pymodules = ""
362 for name in self.SWIGFILES:
363 pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
364 for name in self.PYFILES:
365 pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
366 self.PYMODULES = splitlines(swapslash(pymodules))
367
368
369
370 # finally, build the makefile
371 if sys.platform == 'win32':
372 if self.RESFILE:
373 self.RESFILE = '$(MODULE).res'
374 self.RESRULE = '$(MODULE).res : $(MODULE).rc $(WXDIR)\\include\\wx\\msw\\wx.rc\n\t'\
375 '$(rc) -r /i$(WXDIR)\\include -fo$@ $(MODULE).rc'
376 text = win32Template % self.__dict__
377 else:
378 text = unixTemplate % self.__dict__
379 f = open(self.MAKEFILE, 'w')
380 f.write(text)
381 f.close()
382
383 print "Makefile created: ", self.MAKEFILE
384
385
386 #------------------------------------------------------------
387 def readConfigFiles(self, args):
388 return self.processFile(self.bldCfg, 1) and \
389 self.processFile(os.path.join('../..', self.bldCfgLocal)) and \
390 self.processFile(os.path.join('..', self.bldCfgLocal)) and \
391 self.processFile(os.path.join('.', self.bldCfgLocal)) and \
392 self.processArgs(args)
393
394 #------------------------------------------------------------
395 def processFile(self, filename, required=0):
396 try:
397 text = open(filename, 'r').read()
398 except IOError:
399 if required:
400 print "Unable to open %s" % filename
401 return 0
402 else:
403 return 1
404
405 try:
406 exec(text, self.__dict__)
407 except:
408 print "Error evaluating %s" % filename
409 import traceback
410 traceback.print_exc()
411 return 0
412 return 1
413
414
415 #------------------------------------------------------------
416 def processArgs(self, args):
417 try:
418 for st in args:
419 pair = string.split(st, '=')
420 name = pair[0]
421 value = pair[1]
422 self.__dict__[name] = value
423 except:
424 print "Error parsing command-line: %s" % st
425 return 0
426
427 return 1
428
429
430 #------------------------------------------------------------
431
432
433
434
435
436 #----------------------------------------------------------------------------
437 #----------------------------------------------------------------------------
438
439 win32Template = '''
440 #----------------------------------------------------------------------
441 # This makefile was autogenerated from build.py. Your changes will be
442 # lost if the generator is run again. You have been warned.
443 #----------------------------------------------------------------------
444
445 WXDIR = %(WXDIR)s
446 VERSION = %(VERSION)s
447 MODULE = %(MODULE)s
448 SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
449 CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s
450 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
451 PYVERSION = %(PYVERSION)s
452 PYPREFIX = %(PYPREFIX)s
453 EXECPREFIX = %(EXECPREFIX)s
454 PYTHONLIB = %(PYTHONLIB)s
455 FINAL = %(FINAL)s
456 WXP_USE_THREAD = %(WXP_USE_THREAD)s
457 WXUSINGDLL = %(WXUSINGDLL)s
458 GENCODEDIR = %(GENCODEDIR)s
459 RESFILE = %(RESFILE)s
460 WXPSRCDIR = %(WXPSRCDIR)s
461
462
463 TARGETDIR = %(TARGETDIR)s
464
465 OBJECTS = %(OBJECTS)s
466 PYMODULES = %(PYMODULES)s
467 TARGET = %(TARGET)s
468
469
470
471
472 !if "$(FINAL)" == "0"
473 DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES
474 !else
475 DEBUGLFLAGS = /INCREMENTAL:NO
476 !endif
477 !if "$(WXP_USE_THREAD)" == "1"
478 THREAD=-DWXP_USE_THREAD=1
479 !endif
480
481
482
483
484 NOPCH=1
485 OVERRIDEFLAGS=%(OVERRIDEFLAGS)s %(OTHERCFLAGS)s
486 EXTRAFLAGS = %(CFLAGS)s
487
488 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
489 EXTRALIBS = %(LIBS)s %(OTHERLIBS)s
490
491 #----------------------------------------------------------------------
492
493 !include $(WXDIR)\\src\\makevc.env
494
495 #----------------------------------------------------------------------
496
497 %(DEFAULTRULE)s %(OTHERTARGETS)s
498
499
500
501 install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
502
503 clean:
504 -erase *.obj
505 -erase *.exe
506 -erase *.res
507 -erase *.map
508 -erase *.sbr
509 -erase *.pdb
510 -erase *.pch
511 -erase $(MODULE).exp
512 -erase $(MODULE).lib
513 -erase $(MODULE).ilk
514 -erase $(TARGET)
515
516
517 uninstall:
518 -erase $(TARGETDIR)\\$(TARGET)
519 -erase $(PYMODULES)
520
521 #----------------------------------------------------------------------
522 # implicit rule for compiling .cpp and .c files
523 {}.cpp{}.obj:
524 $(cc) @<<
525 $(CPPFLAGS) /c /Tp $<
526 <<
527
528 {$(GENCODEDIR)}.cpp{}.obj:
529 $(cc) @<<
530 $(CPPFLAGS) /c /Tp $<
531 <<
532
533 {}.c{}.obj:
534 $(cc) @<<
535 $(CPPFLAGS) /c $<
536 <<
537
538 .SUFFIXES : .i .py
539
540 # Implicit rules to run SWIG
541 {}.i{$(GENCODEDIR)}.cpp:
542 swig $(SWIGFLAGS) -c -o $@ $<
543
544 {}.i{$(GENCODEDIR)}.py:
545 swig $(SWIGFLAGS) -c -o $(GENCODEDIR)\\tmp_wrap.cpp $<
546 -erase $(GENCODEDIR)\\tmp_wrap.cpp
547
548
549 {$(GENCODEDIR)}.py{$(TARGETDIR)}.py:
550 copy $< $@
551
552 {}.py{$(TARGETDIR)}.py:
553 copy $< $@
554
555 #----------------------------------------------------------------------
556
557 $(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE)
558 $(link) @<<
559 /out:$@
560 $(LFLAGS) /def:$(MODULE).def /implib:./$(MODULE).lib
561 $(DUMMYOBJ) $(OBJECTS) $(RESFILE)
562 $(LIBS)
563 <<
564
565
566 %(RESRULE)s
567
568
569 $(TARGETDIR)\\$(TARGET) : $(TARGET)
570 copy $(TARGET) $@
571
572
573 pycfiles : $(PYMODULES)
574 $(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR)
575 $(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR)
576
577
578 $(TARGETDIR) :
579 mkdir $(TARGETDIR)
580
581 $(GENCODEDIR):
582 mkdir $(GENCODEDIR)
583
584 #----------------------------------------------------------------------
585
586 %(DEPENDS)s
587
588 #----------------------------------------------------------------------
589
590
591 %(OTHERRULES)s
592 '''
593
594 #----------------------------------------------------------------------------
595 #----------------------------------------------------------------------------
596 #----------------------------------------------------------------------------
597
598 unixTemplate = '''
599 #----------------------------------------------------------------------
600 # This makefile was autogenerated from build.py. Your changes will be
601 # lost if the generator is run again. You have been warned.
602 #----------------------------------------------------------------------
603
604
605
606 WXDIR = %(WXDIR)s
607 VERSION = %(VERSION)s
608 MODULE = %(MODULE)s
609 SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
610 CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s
611 LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
612 LIBS = %(LIBS)s %(OTHERLIBS)s
613 PYVERSION = %(PYVERSION)s
614 PYPREFIX = %(PYPREFIX)s
615 EXECPREFIX = %(EXECPREFIX)s
616 PYINCLUDE = $(PYPREFIX)/include/python$(PYVERSION)
617 EXECINCLUDE = $(EXECPREFIX)/include/python$(PYVERSION)
618 PYLIB = %(PYLIB)s
619 LIBPL = %(LIBPL)s
620 PYTHONLIB = %(PYTHONLIB)s
621 FINAL = %(FINAL)s
622 WXP_USE_THREAD = %(WXP_USE_THREAD)s
623 GENCODEDIR = %(GENCODEDIR)s
624 WXPSRCDIR = %(WXPSRCDIR)s
625 HELPERLIB = %(HELPERLIB)s
626 HELPERLIBDIR = %(HELPERLIBDIR)s
627
628 TARGETDIR = %(TARGETDIR)s
629
630
631 CCC = %(CCC)s
632 CC = %(CC)s
633 OPT = %(OPT)s
634 SO = %(SO)s
635 LDSHARED = %(LDSHARED)s
636 CCSHARED = %(CCSHARED)s
637
638
639 OBJECTS = %(OBJECTS)s
640 PYMODULES = %(PYMODULES)s
641 TARGET = %(TARGET)s
642
643
644 ifeq ($(WXP_USE_THREAD), 1)
645 THREAD=-DWXP_USE_THREAD
646 endif
647
648 #----------------------------------------------------------------------
649
650 %(DEFAULTRULE)s %(OTHERTARGETS)s
651
652 install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
653
654 clean:
655 -rm -f *.o *.so *~
656 -rm -f $(TARGET)
657
658 uninstall:
659 -rm -f $(TARGETDIR)/$(TARGET)
660 -rm -f $(PYMODULES)
661
662
663 #----------------------------------------------------------------------
664
665 %%.o : %%.cpp
666 $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
667
668 %%.o : $(GENCODEDIR)/%%.cpp
669 $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
670
671 %%.o : %%.c
672 $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
673
674 %%.o : $(GENCODEDIR)/%%.c
675 $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
676
677 $(GENCODEDIR)/%%.cpp : %%.i
678 swig $(SWIGFLAGS) -c -o $@ $<
679
680 $(GENCODEDIR)/%%.py : %%.i
681 swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
682 rm $(GENCODEDIR)/tmp_wrap.cpp
683
684 $(TARGETDIR)/%% : %%
685 cp -f $< $@
686
687 $(TARGETDIR)/%% : $(GENCODEDIR)/%%
688 cp -f $< $@
689
690 #----------------------------------------------------------------------
691
692 %(DEPENDS)s
693
694 #----------------------------------------------------------------------
695
696 $(TARGET) : $(OBJECTS)
697 $(LDSHARED) $(OBJECTS) $(LFLAGS) $(LIBS) $(OTHERLIBS) -o $(TARGET)
698
699
700
701 pycfiles : $(PYMODULES)
702 $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR)
703 $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR)
704
705
706 $(TARGETDIR) :
707 mkdir $(TARGETDIR)
708
709 $(GENCODEDIR):
710 mkdir $(GENCODEDIR)
711
712 #----------------------------------------------------------------------
713
714
715 %(OTHERRULES)s
716
717
718
719 '''
720
721
722 #----------------------------------------------------------------------------
723
724 if __name__ == '__main__':
725 main(sys.argv)
726
727 #----------------------------------------------------------------------------
728
729
730
731
732
733
734
735