SConscript (9225:d40bbb9f8698) SConscript (9226:66a418aaf850)
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

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

928 new_env.Command(secondary_exename, exename,
929 MakeAction('ln $SOURCE $TARGET', Transform("HARDLINK")))
930
931 new_env.M5Binary = targets[0]
932 envList.append(new_env)
933
934# Start out with the compiler flags common to all compilers,
935# i.e. they all use -g for opt and -g -pg for prof
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

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

928 new_env.Command(secondary_exename, exename,
929 MakeAction('ln $SOURCE $TARGET', Transform("HARDLINK")))
930
931 new_env.M5Binary = targets[0]
932 envList.append(new_env)
933
934# Start out with the compiler flags common to all compilers,
935# i.e. they all use -g for opt and -g -pg for prof
936ccflags = {'debug' : [], 'opt' : ['-g'], 'fast' : [], 'prof' : ['-g', '-pg']}
936ccflags = {'debug' : [], 'opt' : ['-g'], 'fast' : [], 'prof' : ['-g', '-pg'],
937 'perf' : ['-g']}
937
938
938# Start out with the linker flags common to all linkers, i.e. -pg for prof.
939ldflags = {'debug' : [], 'opt' : [], 'fast' : [], 'prof' : ['-pg']}
939# Start out with the linker flags common to all linkers, i.e. -pg for
940# prof, and -lprofiler for perf. The -lprofile flag is surrounded by
941# no-as-needed and as-needed as the binutils linker is too clever and
942# simply doesn't link to the library otherwise.
943ldflags = {'debug' : [], 'opt' : [], 'fast' : [], 'prof' : ['-pg'],
944 'perf' : ['-Wl,--no-as-needed', '-lprofiler', '-Wl,--as-needed']}
940
941if env['GCC']:
942 if sys.platform == 'sunos5':
943 ccflags['debug'] += ['-gstabs+']
944 else:
945 ccflags['debug'] += ['-ggdb3']
946 ldflags['debug'] += ['-O0']
945
946if env['GCC']:
947 if sys.platform == 'sunos5':
948 ccflags['debug'] += ['-gstabs+']
949 else:
950 ccflags['debug'] += ['-ggdb3']
951 ldflags['debug'] += ['-O0']
947 # opt, fast and prof all share the same cc flags
948 for target in ['opt', 'fast', 'prof']:
952 # opt, fast, prof and perf all share the same cc flags
953 for target in ['opt', 'fast', 'prof', 'perf']:
949 ccflags[target] += ['-O3']
950elif env['SUNCC']:
951 ccflags['debug'] += ['-g0']
952 ccflags['opt'] += ['-O']
954 ccflags[target] += ['-O3']
955elif env['SUNCC']:
956 ccflags['debug'] += ['-g0']
957 ccflags['opt'] += ['-O']
953 ccflags['fast'] += ['-fast']
954 ccflags['prof'] += ['-fast']
958 for target in ['fast', 'prof', 'perf']:
959 ccflags[target] += ['-fast']
955elif env['ICC']:
956 ccflags['debug'] += ['-g', '-O0']
957 ccflags['opt'] += ['-O']
960elif env['ICC']:
961 ccflags['debug'] += ['-g', '-O0']
962 ccflags['opt'] += ['-O']
958 ccflags['fast'] += ['-fast']
959 ccflags['prof'] += ['-fast']
963 for target in ['fast', 'prof', 'perf']:
964 ccflags[target] += ['-fast']
960elif env['CLANG']:
961 ccflags['debug'] += ['-g', '-O0']
965elif env['CLANG']:
966 ccflags['debug'] += ['-g', '-O0']
962 ccflags['opt'] += ['-O3']
963 ccflags['fast'] += ['-O3']
964 ccflags['prof'] += ['-O3']
967 # opt, fast, prof and perf all share the same cc flags
968 for target in ['opt', 'fast', 'prof', 'perf']:
969 ccflags[target] += ['-O3']
965else:
966 print 'Unknown compiler, please fix compiler options'
967 Exit(1)
968
969
970# To speed things up, we only instantiate the build environments we
971# need. We try to identify the needed environment for each target; if
972# we can't, we fall back on instantiating all the environments just to
973# be safe.
970else:
971 print 'Unknown compiler, please fix compiler options'
972 Exit(1)
973
974
975# To speed things up, we only instantiate the build environments we
976# need. We try to identify the needed environment for each target; if
977# we can't, we fall back on instantiating all the environments just to
978# be safe.
974target_types = ['debug', 'opt', 'fast', 'prof']
975obj2target = {'do': 'debug', 'o': 'opt', 'fo': 'fast', 'po': 'prof'}
979target_types = ['debug', 'opt', 'fast', 'prof', 'perf']
980obj2target = {'do': 'debug', 'o': 'opt', 'fo': 'fast', 'po': 'prof',
981 'gpo' : 'perf'}
976
977def identifyTarget(t):
978 ext = t.split('.')[-1]
979 if ext in target_types:
980 return ext
981 if obj2target.has_key(ext):
982 return obj2target[ext]
983 match = re.search(r'/tests/([^/]+)/', t)

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

1005
1006# "Fast" binary
1007if 'fast' in needed_envs:
1008 makeEnv('fast', '.fo', strip = True,
1009 CCFLAGS = Split(ccflags['fast']),
1010 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1011 LINKFLAGS = Split(ldflags['fast']))
1012
982
983def identifyTarget(t):
984 ext = t.split('.')[-1]
985 if ext in target_types:
986 return ext
987 if obj2target.has_key(ext):
988 return obj2target[ext]
989 match = re.search(r'/tests/([^/]+)/', t)

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

1011
1012# "Fast" binary
1013if 'fast' in needed_envs:
1014 makeEnv('fast', '.fo', strip = True,
1015 CCFLAGS = Split(ccflags['fast']),
1016 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1017 LINKFLAGS = Split(ldflags['fast']))
1018
1013# Profiled binary
1019# Profiled binary using gprof
1014if 'prof' in needed_envs:
1015 makeEnv('prof', '.po',
1016 CCFLAGS = Split(ccflags['prof']),
1017 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1018 LINKFLAGS = Split(ldflags['prof']))
1019
1020if 'prof' in needed_envs:
1021 makeEnv('prof', '.po',
1022 CCFLAGS = Split(ccflags['prof']),
1023 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1024 LINKFLAGS = Split(ldflags['prof']))
1025
1026# Profiled binary using google-pprof
1027if 'perf' in needed_envs:
1028 makeEnv('perf', '.gpo',
1029 CCFLAGS = Split(ccflags['perf']),
1030 CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
1031 LINKFLAGS = Split(ldflags['perf']))
1032
1020Return('envList')
1033Return('envList')