diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-06 21:33:15 +0000 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-06 21:33:15 +0000 |
commit | 56553e4dd0a4880fe0cf3b11ebddbc551b44bbe8 (patch) | |
tree | 50fbaa6b729d6c5b33b690fc98c6b624e6594fe9 /Makefile | |
parent | README: update (diff) | |
download | jekyll-docker-56553e4dd0a4880fe0cf3b11ebddbc551b44bbe8.tar.gz jekyll-docker-56553e4dd0a4880fe0cf3b11ebddbc551b44bbe8.zip |
Makefile: automatic --config detection for Jekyll
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -4,6 +4,10 @@ SHELL := bash .DELETE_ON_ERROR: .SUFFIXES: +empty := +space := $(empty) $(empty) +comma := , + makefile_dir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) # Jekyll project is in the parent directory by default. @@ -78,8 +82,8 @@ chruby/profile.d/clean: chruby := . '$(chruby_sh)' && chruby 'ruby-$(RUBY_VERSION)' project_chruby := cd -- '$(PROJECT_DIR)' && $(chruby) + bundle := $(project_chruby) && bundle -jekyll := $(bundle) exec jekyll .PHONY: bundler bundler: @@ -99,13 +103,24 @@ deps: dependencies .PHONY: deps/update deps/update: dependencies/update +# List of --config files in alphabetical order. +jekyll_configs := $(shell cd -- '$(PROJECT_DIR)' && find . -mindepth 1 -maxdepth 1 -type f -name '_config*.yml' -print | sort) +jekyll_configs := $(subst $(space),$(comma),$(jekyll_configs)) + +jekyll_opts := --drafts --config $(jekyll_configs) +jekyll := $(bundle) exec jekyll + +.PHONY: foo +foo: + echo $(configs) + .PHONY: jekyll/build jekyll/build: - $(jekyll) build --drafts --config _config.yml,_config_dev.yml + $(jekyll) build $(jekyll_opts) .PHONY: jekyll/serve jekyll/serve: - $(jekyll) serve --drafts --config _config.yml,_config_dev.yml --host 0.0.0.0 + $(jekyll) serve $(jekyll_opts) --host 0.0.0.0 JEKYLL_UID ?= $(shell id -u) JEKYLL_GID ?= $(shell id -g) |