diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm |
Initial commit
Diffstat (limited to 'web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm')
-rw-r--r-- | web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm new file mode 100644 index 0000000000..ad1fe6d2b7 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm @@ -0,0 +1,290 @@ +%************************************************************************ +%* * +\section[mkworld-suffix-rules]{Default stuff for suffix rules} +%* * +%************************************************************************ + +We are keen on suffix rules, rather than pattern rules, because not +all makes do the latter. Sigh. + +Suffix rules come in three blobs: (1)~the unavoidable ones [few]; +(2)~the ``always for this project'' ones [turn-off-able]; and (3)~the +per-Jmakefile ones (you must ``ask for'' these in each Jmakefile where +you need them. + +%************************************************************************ +%* * +\subsection[mkworld-suffix-macros]{Macros for making up suffix rules} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-literate]{Suffix-rule macros for literate stuff} +%* * +%************************************************************************ + +The following rule generator assumes the @beforesuff->aftersuff@ is +known to the literate programming system. + +\begin{code} +#ifndef LitSuffixRule +#define LitSuffixRule(beforesuff,aftersuff) @@\ +CAT2(beforesuff,aftersuff): @@\ + $(RM) $@ @@\ + $(LIT2PGM) $(LIT2PGMFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itxi: @@\ + $(RM) $@ @@\ + $(LIT2TEXI) -c $(LIT2TEXIFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itex: @@\ + $(RM) $@ @@\ + $(LIT2LATEX) -c $(LIT2LATEXFLAGS) -o $@ $< @@\ + @chmod 444 $@ +#endif /* LitSuffixRule */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-C]{Suffix-rule macros for C} +%* * +%************************************************************************ + +For objects in libraries: these rules are invoked when you want to +override some default suffix rules. +\begin{code} +#ifndef NormalLibraryObjectRule +#define NormalLibraryObjectRule() @@\ +.c.o: @@\ + RemoveTarget ($@) @@\ + $(CC) -c $(CFLAGS) $*.c +#endif +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-Haskell]{Suffix-rule macros for Haskell} +%* * +%************************************************************************ + +There are several varying flavours of Haskell-related suffix rules; +each such ``set'' of suffix rules should include...: + +\begin{verbatim} +.o -> .hi # hacky pseudo-dependency to mk .hi file if non-existent +.lhs -> .o +.hs -> .o +\end{verbatim} + +This is the {\em default}; a project or setup could override it. +\begin{code} +#ifndef HaskellSuffixRules +#define HaskellSuffixRules() @@\ +SuffixRule_o_hi() @@\ +SuffixRule_lhs_o() @@\ +SuffixRule_hs_o() +#endif /* !HaskellSuffixRules */ +\end{code} + +We use the internal mkworld CPP macro +@_body_HaskellCompileWithSpecifiedFlags@, which is shared w/ other +mkworld stuff. This keeps the magic to exactly one place. + +\begin{code} +#ifndef SuffixRule_o_hi +#define SuffixRule_o_hi() @@\ +.o.hi: @@\ + @if [ ! -f $@ ] ; then \ @@\ + echo $(RM) $< ; \ @@\ + $(RM) $< ; \ @@\ + set +e ; \ @@\ + echo $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + fi +#endif /* !SuffixRule_o_hi */ +\end{code} + +\begin{code} +#ifndef SuffixRule_hs_o +#define SuffixRule_hs_o() @@\ +.hs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,hs,-c $(HCFLAGS)) +#endif /* !SuffixRule_hs_o */ + +#ifndef SuffixRule_lhs_o +#define SuffixRule_lhs_o() @@\ +.lhs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,lhs,-c $(HCFLAGS)) +#endif /* !SuffixRule_lhs_o */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-doc]{Suffix-rule macros for document processing} +%* * +%************************************************************************ + +You have to ask for these. + +\begin{code} +#ifndef DocProcessingSuffixRules +#define DocProcessingSuffixRules() @@\ +.tex.dvi: @@\ + $(RM) $@ @@\ + $(LTX) $< @@\ + @@\ +.verb.tex: @@\ + $(RM) $*.tex @@\ + expand $*.verb | $(VERBATIM) > $*.tex @@\ + @@\ +.tib.tex: @@\ + $(RM) $*.tex $*.verb-t.tex @@\ + $(TIB) $*.tib @@\ + expand $*.tib-t.tex | $(VERBATIM) > $*.tex @@\ + $(RM) $*.tib-t.tex @@\ + @@\ +.fig.ps: @@\ + $(RM) $@ @@\ + fig2dev -L ps $< $@ @@\ + @@\ +.fig.tex: @@\ + $(RM) $@ @@\ + fig2dev -L latex $< $@ + +#endif /* ! DocProcessingSuffixRules */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-suffix-rule-text]{Generate actual suffix-rule text} +%* * +%************************************************************************ + +\begin{code} +.SUFFIXES: .xdvi .ps .dvi .tex .fig .tib .verb .itex .itxi .lit \ + _p.o .o .s .hi .hc .lhc .lhs .hs \ + .prl .lprl \ + .sh .lsh \ + .c .lc .h .lh .lex .llex .y \ + .ljm .jm +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-general]{Suffix rules---very general ones} +%* * +%************************************************************************ + +\begin{code} +.s.o: + $(RM) $@ + $(AS) $(ASFLAGS) -o $@ $< || $(RM) $@ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-literate]{Suffix rules for literate programming} +%* * +%************************************************************************ + +The \tr{.ljm->.jm} rule isn't optional, because the mkworld system +uses it. + +\begin{code} +LitSuffixRule(.ljm,.jm) /* mkworld */ + +#if SuffixRules_WantLiterate == YES + +LitSuffixRule(.lit,/*none*/) /* no language really */ +LitSuffixRule(.lhs,.hs) /* Haskell */ +LitSuffixRule(.lhc,.hc) /* Haskell assembler (C) */ +LitSuffixRule(.lprl,.prl) /* Perl */ +LitSuffixRule(.lsh,.sh) /* Bourne shell */ +LitSuffixRule(.lc,.c) /* C */ +LitSuffixRule(.lh,.h) +LitSuffixRule(.llex,.lex) /* Lex */ + +/* extra rule... flex can't handle #line's yet */ +/* also: save the .lex file in case of some debugging need */ +.llex.c: + $(RM) $@ $*.lex $*.lex.save + $(LIT2PGM) $(LIT2PGMFLAGS) $< > $*.lex + $(FLEX) $*.lex && mv $*.lex $*.lex.save && mv lex.yy.c $*.c + +#endif /* SuffixRules_WantLiterate */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-C]{Suffix rules for C/lex/yacc programming} +%* * +%************************************************************************ + +See also the ``literate lex'' (llex) rule in the literate section, above. + +We don't support the \tr{.y.c} suffix rule; an explicit +@YaccRunWithExpectMsg@ is better. +\begin{code} +.y.c: + @echo please use an explicit "YaccRunWithExpectMsg" macro + +.lex.c: /* ToDo: should make it do flex */ + $(RM) $@ + $(LEX) -t $(LFLAGS) $< > $@ || ( $(RM) $@ && exit 1 ) +\end{code} + +NB: avoid \tr{-o <something>} because of braindead C compilers. +\begin{code} +#if CCompilerGroksMinusCMinusO == YES +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< -o $@ +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< -o $@ + +#else /* ! CCompilerGroksMinusCMinusO */ +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +#endif /* ! CCompilerGroksMinusCMinusO */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-haskell]{Suffix rules for Haskell programming} +%* * +%************************************************************************ + +Suffix rules for Haskell are {\em not} put in by default. A Jmakefile +must ask for one specifically, using one of the macros defined in +macros section, above (\sectionref{mkworld-suffix-macros-Haskell}). + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-docs]{Suffix rules for document processing (LaTeX/tib/fig/etc)} +%* * +%************************************************************************ + +\begin{code} +#if SuffixRules_WantDocProcessing == YES +DocProcessingSuffixRules() +#endif /* SuffixRules_WantDocProcessing */ +\end{code} |