# *Sample* Makefile for filksongs # $Id: Makefile.txt,v 1.2 2006-05-22 01:17:03 steve Exp $ # # Targets: # all: *.flk -> *.ps (or all PR=.lj for laserjet) # 1song: older way to print a song or group # PR = .ps #PR = .lj # Publish directory: PUBDIR = /usr/local/starport/Web/Public/Steve_Savitzky/TeX # Wildcard expansion requires GNU make. #SONGS = $(wildcard [a-z]*.flk) SONGS = alphabet.flk world.flk PRINT = $(subst .flk,$(PR),$(SONGS)) PS = $(subst .flk,.ps,$(SONGS)) HTML = $(subst .flk,.html,$(SONGS)) TEXT = $(subst .flk,.txt,$(SONGS)) INDICES = .htaccess 0List.html 0Index.html DOCS = flktran.html # What to publish: PUBFILES = $(SONGS) $(HTML) $(PS) $(INDICES) $(DOCS) \ flktran.pl index.pl chord.c Makefile.txt \ song.sty fullpage.sty twocolumns.sty 1song.tex zongbook.sty # Utility programs: FLKTRAN = flktran.pl INDEX = index.pl ######################################################################## ### ### Rules: ### .SUFFIXES: .tex .dvi .flk .txt .lj .ps .html # tex to dvi: # the "echo q" bit quits out of the error dialog if necessary; # running latex twice makes sure the auxiliary files are up to date. .tex.dvi: echo q | latex $* if [ -f $*.toc ]; then echo q | latex $*; fi rm $*.log .dvi.lj: dvilj $*.dvi .dvi.ps: dvips -o $*.ps $*.dvi # flk to HTML, Text .flk.html: perl flktran.pl -t $* $*.html .flk.txt: perl flktran.pl $* $*.txt # flk to tex: # Strictly speaking this isn't necessary; you shouldn't rebuild # foo.tex every time foo.flk changes. But it's much simpler. # The style stuff should be in a header file. .flk.tex: echo '\documentstyle[12pt,song,twocolumns,zongbook]{article}' > $@ echo '\begin{document}' >> $@ echo '\file{'$*.flk'}' >> $@ echo '\end{document}' >> $@ #.flk.txt: # chord < $*.flk > $@ ######################################################################## ### ### Targets ### all:: $(PRINT) html: $(FLKTRAN) $(HTML) text: $(FLKTRAN) $(TEXT) postscript: $(PS) ps: $(PS) indices: $(INDICES) pubfiles: $(PUBFILES) publish: published $(PUBDIR): mkdir $(PUBDIR) put: published cd $(PUBDIR); make put # Debugging: excluded: @echo $(EXCLUDE) included: @echo $(SONGS) # Copy stuff to the publish directory. # We need to check each file to see if it is already published, # since we might have done a clean since then. published: $(PUBDIR) $(PUBFILES) @for f in $? ; do ( \ { [ -f $(PUBDIR)/$$f ] && cmp -s $$f $(PUBDIR)/$$f; } \ || ( cp $$f $(PUBDIR); echo " published $$f" ); \ grep -qs $$f $(PUBDIR)/.cvsignore || \ echo $$f >> $(PUBDIR)/.cvsignore \ ) done date > published 1song.dvi: song.sty $(SONGS) zongbook.dvi: song.sty zongbook.sty $(SONGS) texclean: -rm *.aux *.log *.toc *.dvi clean :: -rm *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ .emacs_* tags TAGS MakeOut *.odf *_ins.h \ *.aux *.log *.toc *.dvi *.lj *.ps -rm -f $(HTML) -rm -f $(TEXT) pubclean:: -rm -f $(HTML) -rm -f $(TEXT) $(INDICES) #specific files: Makefile.txt: Makefile cp Makefile Makefile.txt world.flk: ../Songs/world.flk cp ../Songs/world.flk . # Indices: .htaccess: $(SONGS) $(INDEX) -dsc -o $@ $(SONGS) 0List.html: $(SONGS) Makefile ../TeX/index.pl @echo '' > $@ @echo '' >> $@ @echo 'Song List' >> $@ @echo '' >> $@ @echo '

Song List

' >> $@ $(INDEX) -h $(SONGS) >> $@ @echo '
Automatically generated by a Makefile
' >> $@ @echo '
Last update: ' `date` '
' >> $@ @echo '' >> $@ @echo '' >> $@ 0Index.html: $(SONGS) Makefile ../TeX/index.pl @echo '' > $@ @echo '' >> $@ @echo 'Song Index' >> $@ @echo '' >> $@ @echo '

Song Index

' >> $@ $(INDEX) -t -h $(SONGS) >> $@ @echo '
Automatically generated by a Makefile
' >> $@ @echo '
Last update: ' `date` '
' >> $@ @echo '' >> $@ @echo '' >> $@