# Makefile for separate chapters from the compendium of `Makt & Avmakt' # (C) 1998: Hans Georg Schaathun # $Id: Makefile,v 1.1 1998/05/09 13:58:59 georg Exp georg $ include makefile.include TEXINPUTS=.:..:../../styles: export TEXINPUTS CHDIR=Chapters TCHDIR=../Chapters STDIR=Stories TSTDIR=../Stories PDIR=Parts TPDIR=../Parts PARTS =$(filter-out $(wildcard $(TPDIR)/*.ch.tex),$(wildcard $(TPDIR)/*.tex)) CHAPTERS=$(filter-out $(wildcard $(TCHDIR)/*.ch.tex),$(wildcard $(TCHDIR)/*.tex)) STORIES=$(filter-out $(wildcard $(TSTDIR)/*.ch.tex),$(wildcard $(TSTDIR)/*.tex)) CHTEX =$(notdir $(CHAPTERS)) STTEX =$(notdir $(STORIES)) CHAUX =$(addprefix $(CHDIR)/,$(CHTEX:.tex=.aux)) PTEX =$(notdir $(PARTS)) PAUX =$(addprefix $(PDIR)/,$(PTEX:.tex=.aux)) AUXFILES=$(PAUX) $(CHAUX) Preface/front.aux AUXES =$(notdir $(AUXFILES)) TEXFILES=$(PTEX) $(CHTEX) $(STTEX) front.tex DVIFILES=$(TEXFILES:.tex=.dvi) PSFILES=$(TEXFILES:.tex=.ps) IDXFILES=$(TEXFILES:.tex=.idx) # *************************** # # ***** Targets ***** # # *************************** # .PHONY: all allchapters all: allchapters ps: $(PSFILES) # .tex ../Preface/front.tex $(TCHDIR)/%.tex $(TSTDIR)/%.tex $(TPDIR)/%.tex: @$(ECHO) [request] Nothing done for $@ front.tex: @$(ECHO) [patterns] Generating $@ using implicit rule. @$(ECHO) \\input\{preamble\} > $@ @$(ECHO) \\includeonly\{Preface/front\} >> $@ @$(ECHO) \\input\{main\} >> $@ %.tex: $(TPDIR)/%.tex @$(ECHO) [patterns] Generating $@ using implicit rule. @$(ECHO) \\input\{preamble\} > $@ @$(ECHO) \\includeonly\{Parts/$*\} >> $@ @$(ECHO) \\input\{main\} >> $@ %.tex: $(TSTDIR)/%.tex @$(ECHO) [patterns] Generating $@ using implicit rule. @$(ECHO) \\input\{preamble\} > $@ @$(ECHO) \\includeonly\{Stories/$*\} >> $@ @$(ECHO) \\input\{main\} >> $@ %.tex: $(TCHDIR)/%.tex @$(ECHO) [patterns] Generating $@ using implicit rule. @$(ECHO) \\input\{preamble\} > $@ @$(ECHO) \\includeonly\{Chapters/$*\} >> $@ @$(ECHO) \\input\{main\} >> $@ # .aux (Chapterwise) Preface/front.aux: front.tex ../Preface/front.tex $(TEX) $< $(STDIR)/%.aux: %.tex $(TSTDIR)/%.tex $(TEX) $< $(CHDIR)/%.aux: %.tex $(TCHDIR)/%.tex $(TEX) $< $(PDIR)/%.aux: %.tex $(TPDIR)/%.tex $(TEX) $< # .aux (main files) $(AUXES): front.toc $(AUXES): %.aux: %.tex $(TEX) $< # .dvi index.dvi: index.ind $(DVIFILES): %.dvi: %.tex %.aux $(TEX) $< # .ind .idx .toc front.toc: front.tex $(AUXFILES) $(TEX) $< index.ind: $(IDXFILES) $(MKIDX) -o $@ $(IDXFILES) # misc main.lst: ../main.tex @$(ECHO) "$< -> $@" @/usr/bin/sed -e'/\\include/s/.*\\include{.*\/\([^/}]*\)}.*/\1/gp' \ -e'/\\include/s/.*\\include{\([^}]*\)}.*/\1/gp' \ -e'd' $< > $@ allchapters: main.lst $(TEXFILES) ./makeall -make %.pre: %.tex $(TCHDIR)/%.tex $(TEX) $< # # Clean # .PHONY: clean cleanall distclean clean: -/bin/rm -f *.log *.aux *.dvi *.bak *~ *.lpr *.toc *.xlg -/bin/rm -f *.ind *.idx *.ilg main.lst -/bin/rm -f *.gmakelog *.gmakelogg *.glog logg g-log -/bin/rm -f Chapters/*.aux Parts/*.aux Preface/*.aux cleanall: clean distclean: cleanall -/bin/rm -f *.tex *.ps # End of Makefile