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 # This declaration tells GNU make to delete the target if it has
20 # changed and the command which created it exited with a non-zero exit
25 # However, if $(way) is set then we have to define $(way_) and $(_way)
26 # from it in the obvious fashion.
27 # This must be done here (or earlier), but not in target.mk with the other
28 # way management, because the pattern rules in this file take a snapshot of
29 # the value of $(way_) and $(_way), and it's no good setting them later!
36 #-----------------------------------------------------------------------------
37 # Haskell Suffix Rules
39 # Turn off all the Haskell suffix rules if we're booting from .hc
40 # files. The file bootstrap.mk contains alternative suffix rules in
42 ifneq "$(BootingFromHc)" "YES"
46 $(HC) $(HC_OPTS) -c $< -o $@
51 $(HC) $(HC_OPTS) -c $< -o $@
56 $(HC) $(HC_OPTS) -C $< -o $@
60 $(HC) $(HC_OPTS) -C $< -o $@
62 %.$(way_)o : %.$(way_)hc
64 $(HC) $(HC_OPTS) -c $< -o $@
69 $(HC) $(HC_OPTS) -c $< -o $@
72 %.$(way_)s : %.$(way_)hc
74 $(HC) $(HC_OPTS) -S $< -o $@
83 # Here's an interesting rule!
84 # The .hi file depends on the .o file,
85 # so if the .hi file is dated earlier than the .o file (commonly the case,
86 # when interfaces are stable) this rule just makes sure that the .o file,
87 # is up to date. Then it does nothing to generate the .hi file from the
88 # .o file, because the act of making sure the .o file is up to date also
89 # updates the .hi file (if necessary).
91 %.$(way_)hi : %.$(way_)o
92 @if [ ! -f $@ ] ; then \
93 echo Panic! $< exists, but $@ does not.; \
98 %.$(way_)hi : %.$(way_)hc
99 @if [ ! -f $@ ] ; then \
100 echo Panic! $< exists, but $@ does not.; \
107 #-----------------------------------------------------------------------------
113 $(HAPPY) $(HAPPY_OPTS) $<
116 $(HAPPY) $(HAPPY_OPTS) $<
118 #-----------------------------------------------------------------------------
119 # hsc2hs Suffix Rules
121 ifneq "$(BootingFromHc)" "YES"
122 %_hsc.c %_hsc.h %.hs : %.hsc
123 $(HSC2HS) $(HSC2HS_OPTS) $<
124 @touch $(patsubst %.hsc,%_hsc.c,$<)
127 #-----------------------------------------------------------------------------
134 #-----------------------------------------------------------------------------
135 # Green-card Suffix Rules
141 $(GREENCARD) $(GC_OPTS) $< -o $@
144 $(GREENCARD) $(GC_OPTS) $< -o $@
147 $(CPP) $(GC_CPP_OPTS) $< | perl -pe 's#\\n#\n#g' > $@
149 #-----------------------------------------------------------------------------
150 # C-related suffix rules
152 ifeq "$(UseGhcForCc)" "YES"
154 %.$(way_)o : %.$(way_)s
156 $(HC) $(GHC_CC_OPTS) -c $< -o $@
160 $(HC) $(GHC_CC_OPTS) -c $< -o $@
164 $(HC) $(GHC_CC_OPTS) -c $< -o $@
168 $(HC) $(GHC_CC_OPTS) -S $< -o $@
172 %.$(way_)o : %.$(way_)s
174 $(AS) $(AS_OPTS) -o $@ $<
178 $(CC) $(CC_OPTS) -c $< -o $@
182 $(CC) $(CC_OPTS) -c $< -o $@
186 $(CC) $(CC_OPTS) -S $< -o $@
190 # stubs are automatically generated and compiled by GHC
194 # -----------------------------------------------------------------------------
199 $(FLEX) -t $(FLEX_OPTS) $< > $@
202 $(FLEX) -t $(FLEX_OPTS) $< > $@
204 #-----------------------------------------------------------------------------
207 %.tab.c %.tab.h : %.y
208 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
209 $(YACC) $(YACC_OPTS) $<
210 $(MV) y.tab.c $*.tab.c
212 $(MV) y.tab.h $*.tab.h
216 #-----------------------------------------------------------------------------
217 # Runtest rules for calling $(HC) on a single-file Haskell program
220 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
222 #-----------------------------------------------------------------------------
223 # Doc processing suffix rules
225 # ToDo: make these more robust
232 @$(RM) $*.tex $*.verb-t.tex
234 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
243 fig2dev -L latex $< $@
245 #-----------------------------------------------------------------------------
250 $(SGML2DVI) $(SGML2DVI_OPTS) $<
254 $(SGML2PS) $(SGML2PS_OPTS) $<
258 # $(PERL) $(COLLATEINDEX) -N -o index.sgml
259 # $(JADE) -t sgml -V html-index -d $(SGMLSTYLESHEET) -c $(DOCBOOK_CATALOG) $<
260 # $(PERL) $(COLLATEINDEX) -N -o index.sgml
261 $(SGML2HTML) $(SGML2HTML_OPTS) $<
262 # touch the .html file so that it is seen to be built
267 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
268 $(HEVEA) $(HEVEA_OPTS) $(patsubst %.tex,%.hva,$<) $<
269 $(HACHA) $(HACHA_OPTS) $(patsubst %.tex,%.html,$<)
270 # Run HeVeA twice to resolve labels
274 $(SGML2RTF) $(SGML2RTF_OPTS) $<
278 $(SGML2PDF) $(SGML2PDF_OPTS) $<
280 #-----------------------------------------------------------------------------
281 # Literate suffix rules
285 $(UNLIT) $(UNLIT_OPTS) $< $@
290 $(UNLIT) $(UNLIT_OPTS) $< $@
295 $(UNLIT) $(UNLIT_OPTS) $< $@
298 #-----------------------------------------------------------------------------
299 # Win32 resource files
301 # The default is to use the GNU resource compiler.
304 %.$(way_)o : %.$(way_)rc
308 #-----------------------------------------------------------------------------
309 # Preprocessor suffix rule
313 $(CPP) $(CPP_OPTS) -x c $< | $(SED) -e '/^#/d' > $@