-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
7sDream
committed
Feb 24, 2018
1 parent
5cbd027
commit 677e324
Showing
4 changed files
with
38 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,46 @@ | ||
SOURCE := scp.tex | ||
VERSION := $(shell sed -n '/vhEntry/{n;p;}' changelog.tex | tail -n 1 | sed -nr 's/^\{([^}]+)\}.*/\1/p') | ||
LATEXMKFLAG := -quiet -xelatex | ||
OUTDIR := build | ||
LATEXMKOUTDIR := -jobname=build | ||
LATEXMKOUTDIR := -jobname= | ||
|
||
$(info !!! Current version: ${VERSION}) | ||
|
||
scp.pdf: | ||
$(info !!! Building test version: $@ ...) | ||
scp.pdf: $(BUILDDIR) | ||
$(info !!! Building test version: $ ...) | ||
latexmk $(LATEXMKFLAG) ${SOURCE} | ||
|
||
checkclean: | ||
$(info !!! Checking if git repo is clean...) | ||
@git diff --exit-code > /dev/null | ||
@git diff --cached --exit-code > /dev/null | ||
|
||
define build | ||
$(info !!! Set target to $(1)) | ||
@sed -i -r -e 's/targetdevice\{(.*)\}/targetdevice{$(1)}/g' ${SOURCE} | ||
$(info !!! Set font to $(2)) | ||
@sed -i -r -e 's/targetfonts\{(.*)\}/targetfonts{$(2)}/g' ${SOURCE} | ||
$(info !!! Building $@ ...) | ||
latexmk $(LATEXMKFLAG) $(LATEXMKOUTDIR)/$(3) ${SOURCE} | ||
git checkout -- $(SOURCE) | ||
mv $(OUTDIR)/$(3).pdf $(OUTDIR)/$(3) | ||
find $(OUTDIR) -type f -not -name "*.pdf" -delete | ||
$(info !!! Set font to $(2)) | ||
@sed -r -e 's/targetdevice\{(.*)\}/targetdevice{$(1)}/g' -e 's/targetfonts\{(.*)\}/targetfonts{$(2)}/g' ${SOURCE} > $(3).tex | ||
$(info !!! Building $(3) ...) | ||
@latexmk $(LATEXMKFLAG) $(LATEXMKOUTDIR)$(3) $(3).tex | ||
@mv $(3).pdf $(3) | ||
rm $(3).tex | ||
endef | ||
|
||
scp.pc.notofira.$(VERSION).pdf: checkclean | ||
scp.pc.notofira.$(VERSION).pdf: $(BUILDDIR) | ||
$(call build,pc,notofira,$@) | ||
|
||
scp.pc.sarasa.$(VERSION).pdf: checkclean | ||
scp.pc.sarasa.$(VERSION).pdf: $(BUILDDIR) | ||
$(call build,pc,sarasa,$@) | ||
|
||
scp.kindle.notofira.$(VERSION).pdf: checkclean | ||
scp.kindle.notofira.$(VERSION).pdf: $(BUILDDIR) | ||
$(call build,kindle,notofira,$@) | ||
|
||
scp.kindle.sarasa.$(VERSION).pdf: checkclean | ||
scp.kindle.sarasa.$(VERSION).pdf: $(BUILDDIR) | ||
$(call build,kindle,sarasa,$@) | ||
|
||
$(OUTDIR): | ||
@mkdir -p $(OUTDIR) | ||
$(BUILDDIR): | ||
@mkdir -p $(BUILDDIR) | ||
|
||
all: scp.pc.notofira.$(VERSION).pdf scp.pc.sarasa.$(VERSION).pdf scp.kindle.notofira.$(VERSION).pdf scp.kindle.sarasa.$(VERSION).pdf | ||
|
||
clean: | ||
git clean -dfX | ||
|
||
cleanpdf: | ||
-rm *.pdf | ||
|
||
cleanall: clean cleanpdf | ||
|
||
all: $(OUTDIR) scp.pc.notofira.$(VERSION).pdf scp.pc.sarasa.$(VERSION).pdf scp.kindle.notofira.$(VERSION).pdf scp.kindle.sarasa.$(VERSION).pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
% ===== 页面整体格式控制 ===== | ||
|
||
% 工具包 | ||
\usepackage{etoolbox} | ||
|
||
% 页面设置 | ||
\input{preamble/page_\targetdevice} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters