File: vcmake.py

package info (click to toggle)
egenix-mx-base 2.0.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,028 kB
  • ctags: 4,762
  • sloc: ansic: 14,965; python: 11,739; sh: 313; makefile: 117
file content (37 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/local/bin/python

""" Helper script to path the VC generated Makefile and execute
    NMAKE.

    Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2004, eGenix.com Software GmbH; mailto:info@egenix.com
    See the documentation for further copyright information or contact
    the author.

"""

import sys,os,re,string

def make(projectname,configuration='Release',*args):

    # Edit Makefile
    makefile = open(projectname + '.mak','rb').read()
    makefile = re.sub('CPP_PROJ=(.*) /O2(?! /Gf)',
                      'CPP_PROJ=\\1 /O2 /Gf /GB /GD',
                      makefile)
    open(projectname + '.mak','wb').write(makefile)

    # Call NMAKE
    os.system('nmake /nologo /c /f "%s.mak" CFG="%s - Win32 %s" %s' %
              (projectname,projectname,configuration,string.join(args)))

if __name__ == '__main__':
    try:
        apply(make,tuple(sys.argv[1:]))
    except TypeError:
        print "vcmake.py <projectname> <configuration> [<maketarget>]"
        print
        print "Example: vcmake.py mxODBC Release"
        print
        sys.exit(1)