2009-08-30 09:46:56 +02:00
|
|
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
|
|
|
import os
|
|
|
|
|
|
|
|
compiler = SM.DefaultCompiler()
|
|
|
|
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
|
|
|
|
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
|
|
|
|
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'compiler'))
|
|
|
|
compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
|
|
|
|
|
|
|
|
if compiler.cc.name == 'gcc':
|
|
|
|
compiler['CFLAGS'].extend(['-Wno-parentheses', '-Wno-format'])
|
2010-05-11 10:46:55 +02:00
|
|
|
if AMBuild.target['platform'] == 'linux':
|
|
|
|
compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
|
2009-08-30 09:46:56 +02:00
|
|
|
elif compiler.cc.name == 'msvc':
|
|
|
|
compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS')
|
|
|
|
compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE')
|
|
|
|
|
|
|
|
if AMBuild.target['platform'] == 'linux':
|
|
|
|
compiler['CDEFINES'].extend(['LINUX', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC'])
|
2010-05-11 10:46:55 +02:00
|
|
|
elif AMBuild.target['platform'] == 'darwin':
|
|
|
|
compiler['CDEFINES'].extend(['DARWIN', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC'])
|
2009-08-30 09:46:56 +02:00
|
|
|
|
|
|
|
extension = AMBuild.AddJob('spcomp')
|
|
|
|
binary = Cpp.ExecutableBuilder('spcomp', AMBuild, extension, compiler)
|
|
|
|
files = [
|
|
|
|
'libpawnc.c',
|
|
|
|
'lstring.c',
|
|
|
|
'memfile.c',
|
|
|
|
'pawncc.c',
|
|
|
|
'sc1.c',
|
|
|
|
'sc2.c',
|
|
|
|
'sc3.c',
|
|
|
|
'sc4.c',
|
|
|
|
'sc5.c',
|
|
|
|
'sc6.c',
|
|
|
|
'sc7.c',
|
|
|
|
'scexpand.c',
|
|
|
|
'sci18n.c',
|
|
|
|
'sclist.c',
|
|
|
|
'scmemfil.c',
|
|
|
|
'scstate.c',
|
|
|
|
'sctracker.c',
|
|
|
|
'scvars.c',
|
|
|
|
'sp_file.c',
|
|
|
|
'zlib/adler32.c',
|
|
|
|
'zlib/compress.c',
|
|
|
|
'zlib/crc32.c',
|
|
|
|
'zlib/deflate.c',
|
|
|
|
'zlib/gzio.c',
|
|
|
|
'zlib/infback.c',
|
|
|
|
'zlib/inffast.c',
|
|
|
|
'zlib/inflate.c',
|
|
|
|
'zlib/inftrees.c',
|
|
|
|
'zlib/trees.c',
|
|
|
|
'zlib/uncompr.c',
|
|
|
|
'zlib/zutil.c'
|
|
|
|
]
|
|
|
|
if AMBuild.target['platform'] == 'linux':
|
|
|
|
files.append('binreloc.c')
|
|
|
|
binary.AddSourceFiles('sourcepawn/compiler', files)
|
|
|
|
|
|
|
|
if AMBuild.target['platform'] == 'windows':
|
|
|
|
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"']}
|
|
|
|
binary.AddResourceFile('sourcepawn/compiler/libpawnc.rc', env)
|
|
|
|
|
|
|
|
binary.SendToJob()
|
|
|
|
|