-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
171 lines (147 loc) · 5.87 KB
/
Makefile
File metadata and controls
171 lines (147 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
## ********************************************************************* ##
## Copyright 2016 ##
## David Farmer, Greg Hartman, Alex Jordan, Carly Vollet ##
## ##
## This file is part of APEX Calculus ##
## ##
## ********************************************************************* ##
#######################
# DO NOT EDIT THIS FILE
#######################
# 1) Make a copy of Makefile.paths.original
# as Makefile.paths, which git will ignore.
# 2) Edit Makefile.paths to provide full paths to the root folders
# of your local clones of the project repository and the mathbook
# repository as described below.
# 3) The files Makefile and Makefile.paths.original
# are managed by git revision control and any edits you make to
# these will conflict. You should only be editing Makefile.paths.
##############
# Introduction
##############
# This is not a "true" makefile, since it does not
# operate on dependencies. It is more of a shell
# script, sharing common configurations
######################
# System Prerequisites
######################
# install (system tool to make directories)
# xsltproc (xml/xsl text processor)
# xmllint (only to check source against DTD)
# <helpers> (PDF viewer, web browser, pager, Sage executable, etc)
#####
# Use
#####
# A) Navigate to the location of this file
# B) At command line: make <some-target-from-the-options-below>
# The included file contains customized versions
# of locations of the principal components of this
# project and names of various helper executables
include Makefile.paths
# These paths are subdirectories of
# the project distribution
PRJSRC = $(PRJ)/src
OUTPUT = $(PRJ)/output
STYLE = $(PRJ)/style
IMGSRC = $(PRJSRC)/images
# The project's main hub file
MAINFILE = $(PRJSRC)/index.mbx
# The project's styling files
CSS = $(STYLE)/css/apex.css
# These paths are subdirectories of
# the Mathbook XML distribution
# MBUSR is where extension files get copied
# so relative paths work properly
MBXSL = $(MB)/xsl
MBUSR = $(MB)/user
DTD = $(MB)/schema/dtd
# These paths are subdirectories of
# the scratch directory
PGOUT = $(OUTPUT)/pg
HTMLOUT = $(OUTPUT)/html
PDFOUT = $(OUTPUT)/pdf
IMAGESOUT = $(OUTPUT)/images
# Some aspects of producing these examples require a WeBWorK server.
# For all but trivial testing or examples, please look into setting
# up your own WeBWorK server, or consult Alex Jordan about the use
# of PCC's server in a nontrivial capacity. <alex.jordan@pcc.edu>
SERVER = https://webwork.pcc.edu
# Write out each WW problem as a standalone problem in PGML ready
# for use on a WW server. "def" files and "header" files are
# produced. Directories and filenames are derived from titles of
# chapters, sections, etc., in addition to the titles of the
# problems themselves.
#
# Results land in the subdirectory: $(PGOUT)/local
#
pg:
install -d $(PGOUT)
cd $(PGOUT); \
xsltproc -xinclude --stringparam chunk.level 2 $(MBXSL)/mathbook-webwork-archive.xsl $(MAINFILE)
# HTML output
# Output lands in the subdirectory: $(HTMLOUT)
html:
install -d $(HTMLOUT)
-rm $(HTMLOUT)/*.html
-rm $(HTMLOUT)/knowl/*.html
cp -a $(IMGSRC) $(HTMLOUT)
cp -a $(IMAGESOUT) $(HTMLOUT)
cd $(HTMLOUT); \
xsltproc -xinclude --stringparam webwork.server $(SERVER) --stringparam html.knowl.exercise.inline no --stringparam html.knowl.example no $(MBXSL)/mathbook-html.xsl $(MAINFILE)
# make all the image files in svg format
images:
install -d $(IMAGESOUT)
-rm $(IMAGESOUT)/*.svg
$(MB)/script/mbx -c latex-image -f svg -d $(IMAGESOUT) $(MAINFILE)
$(MB)/script/mbx -c sageplot -f svg -d $(IMAGESOUT) $(MAINFILE)
# $(MB)/script/mbx -c asymptote -f svg -d $(IMAGESOUT) $(MAINFILE)
# make all the image files in pdf format
pdfimages:
install -d $(IMAGESOUT)
-rm $(IMAGESOUT)/*.pdf
$(MB)/script/mbx -c sageplot -f pdf -d $(IMAGESOUT) $(MAINFILE)
# for pdf output, a one-time prerequisite for LaTeX conversion of
# problems living on a server, and image construction at server
# our "webwork-tex" is a subdirectory of where the PDF is compiled
# -s specifies an existing WW server to use (ignore security warnings)
webwork-server-tex:
install -d $(PDFOUT)/webwork-tex
$(MB)/script/mbx -v -c webwork-tex -s $(SERVER) -d $(PDFOUT)/webwork-tex $(MAINFILE)
# LaTeX for print
# see prerequisite just above
# the "webwork-tex" directory must be given here
# [note trailing slash (subject to change)]
latex:
install -d $(PDFOUT)
-rm $(PDFOUT)/*.tex
cd $(PDFOUT); \
xsltproc -xinclude --stringparam webwork.server.latex $(PDFOUT)/webwork-tex/ $(MBXSL)/mathbook-latex.xsl $(MAINFILE) \
# PDF for print
# see prerequisite just above
# the "webwork-tex" directory must be given here
# [note trailing slash (subject to change)]
pdf:
install -d $(PDFOUT)
-rm $(PDFOUT)/*.tex
cp -a $(IMAGESOUT)/*.pdf $(PDFOUT)/images
cp -a $(IMGSRC)/*.pdf $(PDFOUT)/images
cd $(PDFOUT); \
xsltproc -xinclude --stringparam webwork.server.latex $(PDFOUT)/webwork-tex/ --stringparam exercise.text.hint no --stringparam exercise.text.solution no --stringparam exercise.text.answer no $(MBXSL)/mathbook-latex.xsl $(MAINFILE); \
xelatex index.tex; \
xelatex index.tex
###########
# Utilities
###########
# Verify Source integrity
# Leaves "dtderrors.txt" in OUTPUT
# can then grep on, e.g.
# "element XXX:"
# "does not follow"
# "Element XXXX content does not follow"
# "No declaration for"
# Automatically invokes the "less" pager, could configure as $(PAGER)
check:
install -d $(OUTPUT)
-rm $(OUTPUT)/dtderrors.*
-xmllint --xinclude --postvalid --noout --dtdvalid $(DTD)/mathbook.dtd $(MAINFILE) 2> $(OUTPUT)/dtderrors.txt
less $(OUTPUT)/dtderrors.txt