X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=mk%2Fsuffix.mk;h=ade0255dd9e5ff431ae423bbfe41abf52aac2bb5;hb=c63aaee42e3e95276861121286eefce511cd1343;hp=60308b31dee878606dd7814ec9dba2a844409c4d;hpb=e940363a7b70bc3373ebebeff5fe5075b5b141ec;p=ghc-hetmet.git diff --git a/mk/suffix.mk b/mk/suffix.mk index 60308b3..ade0255 100644 --- a/mk/suffix.mk +++ b/mk/suffix.mk @@ -16,6 +16,12 @@ .SUFFIXES: +# This declaration tells GNU make to delete the target if it has +# changed and the command which created it exited with a non-zero exit +# code. + +.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 @@ -101,7 +107,7 @@ endif # BootingViaC #----------------------------------------------------------------------------- # Happy Suffix Rules # -.PRECIOUS: %.hs +.SECONDARY: %.hs %.hs : %.ly $(HAPPY) $(HAPPY_OPTS) $< @@ -143,33 +149,58 @@ endif #----------------------------------------------------------------------------- # C-related suffix rules +ifeq "$(UseGhcForCc)" "YES" + %.$(way_)o : %.$(way_)s @$(RM) $@ - $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 ) + $(HC) $(GHC_CC_OPTS) -c $< -o $@ %.$(way_)o : %.c @$(RM) $@ - $(CC) $(CC_OPTS) -c $< -o $@ + $(HC) $(GHC_CC_OPTS) -c $< -o $@ %.$(way_)o : %.S @$(RM) $@ - $(CC) $(CC_OPTS) -c $< -o $@ + $(HC) $(GHC_CC_OPTS) -c $< -o $@ -#%.$(way_)s : %.c -# @$(RM) $@ -# $(CC) $(CC_OPTS) -S $< -o $@ +%.$(way_)s : %.c + @$(RM) $@ + $(HC) $(GHC_CC_OPTS) -S $< -o $@ -%.c : %.flex +else + +%.$(way_)o : %.$(way_)s @$(RM) $@ - $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 ) -%.c : %.lex + $(AS) $(AS_OPTS) -o $@ $< + +%.$(way_)o : %.c + @$(RM) $@ + $(CC) $(CC_OPTS) -c $< -o $@ + +%.$(way_)o : %.S @$(RM) $@ - $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 ) + $(CC) $(CC_OPTS) -c $< -o $@ + +%.$(way_)s : %.c + @$(RM) $@ + $(CC) $(CC_OPTS) -S $< -o $@ + +endif # stubs are automatically generated and compiled by GHC %_stub.$(way_)o: %.o @: +# ----------------------------------------------------------------------------- +# Flex/lex + +%.c : %.flex + @$(RM) $@ + $(FLEX) -t $(FLEX_OPTS) $< > $@ +%.c : %.lex + @$(RM) $@ + $(FLEX) -t $(FLEX_OPTS) $< > $@ + #----------------------------------------------------------------------------- # Yacc stuff @@ -278,5 +309,5 @@ endif # Preprocessor suffix rule % : %.pp - rm -f $@ + @$(RM) $@ $(CPP) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@