-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
150 lines (129 loc) · 5.18 KB
/
Makefile
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
## ********************************************************************* ##
## Copyright 2016 ##
## Jack Green, Nick Chura ##
## ##
## This file is part of the Mount Hood Community College ##
## Precalculus Project ##
## ##
## ********************************************************************* ##
#######################
# DO NOT EDIT THIS FILE
#######################
# 1) Make a copy of Makefile.paths.original
# as Makefile.paths, which git will ignore
# 2) Edit Makefile.paths as directed there
# 3) The files Makefile and Makefile.paths.original
# are managed by git revision control and edits will conflict
##############
# 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
# 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 $(PRJSRC)/precalc2-MHCC.xml
# HTML output
# Output lands in the subdirectory: $(HTMLOUT)
html:
install -d $(HTMLOUT)
-rm $(HTMLOUT)/*.html
-rm $(HTMLOUT)/knowl/*.html
cp -a $(IMAGESOUT) $(HTMLOUT)
cd $(HTMLOUT); \
xsltproc -xinclude --stringparam webwork.server $(SERVER) --stringparam html.knowl.example no --stringparam html.knowl.exercise.inline yes $(MBXSL)/mathbook-html.xsl $(PRJSRC)/precalc2-MHCC.xml
# 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) $(PRJSRC)/precalc2-MHCC.xml
# 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 $(PRJSRC)/precalc2-MHCC.xml
# 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 $(PRJSRC)/precalc2-MHCC.xml; \
# 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
cd $(PDFOUT); \
xsltproc -xinclude --stringparam webwork.server.latex $(PDFOUT)/webwork-tex/ $(MBXSL)/mathbook-latex.xsl $(PRJSRC)/precalc2-MHCC.xml; \
xelatex precalc2-MHCC.tex; \
xelatex precalc2-MHCC.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 $(PRJSRC)/precalc2-MHCC.xml 2> $(OUTPUT)/dtderrors.txt
less $(OUTPUT)/dtderrors.txt