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 ifeq "$(SplitObjs)" "YES"
39 HC_PRE__ = $(HC_SPLIT_PRE) ;
40 HC_POST__ = $(HC_SPLIT_POST) ;
43 SRC_HC_POST_OPTS += $(HC_POST__)
44 SRC_HC_PRE_OPTS += $(HC_PRE__)
48 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
53 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
58 $(HC) $(HC_OPTS) -C $< -o $@
62 $(HC) $(HC_OPTS) -C $< -o $@
64 %.$(way_)o : %.$(way_)hc
66 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
71 $(HC) $(HC_OPTS) -c $< -o $@ -osuf $(subst .,,$(suffix $@))
74 %.$(way_)s : %.$(way_)hc
76 $(HC) $(HC_OPTS) -S $< -o $@ -osuf $(subst .,,$(suffix $@))
85 # Here's an interesting rule!
86 # The .hi file depends on the .o file,
87 # so if the .hi file is dated earlier than the .o file (commonly the case,
88 # when interfaces are stable) this rule just makes sure that the .o file,
89 # is up to date. Then it does nothing to generate the .hi file from the
90 # .o file, because the act of making sure the .o file is up to date also
91 # updates the .hi file (if necessary).
93 %.$(way_)hi : %.$(way_)o
94 @if [ ! -f $@ ] ; then \
95 echo Panic! $< exists, but $@ does not. \
100 %.$(way_)hi : %.$(way_)hc
101 @if [ ! -f $@ ] ; then \
102 echo Panic! $< exists, but $@ does not. \
107 #-----------------------------------------------------------------------------
113 $(HAPPY) $(HAPPY_OPTS) $<
115 #-----------------------------------------------------------------------------
122 #-----------------------------------------------------------------------------
123 # Green-card Suffix Rules
127 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
130 $(GREENCARD) $(GREENCARD_OPTS) $< -o $@
132 #-----------------------------------------------------------------------------
133 # C-related suffix rules
135 %.$(way_)o : %.$(way_)s
137 $(AS) $(AS_OPTS) -o $@ $< || ( $(RM) $@ && exit 1 )
141 $(CC) $(CC_OPTS) -c $< -o $@
145 $(CC) $(CC_OPTS) -c $< -o $@
149 # $(CC) $(CC_OPTS) -S $< -o $@
153 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
156 $(FLEX) -t $(FLEX_OPTS) $< > $@ || ( $(RM) $@ && exit 1 )
158 #-----------------------------------------------------------------------------
161 %.tab.c %.tab.h : %.y
162 @$(RM) $*.tab.h $*.tab.c y.tab.c y.tab.h y.output
163 $(YACC) $(YACC_OPTS) $<
164 $(MV) y.tab.c $*.tab.c
166 $(MV) y.tab.h $*.tab.h
170 #-----------------------------------------------------------------------------
171 # Runtest rules for calling $(HC) on a single-file Haskell program
174 $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $<
176 #-----------------------------------------------------------------------------
177 # Doc processing suffix rules
179 # ToDo: make these more robust
186 @$(RM) $*.tex $*.verb-t.tex
188 expand $*.tib-t.tex | $(VERBATIM) > $*.tex
197 fig2dev -L latex $< $@
199 #-----------------------------------------------------------------------------
204 expand $< | $(SGMLVERB) > $@
208 $(SGML2DVI) $(SGML2DVI_OPTS) $<
212 $(SGML2PS) $(SGML2PS_OPTS) $<
216 $(SGML2HTML) $(SGML2HTML_OPTS) $<
220 $(SGML2INFO) $(SGML2INFO_OPTS) $<
224 $(SGML2RTF) $(SGML2RTF_OPTS) $<
226 #-----------------------------------------------------------------------------
227 # Literate suffix rules
231 $(UNLIT) $(UNLIT_OPTS) $< $@
236 $(UNLIT) $(UNLIT_OPTS) $< $@
241 $(UNLIT) $(UNLIT_OPTS) $< $@
244 #-----------------------------------------------------------------------------
245 # Win32 resource files
247 # The default is to use the GNU resource compiler.