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 HC_SPLIT_POST = touch $@
38 HC_PRE__ = $(patsubst %,$(HC_SPLIT_PRE) ; ,$(filter -split-objs,$(HC_OPTS)))
39 HC_POST__ = $(patsubst %,$(HC_SPLIT_POST) ; ,$(filter -split-objs,$(HC_OPTS)))
41 SRC_HC_POST += $(HC_POST__)
42 SRC_HC_PRE += $(HC_PRE__)
46 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
51 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
56 $(HC) $(HC_OPTS) -C $< -o $@
60 $(HC) $(HC_OPTS) -C $< -o $@
62 %.$(way_)o : %.$(way_)hc
64 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
73 # Here's an interesting rule!
74 # The .hi file depends on the .o file,
75 # so if the .hi file is dated earlier than the .o file (commonly the case,
76 # when interfaces are stable) this rule just makes sure that the .o file,
77 # is up to date. Then it does nothing to generate the .hi file from the
78 # .o file, because the act of making sure the .o file is up to date also
79 # updates the .hi file (if necessary).
81 %.$(way_)hi : %.$(way_)o
82 @if [ ! -f $@ ] ; then \
83 echo Panic! $< exists, but $@ does not. \
88 %.$(way_)hi : %.$(way_)hc
89 @if [ ! -f $@ ] ; then \
90 echo Panic! $< exists, but $@ does not. \
95 #-----------------------------------------------------------------------------
101 $(HAPPY) $(HAPPY_OPTS) -g $<
103 #-----------------------------------------------------------------------------
110 #-----------------------------------------------------------------------------
111 # Green-card Suffix Rules
115 $(GREENCARD) $(GREENCARD_OPTS) $<
117 #-----------------------------------------------------------------------------
118 # C-related suffix rules
120 %.$(way_)o : %.$(way_)s
122 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
126 $(CC) $(CC_OPTS) -c $< -o $@
130 # $(CC) $(CC_OPTS) -S $< -o $@
134 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
137 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
139 #-----------------------------------------------------------------------------
142 %.tab.c %.tab.h : %.y
143 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
144 $(YACC) $(YACC_OPTS) $<
145 $(MV) y.tab.c $*.tab.c
147 $(MV) y.tab.h $*.tab.h
151 #-----------------------------------------------------------------------------
152 # Runtest rules for calling $(HC) on a single-file Haskell program
155 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
157 #-----------------------------------------------------------------------------
158 # Doc processing suffix rules
160 # ToDo: make these more robust
172 expand $*.verb | $(VERBATIM) > $*.tex
175 @$(RM) $*.tex $*.verb-t.tex
177 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
186 fig2dev -L latex $< $@
188 #-----------------------------------------------------------------------------
191 # make sure these don't conflict with the literate rules!
195 expand $*.vsgml | $(SGMLVERB) > $@
199 $(SGML2LATEX) -m --output=tex $<
203 $(SGML2LATEX) -m --output=dvi $<
205 # Not yet: we already have a %.ps : %.dvi rule, this one would conflict.
208 # $(SGML2LATEX) -m --output=ps $<
222 #-----------------------------------------------------------------------------
223 # Literate suffix rules
225 # ToDo: somehow macroize this lot. (if only!)
229 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
234 $(LIT2TEXT) $(LIT2TEXT_OPTS) -o $@ $<
239 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
244 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
248 # Produce stand-alone TEX documents
252 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
257 $(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
262 $(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $@ $<
267 $(LIT2TEXI) $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.texi,$@) $<
268 $(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.lhs,%.texi,$<)
273 $(MAKEINFO) $(MAKEINFO_OPTS) $< && $(POSTMAKEINFO) $@
277 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
282 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
287 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
292 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
296 $(LIT2LATEX) -S -c $(LIT2LATEX_OPTS) -o $@ $<
297 $(HC) $(HC_OPTS) -c $< -o $@
302 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
307 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
312 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
316 # Temporary, until either unlit is lifted out of ghc/
317 # or literate is properly set up locally -- SOF
321 $(UNLIT) $(UNLIT_OPTS) $< $@
326 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
331 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
336 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
341 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
346 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
351 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
356 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
366 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
371 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
376 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
386 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
391 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
396 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
401 $(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
406 $(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
411 $(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
416 $(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<