1 2include config.mk 3 4main := src/Main.lhs 5psources := $(main) src/TeXCommands.lhs src/TeXParser.lhs \ 6 src/Typewriter.lhs src/Math.lhs src/MathPoly.lhs \ 7 src/MathCommon.lhs src/NewCode.lhs \ 8 src/Directives.lhs src/HsLexer.lhs src/FileNameUtils.lhs \ 9 src/Parser.lhs src/FiniteMap.lhs src/Auxiliaries.lhs \ 10 src/StateT.lhs src/Document.lhs src/Verbatim.lhs src/Value.lhs \ 11 src/License.lhs src/State.lhs 12sources := $(psources) src/Version.lhs 13snipssrc := sorts.snip id.snip cata.snip spec.snip 14snips := sorts.tt sorts.math id.math cata.math spec.math 15objects := $(sources:.lhs=.o) 16sections := $(sources:.lhs=.tex) 17 18MKINSTDIR := ./mkinstalldirs 19 20### 21### lhs dependencies (from %include lines) 22### 23 24ifdef SORT 25ifdef UNIQ 26 27MKLHSDEPEND = $(GREP) "^%include " $< \ 28 | $(SED) -e 's,^%include ,$*.tex : ,' \ 29 | $(SORT) | $(UNIQ) > $*.ld 30 31MKFMTDEPEND = $(GREP) "^%include " $< \ 32 | $(SED) -e 's,^%include ,$*.fmt : ,' \ 33 | $(SORT) | $(UNIQ) > $*.ld 34 35endif 36endif 37 38### 39### dependency postprocessing 40### 41 42DEPPOSTPROC = $(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ 43 -e '/^$$/ d' -e 's/$$/ :/' 44 45### 46### default targets 47### 48 49.PHONY : default xdvi gv print install backup clean all depend bin doc srcdist 50 51all : default 52 53default : bin doc 54bin : lhs2TeX lhs2TeX.fmt lhs2TeX.sty 55 56-include $(sources:%.lhs=%.d) 57 58# I don't understand this ... (ks) 59# 60# %.hi : %.o 61# @if [ ! -f $@ ] ; then \ 62# echo $(RM) $< ; \ 63# $(RM) $< ; \ 64# set +e ; \ 65# echo $(MAKE) $(notdir $<) ; \ 66# $(MAKE) $(notdir $<) ; \ 67# if [ $$? -ne 0 ] ; then \ 68# exit 1; \ 69# fi ; \ 70# fi 71 72ifdef MKLHSDEPEND 73 74%.ld : %.lhs 75 $(MKLHSDEPEND); \ 76 $(CP) $*.ld $*.ldd; \ 77 $(DEPPOSTPROC) < $*.ldd >> $*.ld; \ 78 $(RM) -f $*.ldd 79 80%.ld : %.fmt 81 $(MKFMTDEPEND); \ 82 $(CP) $*.ld $*.ldd; \ 83 $(DEPPOSTPROC) < $*.ldd >> $*.ld; \ 84 $(RM) -f $*.ldd 85 86-include $(sources:%.lhs=%.ld) 87 88endif 89 90%.tex : %.lhs lhs2TeX Lhs2TeX.fmt lhs2TeX.fmt 91# lhs2TeX -verb -iLhs2TeX.fmt $< > $@ 92 ./lhs2TeX --math --align 33 -iLhs2TeX.fmt $< > $@ 93 94%.tt : %.snip lhs2TeX lhs2TeX.fmt 95 ./lhs2TeX --tt -lmeta=True -ilhs2TeX.fmt $< > $@ 96 97%.math : %.snip lhs2TeX lhs2TeX.fmt 98 ./lhs2TeX --math --align 33 -lmeta=True -ilhs2TeX.fmt $< > $@ 99 100%.tex : %.lit lhs2TeX 101 ./lhs2TeX --verb -ilhs2TeX.fmt $< > $@ 102 103 104lhs2TeX.sty: lhs2TeX.sty.lit lhs2TeX 105 ./lhs2TeX --code lhs2TeX.sty.lit > lhs2TeX.sty 106lhs2TeX.fmt: lhs2TeX.fmt.lit lhs2TeX 107 ./lhs2TeX --code lhs2TeX.fmt.lit > lhs2TeX.fmt 108 109lhs2TeX : $(sources) 110 $(GHC) $(GHCFLAGS) -isrc --make -o lhs2TeX $(main) 111 112doc : bin 113 cd doc; $(MAKE) 114# cd Guide; $(MAKE) Guide.pdf 115 116INSTALL : lhs2TeX INSTALL0 INSTALL1 117 cp INSTALL0 $@ 118 ./lhs2TeX --searchpath >> $@ 119 cat INSTALL1 >> $@ 120 121depend: 122 $(GHC) -M -optdep-f -optdeplhs2TeX.d $(GHCFLAGS) $(sources) 123 $(RM) -f lhs2TeX.d.bak 124 125lhs2TeX-includes : lhs2TeX.sty $(sections) $(snips) lhs2TeX.sty.tex lhs2TeX.fmt.tex Makefile.tex 126 127Lhs2TeX.dvi : lhs2TeX-includes 128Lhs2TeX.pdf : lhs2TeX-includes 129 130xdvi : Lhs2TeX.dvi 131 $(XDVI) -s 3 Lhs2TeX.dvi & 132 133gv : Lhs2TeX.ps 134 $(GV) Lhs2TeX.ps & 135 136print : Lhs2TeX.dvi 137 $(DVIPS) -D600 -f Lhs2TeX.dvi | lpr -Pa -Zl 138 139install : bin doc 140 $(MKINSTDIR) $(DESTDIR)$(bindir) 141 $(INSTALL) -m 755 lhs2TeX $(DESTDIR)$(bindir) 142 $(MKINSTDIR) $(DESTDIR)$(stydir) 143 $(INSTALL) -m 644 lhs2TeX.sty lhs2TeX.fmt $(DESTDIR)$(stydir) 144 $(INSTALL) -m 644 Library/*.fmt $(DESTDIR)$(stydir) 145 $(MKINSTDIR) $(DESTDIR)$(docdir) 146 $(INSTALL) -m 644 doc/Guide2.pdf $(DESTDIR)$(docdir) 147 $(MKINSTDIR) $(DESTDIR)$(mandir)/man1 148 $(INSTALL) -m 644 lhs2TeX.1 $(DESTDIR)$(mandir)/man1 149ifeq ($(INSTALL_POLYTABLE),yes) 150# install polytable package 151 $(MKINSTDIR) $(DESTDIR)$(polydir) 152 $(INSTALL) -m 644 polytable/*.sty $(DESTDIR)$(polydir) 153endif 154 # $(MKINSTDIR) $(DESTDIR)$(texdir) 155 # $(INSTALL) -m 644 Library/*.sty $(DESTDIR)$(texdir) 156ifndef DESTDIR 157 $(MKTEXLSR) 158else 159 echo "Please update the TeX filename database." 160endif 161 162srcdist : INSTALL doc 163 if test -d $(DISTDIR); then $(RM) -rf $(DISTDIR); fi 164 $(MKINSTDIR) $(DISTDIR) 165 $(MKINSTDIR) $(DISTDIR)/src 166 $(MKINSTDIR) $(DISTDIR)/doc 167 $(MKINSTDIR) $(DISTDIR)/polytable 168 $(MKINSTDIR) $(DISTDIR)/Testsuite 169 $(MKINSTDIR) $(DISTDIR)/Examples 170 $(MKINSTDIR) $(DISTDIR)/Library 171 $(INSTALL) -m 644 $(psources) src/Version.lhs.in $(DISTDIR)/src 172 $(INSTALL) -m 644 $(snipssrc) $(DISTDIR) 173 $(INSTALL) -m 644 Setup.hs lhs2tex.cabal $(DISTDIR) 174 $(INSTALL) -m 644 lhs2TeX.fmt.lit lhs2TeX.sty.lit $(DISTDIR) 175 $(INSTALL) -m 644 Makefile common.mk config.mk.in $(DISTDIR) 176 $(INSTALL) -m 644 lhs2TeX.1.in $(DISTDIR) 177 $(INSTALL) -m 755 configure mkinstalldirs install-sh $(DISTDIR) 178 $(INSTALL) -m 644 TODO AUTHORS LICENSE CHANGELOG.md $(DISTDIR) 179 cat INSTALL | sed -e "s/@ProgramVersion@/$(PACKAGE_VERSION)/" \ 180 > $(DISTDIR)/INSTALL 181 chmod 644 $(DISTDIR)/INSTALL 182 cd doc; $(MAKE) srcdist 183 $(INSTALL) -m 644 polytable/*.{sty,pdf} $(DISTDIR)/polytable 184 $(INSTALL) -m 644 Testsuite/*.{lhs,snip} Testsuite/Makefile $(DISTDIR)/Testsuite 185 $(INSTALL) -m 644 Examples/*.lhs $(DISTDIR)/Examples 186 $(INSTALL) -m 755 Examples/lhs2TeXpre $(DISTDIR)/Examples 187 $(INSTALL) -m 644 Library/*.fmt $(DISTDIR)/Library 188 tar --format=ustar -cvzf $(DISTDIR).tar.gz $(DISTDIR) 189 chmod 644 $(DISTDIR).tar.gz 190 191ifdef DISTTYPE 192 193bindist: lhs2TeX lhs2TeX.fmt lhs2TeX.sty doc 194 if test -d $(DISTDIR); then $(RM) -rf $(DISTDIR); fi 195 $(MKINSTDIR) $(DISTDIR) 196 $(MKINSTDIR) $(DISTDIR)/doc 197 $(MKINSTDIR) $(DISTDIR)/polytable 198 $(MKINSTDIR) $(DISTDIR)/Testsuite 199 $(MKINSTDIR) $(DISTDIR)/Examples 200 $(MKINSTDIR) $(DISTDIR)/Library 201 $(INSTALL) -m 755 lhs2TeX $(DISTDIR) 202 $(INSTALL) -m 644 lhs2TeX.fmt lhs2TeX.sty $(DISTDIR) 203 $(INSTALL) -m 644 $(psources) Version.lhs.in $(snipssrc) $(DISTDIR) 204 $(INSTALL) -m 644 lhs2TeX.fmt.lit lhs2TeX.sty.lit $(DISTDIR) 205 $(INSTALL) -m 644 Makefile common.mk config.mk.in $(DISTDIR) 206 $(INSTALL) -m 644 lhs2TeX.1.in $(DISTDIR) 207 $(INSTALL) -m 755 configure mkinstalldirs install-sh $(DISTDIR) 208 $(INSTALL) -m 644 TODO AUTHORS LICENSE CHANGELOG.md $(DISTDIR) 209 cat INSTALL | sed -e "s/@ProgramVersion@/$(PACKAGE_VERSION)/" \ 210 > $(DISTDIR)/INSTALL 211 chmod 644 $(DISTDIR)/INSTALL 212 cd doc; $(MAKE) srcdist 213 $(INSTALL) -m 644 polytable/*.{sty,pdf} $(DISTDIR)/polytable 214 $(INSTALL) -m 644 Testsuite/*.{lhs,snip} Testsuite/Makefile $(DISTDIR)/Testsuite 215 $(INSTALL) -m 644 Examples/*.lhs $(DISTDIR)/Examples 216 $(INSTALL) -m 755 Examples/lhs2TeXpre $(DISTDIR)/Examples 217 $(INSTALL) -m 644 Library/*.fmt $(DISTDIR)/Library 218 tar cvjf $(DISTDIR)-$(DISTTYPE).tar.bz2 $(DISTDIR) 219 chmod 644 $(DISTDIR)-$(DISTTYPE).tar.bz2 220 221else 222 223bindist: 224 @echo "You must define DISTTYPE." 225 226endif 227 228backup: 229 cd ..; \ 230 $(RM) -f Literate.tar Literate.tar.gz; \ 231 tar -cf Literate.tar Literate; \ 232 gzip Literate.tar; \ 233 chmod a+r Literate.tar.gz 234 235clean : 236# clean 237 $(RM) -f lhs2TeX $(sections) $(snips) $(objects) *.hi *.dvi *.ps 238 -$(RM) -f *.d *.dd *.ld *.ldd 239 $(RM) -f lhs2TeX.sty lhs2TeX.fmt 240 $(RM) -f Lhs2TeX.tex lhs2TeX.sty.tex lhs2TeX.fmt.tex Makefile.tex 241 cd doc; $(MAKE) clean 242 243# all: 244# $(MAKE) install 245# $(MAKE) Lhs2TeX.dvi 246 247include common.mk 248