2019-09-05 18:23:46 -07:00
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
all : html
# markdown files that will not be evaluated, simply copy to build/
PURE_MARKDOWN = ./README.md
# markdown files that will be evaluated and then saved as ipynb files
IPYNB_MARKDOWN = $( shell find . -not -path "./build/*" -not -path "*.ipynb_checkpoints*" -name "*.md" | sort -h)
# RST files will be simply coped to build/
RST = $( shell find . -not -path "./build/*" -not -path "*.ipynb_checkpoints*" -name "*.rst" )
OBJ = $( patsubst %.rst, build/%.rst, $( RST) ) \
$( patsubst %.md, build/%.ipynb, \
$( filter-out $( PURE_MARKDOWN) , $( IPYNB_MARKDOWN) ) )
build/%.ipynb : %.md
@mkdir -p $( @D)
2020-08-18 16:57:35 +00:00
python3 scripts/md2ipynb.py $< $@
2019-09-05 18:23:46 -07:00
build/%.rst : %.rst
@mkdir -p $( @D)
2020-08-18 16:57:35 +00:00
# python3 scripts/process_rst.py $< $@
2019-09-05 18:23:46 -07:00
cp $< $@
build/% : %
@mkdir -p $( @D)
@cp -r $< $@
html : $( OBJ )
2020-09-06 13:00:18 -07:00
mkdir -p build;
cp Makefile_sphinx build/Makefile;
2020-10-12 14:18:30 -04:00
cp -n -r ../_static build/ || true;
2020-09-06 13:00:18 -07:00
sphinx-autogen build/api/*.rst build/api/**/*.rst -t build/_templates/;
2019-09-05 18:23:46 -07:00
# make -C build linkcheck doctest html
2020-09-06 13:00:18 -07:00
make -C build html;
sed -i.bak 's/33\,150\,243/23\,141\,201/g' build/_build/html/_static/material-design-lite-1.3.0/material.blue-deep_orange.min.css;
make update_github_link
update_github_link :
for f in $( shell find build/_build/html/tutorials -type f -name '*.html' ) ; do \
echo " Updating github edit link for $$ f. " ; \
sed -i.bak 's/\(href="https:\/\/github.com\/apache\/mxnet\/edit\/master\/docs\/python_docs\/python\/tutorials\/[^"]*\).ipynb"/\1.md"/g' $$ f; \
done ;
2019-09-05 18:23:46 -07:00
clean :
rm -rf build