Commits

Anonymous committed e45b3cd

generate object file separately

  • Participants
  • Parent commits a618afe

Comments (0)

Files changed (1)

 
 
 def build(bld):
-    # target list
-    trg_list = ['rnn_ca1d', 'rnn_ca2d', 'rnn_opt0', 'rnn_opt1',
+    # source list
+    src_list = ['rnn_ca1d', 'rnn_ca2d', 'rnn_opt0', 'rnn_opt1',
                 'rnn_opt2', 'rnn_opt3', 'rnn_opt4']
     # compiler-specific flags
     default_flags = dict(
         icc = ['-vec-report1'],
         opencc = ['-lm'],
         )
-    # target-specific flags
+    # source-specific flags
     std99 = dict(gcc=['-std=c99'], icc=['-restrict'], opencc=['-std=c99'])
-    trg_flags = dict(rnn_opt3=std99, rnn_opt4=std99)
+    src_flags = dict(rnn_opt3=std99, rnn_opt4=std99)
 
     for com in bld.env.COMPILER_LIST:
         flags_list = [['-O3']]  # , ['-O2']
 
         for flags in flags_list:
             allflags = default_flags[com] + flags
-            for trg in trg_list:
+            for src in src_list:
                 allflagsstr = ' '.join(
-                    allflags + trg_flags.get(trg, {}).get(com, []))
+                    allflags + src_flags.get(src, {}).get(com, []))
                 flagsname = ''.join(flags)
+                trg = '%s-%s%s' % (src, com, flagsname)
+                # object file
+                bld(rule='%s -c %s ${SRC} -o ${TGT}' % (com, allflagsstr),
+                    source='%s.c' % src,
+                    target='%s.o' % trg)
+                # executable
                 bld(rule='%s %s ${SRC} -o ${TGT}' % (com, allflagsstr),
-                    source='%s.c' % trg,
-                    target='%s-%s%s' % (trg, com, flagsname))
+                    source='%s.o' % trg,
+                    target=trg)