[project @ 2003-07-23 15:12:55 by simonmar]
[ghc-hetmet.git] / mk / suffix.mk
index 96834fc..69d164e 100644 (file)
 
 .DELETE_ON_ERROR:
 
-# However, if $(way) is set then we have to define $(way_) and $(_way)
-# from it in the obvious fashion.
-# This must be done here (or earlier), but not in target.mk with the other
-# way management, because the pattern rules in this file take a snapshot of
-# the value of $(way_) and $(_way), and it's no good setting them later!
-
-ifneq "$(way)" ""
-  way_ := $(way)_
-  _way := _$(way)
-endif
-
 #-----------------------------------------------------------------------------
 # Haskell Suffix Rules
 
@@ -145,8 +134,8 @@ endif
 
 .PRECIOUS: %.gc
 
-%.hs : %.gc
-       $(GREENCARD) $(GC_OPTS) $< -o $@
+%.hs %_stub_ffi.c %_stub_ffi.h : %.gc
+       $(GREENCARD) $(GC_OPTS) $<
 
 %.lhs : %.gc
        $(GREENCARD) $(GC_OPTS) $< -o $@
@@ -157,13 +146,14 @@ endif
 #-----------------------------------------------------------------------------
 # C-related suffix rules
 
-ifeq "$(UseGhcForCc)" "YES"
+# UseGhcForCc is only relevant when not booting from HC files.
+ifeq "$(UseGhcForCc) $(BootingFromHc)" "YES NO"
 
-$(odir_)%.$(way_)o : %.$(way_)s
+$(odir_)%.$(way_)o : %.c
        @$(RM) $@
        $(HC) $(GHC_CC_OPTS) -c $< -o $@
 
-$(odir_)%.$(way_)o : %.c
+$(odir_)%.$(way_)o : %.$(way_)s
        @$(RM) $@
        $(HC) $(GHC_CC_OPTS) -c $< -o $@
 
@@ -177,14 +167,14 @@ $(odir_)%.$(way_)s : %.c
 
 else
 
-$(odir_)%.$(way_)o : %.$(way_)s
-       @$(RM) $@
-       $(AS) $(AS_OPTS) -o $@ $<
-
 $(odir_)%.$(way_)o : %.c
        @$(RM) $@
        $(CC) $(CC_OPTS) -c $< -o $@
 
+$(odir_)%.$(way_)o : %.$(way_)s
+       @$(RM) $@
+       $(AS) $(AS_OPTS) -o $@ $<
+
 $(odir_)%.$(way_)o : %.S
        @$(RM) $@
        $(CC) $(CC_OPTS) -c $< -o $@
@@ -318,4 +308,4 @@ endif
 
 % : %.pp
        @$(RM) $@
-       $(CPP) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@
+       $(CPP) $(RAWCPP_FLAGS) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@