[project @ 2000-05-15 14:36:48 by simonmar]
authorsimonmar <unknown>
Mon, 15 May 2000 14:36:48 +0000 (14:36 +0000)
committersimonmar <unknown>
Mon, 15 May 2000 14:36:48 +0000 (14:36 +0000)
Change the order of building stubs vs. the main .hc file so that one
doesn't trample on the other.  This stuff is *so* horrible.

ghc/driver/ghc.lprl

index 50cd7cc..6bd471b 100644 (file)
@@ -1502,6 +1502,25 @@ Now the Haskell compiler, C compiler, and assembler
        &run_something("cp $hsc_out_h_stub $ofile_h_stub_target", 'Copy foreign export header file');
     }
 
+    #
+    # Bring the C stub protos into scope when compiling the .hc file.
+    #
+    push (@CcInjects, "#include \"${hsc_out_h_stub}\"\n");
+    # Hack - ensure that the stub .h file is included in the OPTIONS section
+    #   if the .hc file is saved.
+    push (@File_options, "-#include \"${ofile_h_stub_target}\"\n");
+
+    if ($do_cc) {
+       &runGcc    ($is_hc_file, $hsc_out, $cc_as_o);
+       &runMangler($is_hc_file, $cc_as_o, $cc_as, $ifile_root) if ! $Only_preprocess_hc;
+    }
+
+    &split_asm_file($cc_as)  if $do_as && $SplitObjFiles;
+
+    # save a copy of the .s file..
+    &saveIntermediate($ifile_root , "s" , $cc_as) if ($do_as && $Keep_s_file_too);
+    &runAs($as_out, $ifile_root) if $do_as;
+
     if (-f $hsc_out_c_stub) {
        &run_something("rm -f $ofile_c_stub_target && echo '#include \"${ofile_h_stub_target}\"' > $ofile_c_stub_target && cat $hsc_out_c_stub >> $ofile_c_stub_target", 'Copy foreign export C stubs');
        local ($hsc_out_s_stub);
@@ -1510,30 +1529,12 @@ Now the Haskell compiler, C compiler, and assembler
        ($ofile_o_stub_target = $ofile_c_stub_target) =~ s/\.(.*)$//;
 
         $ofile_o_stub_target = &osuf_ify($ofile_o_stub_target, "o");
-       if ($do_cc) {
+       if ($do_cc || $do_as) {  # might be using NCG, so check $do_as
          &runGcc    (0, $ofile_c_stub_target, $ofile_s_stub_target);
           &runAs     ($ofile_o_stub_target, $ofile_s_stub_target);
        }
-       #
-       # Bring the C stub protos into scope when compiling the .hc file.
-       #
-       push (@CcInjects, "#include \"${hsc_out_h_stub}\"\n");
-       # Hack - ensure that the stub .h file is included in the OPTIONS section
-       #        if the .hc file is saved.
-       push (@File_options, "-#include \"${ofile_h_stub_target}\"\n");
-       
     }
 
-    if ($do_cc) {
-       &runGcc    ($is_hc_file, $hsc_out, $cc_as_o);
-       &runMangler($is_hc_file, $cc_as_o, $cc_as, $ifile_root) if ! $Only_preprocess_hc;
-    }
-
-    &split_asm_file($cc_as)  if $do_as && $SplitObjFiles;
-
-    # save a copy of the .s file..
-    &saveIntermediate($ifile_root , "s" , $cc_as) if ($do_as && $Keep_s_file_too);
-    &runAs($as_out, $ifile_root) if $do_as;
 \end{code}
 
 Finally, decide what to queue up for linker input.