]> src.bluestatic.org Git - armadillo.git/blob - build.py
Add buildfile. Doesn't quote work yet.
[armadillo.git] / build.py
1 #!/usr/bin/env python2.5
2 import os
3 import subprocess
4 import sys
5
6 ROOT = '.'
7 SRC_PATH = os.path.join(ROOT, 'src')
8 PROD_PATH = os.path.join(ROOT, 'out')
9
10 SOURCES = [
11 'server.go',
12 'main.go'
13 ]
14 PRODUCT_NAME = 'armadillo'
15
16 COMPILER = '8g'
17 LINKER = '8l'
18 O_EXTENSION = '8'
19
20 def _ObjFileName(gofile):
21 gofile = os.path.basename(gofile)
22 return os.path.join(PROD_PATH, os.path.splitext(gofile)[0] + '.' + O_EXTENSION)
23
24 def Main():
25 print '=== Starting Build ==='
26 # Compile.
27 for gofile in SOURCES:
28 gofile = os.path.join(SRC_PATH, gofile)
29 args = [ COMPILER, '-I', PROD_PATH, '-I', SRC_PATH, '-o', _ObjFileName(gofile), gofile ]
30 print ' ' + ' '.join(args)
31 handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr)
32 handle.wait()
33
34 # Link
35 objects = map(_ObjFileName, SOURCES)
36 args = [ LINKER, '-o', os.path.join(PROD_PATH, PRODUCT_NAME) ] + objects
37 print ' ' + ' ' .join(args)
38 handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr)
39 handle.wait()
40
41 if __name__ == '__main__':
42 Main()