1 #################################################################################
5 # Suffix rules for fptools
7 #################################################################################
10 # This file contain the default suffix rules for all the fptools projects.
14 # No need to define .SUFFIXES because we don't use any suffix rules
15 # Instead we use gmake's pattern rules exlusively
19 # However, if $(way) is set then we have to define $(way_) and $(_way)
20 # from it in the obvious fashion.
21 # This must be done here (or earlier), but not in target.mk with the other
22 # way management, because the pattern rules in this file take a snapshot of
23 # the value of $(way_) and $(_way), and it's no good setting them later!
30 #-----------------------------------------------------------------------------
31 # Haskell Suffix Rules
35 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
40 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
45 $(HC) $(HC_OPTS) -C $< -o $@
49 $(HC) $(HC_OPTS) -C $< -o $@
51 %.$(way_)o : %.$(way_)hc
53 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
58 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
61 %.$(way_)s : %.$(way_)hc
63 $(HC) $(HC_OPTS) -S $< -o $@ -osuf $(subst .,,$(suffix $@))
72 # Here's an interesting rule!
73 # The .hi file depends on the .o file,
74 # so if the .hi file is dated earlier than the .o file (commonly the case,
75 # when interfaces are stable) this rule just makes sure that the .o file,
76 # is up to date. Then it does nothing to generate the .hi file from the
77 # .o file, because the act of making sure the .o file is up to date also
78 # updates the .hi file (if necessary).
80 %.$(way_)hi : %.$(way_)o
81 @if [ ! -f $@ ] ; then \
82 echo Panic! $< exists, but $@ does not. \
87 %.$(way_)hi : %.$(way_)hc
88 @if [ ! -f $@ ] ; then \
89 echo Panic! $< exists, but $@ does not. \
94 #-----------------------------------------------------------------------------
100 $(HAPPY) $(HAPPY_OPTS) $<
102 #-----------------------------------------------------------------------------
109 #-----------------------------------------------------------------------------
110 # Green-card Suffix Rules
114 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
117 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
119 #-----------------------------------------------------------------------------
120 # C-related suffix rules
122 %.$(way_)o : %.$(way_)s
124 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
128 $(CC) $(CC_OPTS) -c $< -o $@
132 $(CC) $(CC_OPTS) -c $< -o $@
136 # $(CC) $(CC_OPTS) -S $< -o $@
140 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
143 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
145 # stubs are automatically generated and compiled by GHC
149 #-----------------------------------------------------------------------------
152 %.tab.c %.tab.h : %.y
153 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
154 $(YACC) $(YACC_OPTS) $<
155 $(MV) y.tab.c $*.tab.c
157 $(MV) y.tab.h $*.tab.h
161 #-----------------------------------------------------------------------------
162 # Runtest rules for calling $(HC) on a single-file Haskell program
165 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
167 #-----------------------------------------------------------------------------
168 # Doc processing suffix rules
170 # ToDo: make these more robust
177 @$(RM) $*.tex $*.verb-t.tex
179 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
188 fig2dev -L latex $< $@
190 #-----------------------------------------------------------------------------
195 expand $< | $(SGMLVERB) > $@
199 $(SGML2DVI) $(SGML2DVI_OPTS) $<
203 $(SGML2PS) $(SGML2PS_OPTS) $<
207 $(SGML2HTML) $(SGML2HTML_OPTS) $<
211 $(SGML2PS) $(SGML2PS_OPTS) $<
215 $(SGML2RTF) $(SGML2RTF_OPTS) $<
217 #-----------------------------------------------------------------------------
218 # Literate suffix rules
222 $(UNLIT) $(UNLIT_OPTS) $< $@
227 $(UNLIT) $(UNLIT_OPTS) $< $@
232 $(UNLIT) $(UNLIT_OPTS) $< $@
235 #-----------------------------------------------------------------------------
236 # Win32 resource files
238 # The default is to use the GNU resource compiler.