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=tex $<
199 $(SGML2LATEX) -m --output=dvi $<
201 # Not yet: we already have a %.ps : %.dvi rule, this one would conflict.
204 # $(SGML2LATEX) -m --output=ps $<
218 #-----------------------------------------------------------------------------
219 # Literate suffix rules
221 # ToDo: somehow macroize this lot. (if only!)
225 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
230 $(LIT2TEXT) $(LIT2TEXT_OPTS) -o $@ $<
235 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
240 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
244 # Produce stand-alone TEX documents
248 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
253 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
258 $(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $@ $<
263 $(LIT2TEXI) $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.texi,$@) $<
264 $(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.lhs,%.texi,$<)
269 $(MAKEINFO) $(MAKEINFO_OPTS) $< && $(POSTMAKEINFO) $@
273 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
278 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
283 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
288 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
292 $(LIT2LATEX) -S -c $(LIT2LATEX_OPTS) -o $@ $<
293 $(HC) $(HC_OPTS) -c $< -o $@
298 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
303 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
308 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
312 # Temporary, until either unlit is lifted out of ghc/
313 # or literate is properly set up locally -- SOF
317 $(UNLIT) $(UNLIT_OPTS) $< $@
322 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
327 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
332 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
337 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
342 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
347 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
352 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
362 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
367 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
372 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
382 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
387 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
392 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
397 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
402 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
407 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
412 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<