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
33 # Turn off all the Haskell suffix rules if we're booting from .hc
34 # files. The file bootstrap.mk contains alternative suffix rules in
36 ifneq "$(BootingFromHc)" "YES"
40 $(HC) $(HC_OPTS) -c $< -o $@
45 $(HC) $(HC_OPTS) -c $< -o $@
50 $(HC) $(HC_OPTS) -C $< -o $@
54 $(HC) $(HC_OPTS) -C $< -o $@
56 %.$(way_)o : %.$(way_)hc
58 $(HC) $(HC_OPTS) -c $< -o $@
63 $(HC) $(HC_OPTS) -c $< -o $@
66 %.$(way_)s : %.$(way_)hc
68 $(HC) $(HC_OPTS) -S $< -o $@
77 # Here's an interesting rule!
78 # The .hi file depends on the .o file,
79 # so if the .hi file is dated earlier than the .o file (commonly the case,
80 # when interfaces are stable) this rule just makes sure that the .o file,
81 # is up to date. Then it does nothing to generate the .hi file from the
82 # .o file, because the act of making sure the .o file is up to date also
83 # updates the .hi file (if necessary).
85 %.$(way_)hi : %.$(way_)o
86 @if [ ! -f $@ ] ; then \
87 echo Panic! $< exists, but $@ does not.; \
92 %.$(way_)hi : %.$(way_)hc
93 @if [ ! -f $@ ] ; then \
94 echo Panic! $< exists, but $@ does not.; \
101 #-----------------------------------------------------------------------------
107 $(HAPPY) $(HAPPY_OPTS) $<
110 $(HAPPY) $(HAPPY_OPTS) $<
112 #-----------------------------------------------------------------------------
113 # hsc2hs Suffix Rules
115 ifneq "$(BootingFromHc)" "YES"
116 %_hsc.c %_hsc.h %.hs : %.hsc
117 $(HSC2HS) $(HSC2HS_OPTS) $<
118 @touch $(patsubst %.hsc,%_hsc.c,$<)
121 #-----------------------------------------------------------------------------
128 #-----------------------------------------------------------------------------
129 # Green-card Suffix Rules
135 $(GREENCARD) $(GC_OPTS) $< -o $@
138 $(GREENCARD) $(GC_OPTS) $< -o $@
141 $(CPP) $(GC_CPP_OPTS) $< | perl -pe 's#\\n#\n#g' > $@
143 #-----------------------------------------------------------------------------
144 # C-related suffix rules
146 %.$(way_)o : %.$(way_)s
148 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
152 $(CC) $(CC_OPTS) -c $< -o $@
156 $(CC) $(CC_OPTS) -c $< -o $@
160 # $(CC) $(CC_OPTS) -S $< -o $@
164 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
167 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
169 # stubs are automatically generated and compiled by GHC
173 #-----------------------------------------------------------------------------
176 %.tab.c %.tab.h : %.y
177 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
178 $(YACC) $(YACC_OPTS) $<
179 $(MV) y.tab.c $*.tab.c
181 $(MV) y.tab.h $*.tab.h
185 #-----------------------------------------------------------------------------
186 # Runtest rules for calling $(HC) on a single-file Haskell program
189 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
191 #-----------------------------------------------------------------------------
192 # Doc processing suffix rules
194 # ToDo: make these more robust
201 @$(RM) $*.tex $*.verb-t.tex
203 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
212 fig2dev -L latex $< $@
214 #-----------------------------------------------------------------------------
219 $(SGML2DVI) $(SGML2DVI_OPTS) $<
223 $(SGML2PS) $(SGML2PS_OPTS) $<
227 # $(PERL) $(COLLATEINDEX) -N -o index.sgml
228 # $(JADE) -t sgml -V html-index -d $(SGMLSTYLESHEET) -c $(DOCBOOK_CATALOG) $<
229 # $(PERL) $(COLLATEINDEX) -N -o index.sgml
230 $(SGML2HTML) $(SGML2HTML_OPTS) $<
231 # touch the .html file so that it is seen to be built
236 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
237 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
238 $(HACHA) $(HACHA_OPTS) $(patsubst %.tex,%.html,$<)
239 # Run HeVeA twice to resolve labels
243 $(SGML2RTF) $(SGML2RTF_OPTS) $<
247 $(SGML2PDF) $(SGML2PDF_OPTS) $<
249 #-----------------------------------------------------------------------------
250 # Literate suffix rules
254 $(UNLIT) $(UNLIT_OPTS) $< $@
259 $(UNLIT) $(UNLIT_OPTS) $< $@
264 $(UNLIT) $(UNLIT_OPTS) $< $@
267 #-----------------------------------------------------------------------------
268 # Win32 resource files
270 # The default is to use the GNU resource compiler.
273 %.$(way_)o : %.$(way_)rc
277 #-----------------------------------------------------------------------------
278 # Preprocessor suffix rule
282 $(CPP) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@