SConscript (8737:770ccf3af571) SConscript (8881:042d509574c1)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 939 unchanged lines hidden (view full) ---

948 ccflags['debug'] = '-g -O0'
949 ccflags['opt'] = '-g -O'
950 ccflags['fast'] = '-fast'
951 ccflags['prof'] = '-fast -g -pg'
952else:
953 print 'Unknown compiler, please fix compiler options'
954 Exit(1)
955
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 939 unchanged lines hidden (view full) ---

948 ccflags['debug'] = '-g -O0'
949 ccflags['opt'] = '-g -O'
950 ccflags['fast'] = '-fast'
951 ccflags['prof'] = '-fast -g -pg'
952else:
953 print 'Unknown compiler, please fix compiler options'
954 Exit(1)
955
956makeEnv('debug', '.do',
957 CCFLAGS = Split(ccflags['debug']),
958 CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
959
956
957# To speed things up, we only instantiate the build environments we
958# need. We try to identify the needed environment for each target; if
959# we can't, we fall back on instantiating all the environments just to
960# be safe.
961target_types = ['debug', 'opt', 'fast', 'prof']
962obj2target = {'do': 'debug', 'o': 'opt', 'fo': 'fast', 'po': 'prof'}
963
964def identifyTarget(t):
965 ext = t.split('.')[-1]
966 if ext in target_types:
967 return ext
968 if obj2target.has_key(ext):
969 return obj2target[ext]
970 match = re.search(r'/tests/([^/]+)/', t)
971 if match and match.group(1) in target_types:
972 return match.group(1)
973 return 'all'
974
975needed_envs = [identifyTarget(target) for target in BUILD_TARGETS]
976if 'all' in needed_envs:
977 needed_envs += target_types
978
979# Debug binary
980if 'debug' in needed_envs:
981 makeEnv('debug', '.do',
982 CCFLAGS = Split(ccflags['debug']),
983 CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
984
960# Optimized binary
985# Optimized binary
961makeEnv('opt', '.o',
962 CCFLAGS = Split(ccflags['opt']),
963 CPPDEFINES = ['TRACING_ON=1'])
986if 'opt' in needed_envs:
987 makeEnv('opt', '.o',
988 CCFLAGS = Split(ccflags['opt']),
989 CPPDEFINES = ['TRACING_ON=1'])
964
965# "Fast" binary
990
991# "Fast" binary
966makeEnv('fast', '.fo', strip = True,
967 CCFLAGS = Split(ccflags['fast']),
968 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
992if 'fast' in needed_envs:
993 makeEnv('fast', '.fo', strip = True,
994 CCFLAGS = Split(ccflags['fast']),
995 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
969
970# Profiled binary
996
997# Profiled binary
971makeEnv('prof', '.po',
972 CCFLAGS = Split(ccflags['prof']),
973 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
974 LINKFLAGS = '-pg')
998if 'prof' in needed_envs:
999 makeEnv('prof', '.po',
1000 CCFLAGS = Split(ccflags['prof']),
1001 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1002 LINKFLAGS = '-pg')
975
976Return('envList')
1003
1004Return('envList')