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
34 $(RM) $@ ; if [ ! -d $(basename $@) ]; then mkdir $(basename $@); else \
35 find $(basename $@) -name '*.$(way_)o' -print | xargs $(RM) __rm_food ; fi
36 HASKELL_SPLIT_POST= touch $@
37 HASKELL_PRE_COMPILE=$(patsubst %,$(HASKELL_SPLIT_PRE),$(filter -split-objs,$(HC_OPTS)))
38 HASKELL_POST_COMPILE=$(patsubst %,$(HASKELL_SPLIT_POST),$(filter -split-objs,$(HC_OPTS)))
41 $(HASKELL_PRE_COMPILE)
42 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
43 $(HASKELL_POST_COMPILE)
46 $(HASKELL_PRE_COMPILE)
47 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
48 $(HASKELL_POST_COMPILE)
52 $(HC) $(HC_OPTS) -C $< -o $@
56 $(HC) $(HC_OPTS) -C $< -o $@
58 %.$(way_)o : %.$(way_)hc
59 $(HASKELL_PRE_COMPILE)
60 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
61 $(HASKELL_POST_COMPILE)
69 # Here's an interesting rule!
70 # The .hi file depends on the .o file,
71 # so if the .hi file is dated earlier than the .o file (commonly the case,
72 # when interfaces are stable) this rule just makes sure that the .o file,
73 # is up to date. Then it does nothing to generate the .hi file from the
74 # .o file, because the act of making sure the .o file is up to date also
75 # updates the .hi file (if necessary).
77 %.$(way_)hi : %.$(way_)o
78 @if [ ! -f $@ ] ; then \
79 echo Panic! $< exists, but $@ does not. \
84 %.$(way_)hi : %.$(way_)hc
85 @if [ ! -f $@ ] ; then \
86 echo Panic! $< exists, but $@ does not. \
91 #-----------------------------------------------------------------------------
97 $(HAPPY) $(HAPPY_OPTS) -g $<
99 #-----------------------------------------------------------------------------
106 #-----------------------------------------------------------------------------
107 # Green-card Suffix Rules
111 $(GREENCARD) $(GREENCARD_OPTS) $<
113 #-----------------------------------------------------------------------------
114 # C-related suffix rules
116 %.$(way_)o : %.$(way_)s
118 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
122 $(CC) $(CC_OPTS) -c $< -o $@
126 # $(CC) $(CC_OPTS) -S $< -o $@
130 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
133 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
135 #-----------------------------------------------------------------------------
138 %.tab.c %.tab.h : %.y
139 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
140 $(YACC) $(YACC_OPTS) $<
141 $(MV) y.tab.c $*.tab.c
143 $(MV) y.tab.h $*.tab.h
147 #-----------------------------------------------------------------------------
148 # Runtest rules for calling $(HC) on a single-file Haskell program
151 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
153 #-----------------------------------------------------------------------------
154 # Doc processing suffix rules
156 # ToDo: make these more robust
168 expand $*.verb | $(VERBATIM) > $*.tex
171 @$(RM) $*.tex $*.verb-t.tex
173 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
182 fig2dev -L latex $< $@
184 #-----------------------------------------------------------------------------
187 # make sure these don't conflict with the literate rules!
191 expand $*.verb | $(SGMLVERB) > $@
195 $(SGML2LATEX) -m --output=dvi $<
209 #-----------------------------------------------------------------------------
210 # Literate suffix rules
212 # ToDo: somehow macroize this lot. (if only!)
216 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
221 $(LIT2TEXT) $(LIT2TEXT_OPTS) -o $@ $<
226 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
231 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
235 # Produce stand-alone TEX documents
239 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
244 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
249 $(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $@ $<
254 $(LIT2TEXI) $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.texi,$@) $<
255 $(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.lhs,%.texi,$<)
260 $(MAKEINFO) $(MAKEINFO_OPTS) $< && $(POSTMAKEINFO) $@
264 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
269 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
274 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
279 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
283 $(LIT2LATEX) -S -c $(LIT2LATEX_OPTS) -o $@ $<
284 $(HC) $(HC_OPTS) -c $< -o $@
289 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
294 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
299 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
303 # Temporary, until either unlit is lifted out of ghc/
304 # or literate is properly set up locally -- SOF
308 $(UNLIT) $(UNLIT_OPTS) $< $@
313 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
318 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
323 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
328 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
333 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
338 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
343 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
353 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
358 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
363 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
373 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
378 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
383 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
388 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
393 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
398 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
403 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<