|
1 |
| -.PHONY: serve html clean github |
| 1 | +# type `make help` to see all options |
2 | 2 |
|
3 |
| -serve: |
4 |
| - @hugo --i18n-warnings server -D |
| 3 | +# If you have naively forked this repo, say to |
| 4 | +# github.com://myname/numpy.org.git, you can test out the build via |
| 5 | +# make TARGET=myname BASEURL=https://myname.github.io/numpy.org deploy |
5 | 6 |
|
6 |
| -html: |
7 |
| - @hugo |
8 |
| - @touch public/.nojekyll |
| 7 | +TARGET ?= origin |
| 8 | +BASEURL ?= |
9 | 9 |
|
10 |
| -clean: |
11 |
| - @rm -rf public |
| 10 | +ifdef BASEURL |
| 11 | + BASEURLARG=-b $(BASEURL) |
| 12 | +endif |
12 | 13 |
|
13 |
| -github: | clean html |
14 |
| - @echo "Command to upload to git goes here" |
15 |
| - @echo "See `push_dir_to_repo.py` in NumPy" |
| 14 | +all: build |
| 15 | + |
| 16 | +.PHONY: serve html clean deploy help |
| 17 | + |
| 18 | +.SILENT: # remove this to see the commands executed |
| 19 | + |
| 20 | +serve: public ## serve the website |
| 21 | + hugo --i18n-warnings server -D |
| 22 | + |
| 23 | +public: ## create a worktree branch in the public directory |
| 24 | + git worktree add -B gh-pages public $(TARGET)/gh-pages |
| 25 | + rm -rf public/* |
| 26 | + |
| 27 | +html: public ## build the website in ./public |
| 28 | + hugo $(BASEURLARG) |
| 29 | + touch public/.nojekyll |
| 30 | + |
| 31 | +public/.nojekyll: html |
| 32 | + |
| 33 | +clean: ## remove the build artifacts, mainly the "public" directory |
| 34 | + rm -rf public |
| 35 | + git worktree prune |
| 36 | + rm -rf .git/worktrees/public |
| 37 | + |
| 38 | +deploy: public/.nojekyll ## push the built site to the gh-pages of this repo |
| 39 | + cd public && git add --all && git commit -m"Publishing to gh-pages" |
| 40 | + @echo pushint to $(TARGET) gh-pages |
| 41 | + git push $(TARGET) gh-pages |
| 42 | + |
| 43 | + |
| 44 | +# Add help text after each target name starting with '\#\#' |
| 45 | +help: ## Show this help. |
| 46 | + @echo "\nHelp for this makefile" |
| 47 | + @echo "Possible commands are:" |
| 48 | + @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/\(.*\):.*##\(.*\)/ \1: \2/' |
| 49 | + @echo |
| 50 | + @echo If you have naively forked this repo, say to |
| 51 | + @echo github.com://myname/numpy.org.git, you can test out the build via |
| 52 | + @echo make TARGET=myname BASEURL=https://myname.github.io/numpy.org deploy |
| 53 | + |
0 commit comments