diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 40 |
1 files changed, 30 insertions, 10 deletions
@@ -1,21 +1,35 @@ -DOCBUILD=../doctools/webdocs/docbuild +DOCTOOLS=doctools +DOCBUILD=$(DOCTOOLS)/docbuild VERBOSE=--verbose FETCHTS=.fetch.ts LOCALFETCH=.LocalFetch.ts +define GetFromConfig +$(shell node -p "require('./docs.json').$(1)") +endef + +DOCTOOLSREPO := $(call GetFromConfig,doctools.url) +DOCTOOLSBRANCH := $(call GetFromConfig,doctools.version) + all: help -help: +help: @echo "Usage:" + @echo "- make distclean: clean all generated files and repos" @echo "- make clean: clean all generated files" + @echo "- make doctools: clone doctools repository" @echo "- make fetch: fetch the site if necessary" @echo "- make localFetch: fetch the site if necessary but use local file." @echo "- make build: build the site" @echo "- make push: push the built site" @echo "- make serve: serve the site" +.PHONY: distclean +distclean: clean + rm -fr $(DOCTOOLS) + .PHONY: clean clean: $(DOCBUILD) $(VERBOSE) --clean @@ -31,23 +45,29 @@ $(FETCHTS): $(wildcard content/toc/*/fetched_files.yml) $(DOCBUILD) $(VERBOSE) $(LOCAL_FETCHTS) --fetch --force touch $@ +prebuild: + @node -v && [ $$? -eq 0 ] || (echo "Please, make sure nodejs is installed" && false) + @jekyll -v && [ $$? -eq 0 ] || (echo "Please, make sure jekyll is installed" && false) + +.PHONY: doctools +doctools: prebuild + echo $(DOCTOOLSREPO) + @test ! -d $(DOCTOOLS) && git clone -b $(DOCTOOLSBRANCH) $(DOCTOOLSREPO) $(DOCTOOLS) || true + @cd $(DOCTOOLS) && npm install + .PHONY: fetch -fetch: $(FETCHTS) +fetch: doctools $(FETCHTS) @echo "Fetched files up to date." -.PHONY: localFetch -localFetch: $(LOCALFETCH) $(FETCHTS) - @echo "Fetched files up to date and copy local file." - .PHONY: build -build: $(FETCHTS) +build: doctools $(FETCHTS) $(DOCBUILD) $(VERBOSE) --build .PHONY: push -push: $(FETCHTS) +push: doctools $(FETCHTS) $(DOCBUILD) $(VERBOSE) --build --push .PHONY: serve -serve: $(FETCHTS) +serve: doctools $(FETCHTS) $(DOCBUILD) $(VERBOSE) --build --serve |