From c33665c135ceb9028a51b6838a23b947888d52c4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 17 Aug 2010 00:58:28 -0400 Subject: [PATCH] Add buildfile. Doesn't quote work yet. --- build.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 build.py diff --git a/build.py b/build.py new file mode 100755 index 0000000..f25edcd --- /dev/null +++ b/build.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python2.5 +import os +import subprocess +import sys + +ROOT = '.' +SRC_PATH = os.path.join(ROOT, 'src') +PROD_PATH = os.path.join(ROOT, 'out') + +SOURCES = [ + 'server.go', + 'main.go' +] +PRODUCT_NAME = 'armadillo' + +COMPILER = '8g' +LINKER = '8l' +O_EXTENSION = '8' + +def _ObjFileName(gofile): + gofile = os.path.basename(gofile) + return os.path.join(PROD_PATH, os.path.splitext(gofile)[0] + '.' + O_EXTENSION) + +def Main(): + print '=== Starting Build ===' + # Compile. + for gofile in SOURCES: + gofile = os.path.join(SRC_PATH, gofile) + args = [ COMPILER, '-I', PROD_PATH, '-I', SRC_PATH, '-o', _ObjFileName(gofile), gofile ] + print ' ' + ' '.join(args) + handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) + handle.wait() + + # Link + objects = map(_ObjFileName, SOURCES) + args = [ LINKER, '-o', os.path.join(PROD_PATH, PRODUCT_NAME) ] + objects + print ' ' + ' ' .join(args) + handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) + handle.wait() + +if __name__ == '__main__': + Main() -- 2.43.5