projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-12-05 23:49:43 by mthomas]
[ghc-hetmet.git]
/
mk
/
suffix.mk
diff --git
a/mk/suffix.mk
b/mk/suffix.mk
index
8ec5acb
..
96834fc
100644
(file)
--- a/
mk/suffix.mk
+++ b/
mk/suffix.mk
@@
-16,6
+16,12
@@
.SUFFIXES:
.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
# 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
@@
-35,40
+41,48
@@
endif
# this case.
ifneq "$(BootingFromHc)" "YES"
# this case.
ifneq "$(BootingFromHc)" "YES"
-%.$(way_)o : %.hs
+# The $(odir) support is for building GHC, where we need to build three
+# different versions from the same sources. See ghc/compiler/Makefile.
+ifneq "$(odir)" ""
+odir_ = $(odir)/
+else
+odir_ =
+endif
+
+$(odir_)%.$(way_)o : %.hs
$(HC_PRE_OPTS)
$(HC_PRE_OPTS)
- $(HC) $(HC_OPTS) -c $< -o $@
+ $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi
$(HC_POST_OPTS)
$(HC_POST_OPTS)
-%.$(way_)o : %.lhs
+$(odir_)%.$(way_)o : %.lhs
$(HC_PRE_OPTS)
$(HC_PRE_OPTS)
- $(HC) $(HC_OPTS) -c $< -o $@
+ $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi
$(HC_POST_OPTS)
$(HC_POST_OPTS)
-%.$(way_)hc : %.lhs
+$(odir_)%.$(way_)hc : %.lhs
$(RM) $@
$(HC) $(HC_OPTS) -C $< -o $@
$(RM) $@
$(HC) $(HC_OPTS) -C $< -o $@
-%.$(way_)hc : %.hs
+$(odir_)%.$(way_)hc : %.hs
$(RM) $@
$(HC) $(HC_OPTS) -C $< -o $@
$(RM) $@
$(HC) $(HC_OPTS) -C $< -o $@
-%.$(way_)o : %.$(way_)hc
+$(odir_)%.$(way_)o : %.$(way_)hc
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -c $< -o $@
$(HC_POST_OPTS)
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -c $< -o $@
$(HC_POST_OPTS)
-%.$(way_)o : %.hc
+$(odir_)%.$(way_)o : %.hc
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -c $< -o $@
$(HC_POST_OPTS)
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -c $< -o $@
$(HC_POST_OPTS)
-%.$(way_)s : %.$(way_)hc
+$(odir_)%.$(way_)s : %.$(way_)hc
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -S $< -o $@
$(HC_POST_OPTS)
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -S $< -o $@
$(HC_POST_OPTS)
-%.$(way_)hc : %.lhc
+$(odir_)%.$(way_)hc : %.lhc
@$(RM) $@
$(UNLIT) $< $@
@chmod 444 $@
@$(RM) $@
$(UNLIT) $< $@
@chmod 444 $@
@@
-89,7
+103,7
@@
ifneq "$(BootingFromHc)" "YES"
else exit 0 ; \
fi
else exit 0 ; \
fi
-%.$(way_)hi : %.$(way_)hc
+$(odir_)%.$(way_)hi : %.$(way_)hc
@if [ ! -f $@ ] ; then \
echo Panic! $< exists, but $@ does not.; \
exit 1; \
@if [ ! -f $@ ] ; then \
echo Panic! $< exists, but $@ does not.; \
exit 1; \
@@
-101,7
+115,7
@@
endif # BootingViaC
#-----------------------------------------------------------------------------
# Happy Suffix Rules
#
#-----------------------------------------------------------------------------
# Happy Suffix Rules
#
-.PRECIOUS: %.hs
+.SECONDARY: %.hs
%.hs : %.ly
$(HAPPY) $(HAPPY_OPTS) $<
%.hs : %.ly
$(HAPPY) $(HAPPY_OPTS) $<
@@
-143,33
+157,58
@@
endif
#-----------------------------------------------------------------------------
# C-related suffix rules
#-----------------------------------------------------------------------------
# C-related suffix rules
-%.$(way_)o : %.$(way_)s
+ifeq "$(UseGhcForCc)" "YES"
+
+$(odir_)%.$(way_)o : %.$(way_)s
@$(RM) $@
@$(RM) $@
- $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
+ $(HC) $(GHC_CC_OPTS) -c $< -o $@
-%.$(way_)o : %.c
+$(odir_)%.$(way_)o : %.c
@$(RM) $@
@$(RM) $@
- $(CC) $(CC_OPTS) -c $< -o $@
+ $(HC) $(GHC_CC_OPTS) -c $< -o $@
-%.$(way_)o : %.S
+$(odir_)%.$(way_)o : %.S
@$(RM) $@
@$(RM) $@
- $(CC) $(CC_OPTS) -c $< -o $@
+ $(HC) $(GHC_CC_OPTS) -c $< -o $@
+
+$(odir_)%.$(way_)s : %.c
+ @$(RM) $@
+ $(HC) $(GHC_CC_OPTS) -S $< -o $@
-#%.$(way_)s : %.c
-# @$(RM) $@
-# $(CC) $(CC_OPTS) -S $< -o $@
+else
-%.c : %.flex
+$(odir_)%.$(way_)o : %.$(way_)s
@$(RM) $@
@$(RM) $@
- $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
-%.c : %.lex
+ $(AS) $(AS_OPTS) -o $@ $<
+
+$(odir_)%.$(way_)o : %.c
@$(RM) $@
@$(RM) $@
- $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
+ $(CC) $(CC_OPTS) -c $< -o $@
+
+$(odir_)%.$(way_)o : %.S
+ @$(RM) $@
+ $(CC) $(CC_OPTS) -c $< -o $@
+
+$(odir_)%.$(way_)s : %.c
+ @$(RM) $@
+ $(CC) $(CC_OPTS) -S $< -o $@
+
+endif
# stubs are automatically generated and compiled by GHC
%_stub.$(way_)o: %.o
@:
# 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
#-----------------------------------------------------------------------------
# Yacc stuff
@@
-228,6
+267,8
@@
endif
# $(JADE) -t sgml -V html-index -d $(SGMLSTYLESHEET) -c $(DOCBOOK_CATALOG) $<
# $(PERL) $(COLLATEINDEX) -N -o index.sgml
$(SGML2HTML) $(SGML2HTML_OPTS) $<
# $(JADE) -t sgml -V html-index -d $(SGMLSTYLESHEET) -c $(DOCBOOK_CATALOG) $<
# $(PERL) $(COLLATEINDEX) -N -o index.sgml
$(SGML2HTML) $(SGML2HTML_OPTS) $<
+# touch the .html file so that it is seen to be built
+ @touch $@
%.html : %.tex
@$(RM) $@
%.html : %.tex
@$(RM) $@
@@
-276,5
+317,5
@@
endif
# Preprocessor suffix rule
% : %.pp
# Preprocessor suffix rule
% : %.pp
- rm -f $@
- $(CPP) -I$(GHC_INCLUDE_DIR) -x c $< | $(SED) -e '/^#/d' > $@
+ @$(RM) $@
+ $(CPP) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@