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_OPTS += $(HC_POST__)
42 SRC_HC_PRE_OPTS += $(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 $@))
69 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
72 %.$(way_)s : %.$(way_)hc
74 $(HC) $(HC_OPTS) -S $< -o $@ -osuf $(subst .,,$(suffix $@))
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. \
105 #-----------------------------------------------------------------------------
111 $(HAPPY) $(HAPPY_OPTS) $<
113 #-----------------------------------------------------------------------------
120 #-----------------------------------------------------------------------------
121 # Green-card Suffix Rules
125 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
128 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
130 #-----------------------------------------------------------------------------
131 # C-related suffix rules
133 %.$(way_)o : %.$(way_)s
135 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
139 $(CC) $(CC_OPTS) -c $< -o $@
143 $(CC) $(CC_OPTS) -c $< -o $@
147 # $(CC) $(CC_OPTS) -S $< -o $@
151 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
154 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
156 #-----------------------------------------------------------------------------
159 %.tab.c %.tab.h : %.y
160 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
161 $(YACC) $(YACC_OPTS) $<
162 $(MV) y.tab.c $*.tab.c
164 $(MV) y.tab.h $*.tab.h
168 #-----------------------------------------------------------------------------
169 # Runtest rules for calling $(HC) on a single-file Haskell program
172 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
174 #-----------------------------------------------------------------------------
175 # Doc processing suffix rules
177 # ToDo: make these more robust
184 @$(RM) $*.tex $*.verb-t.tex
186 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
195 fig2dev -L latex $< $@
197 #-----------------------------------------------------------------------------
202 expand $< | $(SGMLVERB) > $@
206 $(SGML2DVI) $(SGML2DVI_OPTS) $<
210 $(SGML2PS) $(SGML2PS_OPTS) $<
214 $(SGML2HTML) $(SGML2HTML_OPTS) $<
218 $(SGML2INFO) $(SGML2INFO_OPTS) $<
222 $(SGML2RTF) $(SGML2RTF_OPTS) $<
224 #-----------------------------------------------------------------------------
225 # Literate suffix rules
229 $(UNLIT) $(UNLIT_OPTS) $< $@
234 $(UNLIT) $(UNLIT_OPTS) $< $@
239 $(UNLIT) $(UNLIT_OPTS) $< $@
242 #-----------------------------------------------------------------------------
243 # Win32 resource files
245 # The default is to use the GNU resource compiler.