Mercurial > repos > public > sbplib_julia
annotate Makefile @ 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 | c8d6580d9307 |
rev | line source |
---|---|
844
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
1 JULIA_DEFAULT=julia --startup-file=no |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
2 JULIA?=$(JULIA_DEFAULT) |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
3 |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
4 # Set the default browser |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
5 WHICH_XDG_OPEN=$(shell which xdg-open) |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
6 WHICH_OPEN=$(shell which open) |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
7 BROWSER_DEFAULT = $(if $(WHICH_XDG_OPEN), xdg-open) |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
8 BROWSER_DEFAULT := $(if $(BROWSER_DEFAULT), $(BROWSER_DEFAULT), open) |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
9 BROWSER?=$(BROWSER_DEFAULT) |
843
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
10 |
839 | 11 help: |
12 @echo 'Targets:' | |
13 @echo ' help - Show this help.' | |
14 @echo ' docs - Generate docs for webserver deployment.' | |
15 @echo ' localdocs - Generate docs for local viewing.' | |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
16 @echo ' opendocs - Open documentation in the browser remaking it if necessary.' |
843
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
17 @echo '' |
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
18 @echo 'Variables:' |
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
19 @echo ' JULIA - Controls which command is used to run julia' |
844
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
20 @echo ' Default $(JULIA_DEFAULT)' |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
21 @echo ' BROWSER - Sets the command for how to open html files' |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
22 @echo ' Default: xdg-open if it exists otherwise open' |
843
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
23 @echo '' |
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
24 @echo 'Variables can be set on the commandline using the -e flag for make, e.g.' |
f4e67a74f923
Use a variable for the JULIA command to allow changing it
Jonatan Werpers <jonatan@werpers.com>
parents:
841
diff
changeset
|
25 @echo ' make localdocs -e JULIA=path/to/julia' |
844
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
26 @echo 'or as shell environment variables.' |
839 | 27 |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
28 docs: docs/build |
839 | 29 |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
30 localdocs: docs/build-local |
839 | 31 |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
32 opendocs: localdocs |
845
b4f542b4f2e4
Use two folders for local and webserver builds
Jonatan Werpers <jonatan@werpers.com>
parents:
844
diff
changeset
|
33 $(BROWSER) docs/build-local/index.html |
844
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
34 |
839 | 35 clean: |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
36 rm -rf docs/build |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
37 rm -rf docs/build-local |
839 | 38 |
844
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
39 .PHONY: help docs localdocs opendocs clean |
ee0404433fc3
Add a opendocs target
Jonatan Werpers <jonatan@werpers.com>
parents:
843
diff
changeset
|
40 |
846
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
41 SRC_DIRS = src docs/src |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
42 SRC_FILES_AND_DIRS = $(foreach dir,$(SRC_DIRS),$(shell find $(dir))) |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
43 DEP_IGNORE = %/.DS_Store |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
44 DOCS_DEPENDENCIES = docs/make.jl $(filter-out $(DEP_IGNORE),$(SRC_FILES_AND_DIRS)) |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
45 docs/build: $(DOCS_DEPENDENCIES) |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
46 $(JULIA) --project=docs docs/make.jl --build-dir build --prettyurls |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
47 |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
48 docs/build-local: $(DOCS_DEPENDENCIES) |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
49 $(JULIA) --project=docs docs/make.jl --build-dir build-local |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
50 |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
51 |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
52 .PHONY: temp |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
53 temp: |
c9e35f1ca269
Make the targets properly depend on the source files
Jonatan Werpers <jonatan@werpers.com>
parents:
845
diff
changeset
|
54 @echo $(SRC_FILES_AND_DIRS) |