changeset 846:c9e35f1ca269 feature/setup_documenter

Make the targets properly depend on the source files
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 14 Jan 2022 13:24:15 +0100
parents b4f542b4f2e4
children 0862bed6e6b4
files Makefile README.md
diffstat 2 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jan 14 11:56:18 2022 +0100
+++ b/Makefile	Fri Jan 14 13:24:15 2022 +0100
@@ -13,7 +13,7 @@
 	@echo '    help        - Show this help.'
 	@echo '    docs        - Generate docs for webserver deployment.'
 	@echo '    localdocs   - Generate docs for local viewing.'
-	@echo '    opendocs    - Open documentation in the browser.'
+	@echo '    opendocs    - Open documentation in the browser remaking it if necessary.'
 	@echo ''
 	@echo 'Variables:'
 	@echo '    JULIA       - Controls which command is used to run julia'
@@ -25,20 +25,30 @@
 	@echo '    make localdocs -e JULIA=path/to/julia'
 	@echo 'or as shell environment variables.'
 
-docs:
-	$(JULIA) --project=docs docs/make.jl --build-dir build --prettyurls
+docs: docs/build
 
-localdocs:
-	$(JULIA) --project=docs docs/make.jl --build-dir build-local
+localdocs: docs/build-local
 
-opendocs:
+opendocs: localdocs
 	$(BROWSER) docs/build-local/index.html
 
 clean:
-	rm -r docs/build
-	rm -r docs/build-local
+	rm -rf docs/build
+	rm -rf docs/build-local
 
 .PHONY: help docs localdocs opendocs clean
 
-# TODO:
-# Make a real target for docs/build
+SRC_DIRS = src docs/src
+SRC_FILES_AND_DIRS = $(foreach dir,$(SRC_DIRS),$(shell find $(dir)))
+DEP_IGNORE = %/.DS_Store
+DOCS_DEPENDENCIES = docs/make.jl $(filter-out $(DEP_IGNORE),$(SRC_FILES_AND_DIRS))
+docs/build: $(DOCS_DEPENDENCIES)
+	$(JULIA) --project=docs docs/make.jl --build-dir build --prettyurls
+
+docs/build-local: $(DOCS_DEPENDENCIES)
+	$(JULIA) --project=docs docs/make.jl --build-dir build-local
+
+
+.PHONY: temp
+temp:
+	@echo $(SRC_FILES_AND_DIRS)
--- a/README.md	Fri Jan 14 11:56:18 2022 +0100
+++ b/README.md	Fri Jan 14 13:24:15 2022 +0100
@@ -39,7 +39,10 @@
 ```
 The first variant generates files suitable for webserver deployment, i.e setting `prettyurls=true`. The second generates files sutible for local viewing in a web browser, i.e `prettyurls=false`.
 
-To view the documentation locally simply open `docs/build/index.html` in your web browser.
+To view the documentation locally simply open `docs/build/index.html` in your web browser. The documentation can be automatically built and opened using
+```shell
+make opendocs
+```
 
 When including the `docs/make.jl` script `prettyurls` is set to `false` by default.