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) $<
103 $(HAPPY) $(HAPPY_OPTS) $<
105 #-----------------------------------------------------------------------------
106 # hsc2hs Suffix Rules
108 %.hs.c %.hs.h %.hs : %.hsc
111 #-----------------------------------------------------------------------------
118 #-----------------------------------------------------------------------------
119 # Green-card Suffix Rules
125 $(GREENCARD) $(GC_OPTS) $< -o $@
128 $(GREENCARD) $(GC_OPTS) $< -o $@
131 $(CPP) $(GC_CPP_OPTS) $< | perl -pe 's#\\n#\n#g' > $@
133 #-----------------------------------------------------------------------------
134 # C-related suffix rules
136 %.$(way_)o : %.$(way_)s
138 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
142 $(CC) $(CC_OPTS) -c $< -o $@
146 $(CC) $(CC_OPTS) -c $< -o $@
150 # $(CC) $(CC_OPTS) -S $< -o $@
154 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
157 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
159 # stubs are automatically generated and compiled by GHC
163 #-----------------------------------------------------------------------------
166 %.tab.c %.tab.h : %.y
167 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
168 $(YACC) $(YACC_OPTS) $<
169 $(MV) y.tab.c $*.tab.c
171 $(MV) y.tab.h $*.tab.h
175 #-----------------------------------------------------------------------------
176 # Runtest rules for calling $(HC) on a single-file Haskell program
179 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
181 #-----------------------------------------------------------------------------
182 # Doc processing suffix rules
184 # ToDo: make these more robust
191 @$(RM) $*.tex $*.verb-t.tex
193 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
202 fig2dev -L latex $< $@
204 #-----------------------------------------------------------------------------
209 $(SGML2DVI) $(SGML2DVI_OPTS) $<
213 $(SGML2PS) $(SGML2PS_OPTS) $<
217 $(SGML2HTML) $(SGML2HTML_OPTS) $<
221 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
222 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
223 $(HACHA) $(HACHA_OPTS) $(patsubst %.tex,%.html,$<)
224 # Run HeVeA twice to resolve labels
228 $(SGML2RTF) $(SGML2RTF_OPTS) $<
230 #-----------------------------------------------------------------------------
231 # Literate suffix rules
235 $(UNLIT) $(UNLIT_OPTS) $< $@
240 $(UNLIT) $(UNLIT_OPTS) $< $@
245 $(UNLIT) $(UNLIT_OPTS) $< $@
248 #-----------------------------------------------------------------------------
249 # Win32 resource files
251 # The default is to use the GNU resource compiler.
254 %.$(way_)o : %.$(way_)rc