1
0
Fork 0

[#5] Separated Makefile into doc/ Makefile

closure/master
Mike Gerwitz 2011-06-05 11:58:33 -04:00
parent 309f799f78
commit 8fa10c494e
2 changed files with 113 additions and 97 deletions

101
Makefile
View File

@ -10,28 +10,7 @@ path_perf_test=${path_test}/perf
perf_tests := $(shell find "$(path_perf_test)" -name 'perf-*.js') perf_tests := $(shell find "$(path_perf_test)" -name 'perf-*.js')
path_doc=./doc path_doc := ./doc
path_doc_output=${path_build}/doc
path_doc_output_info=${path_doc_output}/easejs.info
path_doc_output_plain=${path_doc_output}/manual.txt
path_doc_output_html=${path_doc_output}/manual
path_doc_output_html1=${path_doc_output}/manual.html
path_doc_css=${path_doc}/manual.css
path_doc_img=${path_doc}/img
path_doc_css_ref=manual.css
path_manual_texi=${path_doc}/manual.texi
path_info_install := /usr/local/share/info
src_js := index.js $(wildcard $(path_lib)/*.js)
src_tests := index.js $(wildcard $(path_test)/test-*)
doc_src := $(wildcard $(path_doc)/*.texi)
doc_imgs := $(patsubst %.dia, %.png, $(wildcard $(path_doc_img)/*.dia))
doc_imgs_txt := $(patsubst %.dia, %.png, $(wildcard $(path_doc_img)/*.txt))
doc_replace := s/<\/body>/<script type="text\/javascript" \
src="highlight.pack.js"><\/script><script type="text\/javascript" \
src="interactive.js"><\/script><\/body>/
combine=${path_tools}/combine combine=${path_tools}/combine
@ -45,10 +24,6 @@ all: combine min doc
# create build dir # create build dir
$(path_build): $(path_build):
mkdir -p "$(path_build)" mkdir -p "$(path_build)"
$(path_doc_output):
mkdir -p "$(path_doc_output)"
mkbuild: $(path_build)
mkbuild-doc: $(path_doc_output)
# combine all modules into easily redistributable ease.js file (intended for # combine all modules into easily redistributable ease.js file (intended for
# browser) # browser)
@ -60,6 +35,8 @@ $(path_build)/browser-test.html: $(path_combine_output_full)
cp "$(path_browser_test)" "$(path_build)" cp "$(path_browser_test)" "$(path_build)"
combine: $(path_combine_output) $(path_build)/browser-test.html combine: $(path_combine_output) $(path_build)/browser-test.html
doc:
$(MAKE) -C $(path_doc)
test: default test: default
$(MAKE) -C $(path_test) $(MAKE) -C $(path_test)
@ -69,76 +46,6 @@ perf: default $(perf_tests)
perf-%.js: default perf-%.js: default
@node $@ @node $@
# generate texinfo documentation (twice to generate TOC), then remove the extra
# files that were generated
#
# generates: pdf, info, HTML (multiple pages), HTML (single page)
doc: | doc-pdf doc-info doc-plain doc-html
# doc images
doc/img/%.png: doc/img/%.dia
dia -e $@ -s 300x $<
# doc pdf
$(path_doc_output)/%.pdf: $(doc_src) $(doc_imgs) | mkbuild-doc doc-img
TEXINPUTS="$(path_doc):" \
pdftex -output-directory "${path_doc}" "${path_manual_texi}" && \
TEXINPUTS="$(path_doc):" \
pdftex -output-directory "${path_doc}" "${path_manual_texi}"
mv -f "${path_doc}"/*.pdf "${path_doc_output}"
cd "$(path_doc)" && rm -f $(shell cat "$(path_doc)/.gitignore")
# doc info
$(path_doc_output_info): $(doc_src) $(doc_imgs_txt) | mkbuild-doc
makeinfo -I "$(path_doc)" -o $@ "$(path_manual_texi)";
# doc plain text
$(path_doc_output_plain): $(doc_imgs_txt) | mkbuild-doc
makeinfo --plain -I "$(path_doc)" "${path_manual_texi}" > $@
# doc html (multiple pages)
$(path_doc_output_html)/index.html: $(doc_src) $(path_doc_css) \
| $(path_doc_output_html)/img $(path_doc_output_html)/interactive.js \
$(path_doc_output_html)/highlight.pack.js \
$(path_doc_output_html)/$(path_doc_css_ref) mkbuild-doc doc-img
makeinfo --html --css-ref="$(path_doc_css_ref)" \
-I "$(path_doc)" -o "${path_doc_output_html}" "${path_manual_texi}"
sed -i '$(doc_replace)' $(path_doc_output_html)/*.htm?
# doc html (single page)
$(path_doc_output_html1): $(doc_src) $(path_doc_css) \
| $(path_doc_output)/img $(path_doc_output)/interactive.js \
$(path_doc_output)/highlight.pack.js mkbuild-doc doc-img
makeinfo --no-split --html --css-include="${path_doc_css}" \
-I "$(path_doc)" -o - "${path_manual_texi}" \
| sed '$(doc_replace)' \
> "$(path_doc_output_html1)"
# doc images (in build dir)
$(path_doc_output)/img: $(doc_imgs) | mkbuild-doc doc-img
mkdir -p $@
cp "$(path_doc_img)"/*.png $@
$(path_doc_output_html)/img: $(path_doc_output)/img
mkdir -p $(path_doc_output_html)
ln -s ../img $@
# interactive html doc (js)
$(path_doc_output_html)/%.js: $(path_doc)/%.js
cp $< $@
$(path_doc_output)/%.js: $(path_doc)/%.js
cp $< $@
# doc css
$(path_doc_output_html)/%.css: $(path_doc)/%.css
cp $< $@
doc-img: $(doc_imgs)
doc-pdf: $(path_doc_output)/manual.pdf
doc-info: $(path_doc_output_info)
doc-plain: $(path_doc_output_plain)
doc-html: $(path_doc_output_html)/index.html $(path_doc_output_html1)
min: build/ease.min.js build/ease-full.min.js min: build/ease.min.js build/ease-full.min.js
build/%.min.js: build/%.js build/%.min.js: build/%.js
cat $(path_tools)/license.tpl > $@ cat $(path_tools)/license.tpl > $@
@ -153,6 +60,6 @@ uninstall:
# clean up build dir # clean up build dir
clean: clean:
$(MAKE) -C $(path_doc) clean
rm -rf "${path_build}" rm -rf "${path_build}"
rm -rf $(path_doc_img)/*.png

109
doc/Makefile 100644
View File

@ -0,0 +1,109 @@
# documentation
path_doc=.
path_build=../build
path_lib=../lib
path_doc_output=${path_build}/doc
path_doc_output_info=${path_doc_output}/easejs.info
path_doc_output_plain=${path_doc_output}/manual.txt
path_doc_output_html=${path_doc_output}/manual
path_doc_output_html1=${path_doc_output}/manual.html
path_doc_css=${path_doc}/manual.css
path_doc_img=${path_doc}/img
path_doc_css_ref=manual.css
path_manual_texi=${path_doc}/manual.texi
path_info_install := /usr/local/share/info
src_js := index.js $(wildcard $(path_lib)/*.js)
src_tests := index.js $(wildcard $(path_test)/test-*)
doc_src := $(wildcard $(path_doc)/*.texi)
doc_imgs := $(patsubst %.dia, %.png, $(wildcard $(path_doc_img)/*.dia))
doc_imgs_txt := $(patsubst %.dia, %.png, $(wildcard $(path_doc_img)/*.txt))
doc_replace := s/<\/body>/<script type="text\/javascript" \
src="highlight.pack.js"><\/script><script type="text\/javascript" \
src="interactive.js"><\/script><\/body>/
.PHONY: doc mkbuild-doc doc-img doc-pdf doc-info doc-plain doc-html
# generate texinfo documentation (twice to generate TOC), then remove the extra
# files that were generated
#
# generates: pdf, info, HTML (multiple pages), HTML (single page)
default: doc-pdf doc-info doc-plain doc-html
mkbuild-doc: $(path_doc_output)
$(path_doc_output):
[ -d $(path_doc_output) ] || mkdir -p "$(path_doc_output)"
mkbuild: $(path_build)
# doc images
$(path_doc)/img/%.png: $(path_doc)/img/%.dia
dia -e $@ -s 300x $<
# doc pdf
$(path_doc_output)/%.pdf: $(doc_src) $(doc_imgs) | mkbuild-doc doc-img
TEXINPUTS="$(path_doc):" \
pdftex -output-directory "${path_doc}" "${path_manual_texi}" && \
TEXINPUTS="$(path_doc):" \
pdftex -output-directory "${path_doc}" "${path_manual_texi}"
mv -f "${path_doc}"/*.pdf "${path_doc_output}"
cd "$(path_doc)" && rm -f $(shell cat "$(path_doc)/.gitignore")
# doc info
$(path_doc_output_info): $(doc_src) $(doc_imgs_txt) | mkbuild-doc
makeinfo -I "$(path_doc)" -o $@ "$(path_manual_texi)";
# doc plain text
$(path_doc_output_plain): $(doc_imgs_txt) | mkbuild-doc
makeinfo --plain -I "$(path_doc)" "${path_manual_texi}" > $@
# doc html (multiple pages)
$(path_doc_output_html)/index.html: $(doc_src) $(path_doc_css) \
| $(path_doc_output_html)/img $(path_doc_output_html)/interactive.js \
$(path_doc_output_html)/highlight.pack.js \
$(path_doc_output_html)/$(path_doc_css_ref) mkbuild-doc doc-img
makeinfo --html --css-ref="$(path_doc_css_ref)" \
-I "$(path_doc)" -o "${path_doc_output_html}" "${path_manual_texi}"
sed -i '$(doc_replace)' $(path_doc_output_html)/*.htm?
# doc html (single page)
$(path_doc_output_html1): $(doc_src) $(path_doc_css) \
| $(path_doc_output)/img $(path_doc_output)/interactive.js \
$(path_doc_output)/highlight.pack.js mkbuild-doc doc-img
makeinfo --no-split --html --css-include="${path_doc_css}" \
-I "$(path_doc)" -o - "${path_manual_texi}" \
| sed '$(doc_replace)' \
> "$(path_doc_output_html1)"
# doc images (in build dir)
$(path_doc_output)/img: $(doc_imgs) | mkbuild-doc doc-img
[ -d "$@" ] || mkdir -p $@
cp "$(path_doc_img)"/*.png $@
$(path_doc_output_html)/img: $(path_doc_output)/img
mkdir -p $(path_doc_output_html)
ln -s ../img $@
# interactive html doc (js)
$(path_doc_output_html)/%.js: $(path_doc)/%.js
cp $< $@
$(path_doc_output)/%.js: $(path_doc)/%.js
cp $< $@
# doc css
$(path_doc_output_html)/%.css: $(path_doc)/%.css
cp $< $@
doc-img: $(doc_imgs)
doc-pdf: $(path_doc_output)/manual.pdf
doc-info: $(path_doc_output_info)
doc-plain: $(path_doc_output_plain)
doc-html: $(path_doc_output_html)/index.html $(path_doc_output_html1)
clean:
rm -rf $(path_doc_output)
rm -rf $(path_doc_img)/*.png