My book structure is like:
book.tex chapter/ch1.tex /ch2.tex ref/ch1.bib /ch2.bib
As each chapter of my book is required to has its own reference thus I used
chapterbib package and fed each chapter tex file with corresponding bib file. Finally I could manage to compile the book as following bash commands:
xelatex book bibtex chapter/ch1 bibtex chapter/ch2 xelatex book xelatex book
Now my question is that, how could I compile the book by writing the Makefile? My current script does no work at all.
TEXFILE := book CHAPTERDIR := chapter CHAPTERS := $(wildcard $(CHAPTERDIR)/*.tex) TEXENGINE=xelatex BIBTEX=bibtex BUILDTEX=$(TEXENGINE) $(TEXFILE) all: $(BUILDTEX) $(shell for chapterSrc in $(CHAPTERS); do \ chapterSrcName=$(shell basename $(chapterSrc) .tex); \ $(BIBTEX) $(CHAPTERDIR)/$(chapterSrcName); \ done) $(BUILDTEX) $(BUILDTEX)