util: c++-ify the call type in the m5 utility.
[gem5.git] / util / m5 / src / SConscript
index 0961f2f5d2520f6d690da1713fa6c640e1f98b57..176f4c262f3530b97a9d95650dc159a06390dc66 100644 (file)
@@ -51,13 +51,6 @@ default_call_type = default_call_type[0]
 static_env = env.Clone()
 static_env.Append(LINKFLAGS=[ '-no-pie', '-static' ])
 
-for ct in all_call_types:
-    static_env.Append(CXXFLAGS='-DENABLE_CT_%s=%d' %
-                (ct.name, 1 if ct.enabled else 0))
-    static_env.Append(CXXFLAGS='-DDEFAULT_CT_%s=%d' %
-                (ct.name, 1 if ct.default else 0))
-static_env.Append(CXXFLAGS='-DDEFAULT_CALL_TYPE=%s' % default_call_type.name)
-
 #
 # The m5 library for use in other C/C++ programs.
 #
@@ -67,7 +60,12 @@ libm5 = static_env.StaticLibrary('out/m5', [ m5_mmap ] + m5ops)
 #
 # The m5 stand alone command line utility.
 #
-ct_support = list([ File('%s_call_type.cc' % ct.name) for ct in call_types ])
+ct_support = []
+for ct in call_types:
+    ct_env = static_env.Clone()
+    is_default = 'true' if ct.default else 'false'
+    ct_env.Append(CXXFLAGS=[ '-DCALL_TYPE_IS_DEFAULT=%s' % is_default ])
+    ct_support.extend(ct_env.StaticObject('%s_call_type.cc' % ct.name))
 m5_bin = static_env.Program('out/m5',
         ct_support + [ args, call_type, commands, m5, m5_mmap, libm5, usage ])