-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
951 additions
and
840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ | |
*.swp | ||
/.meta/ | ||
/_site/ | ||
/content/xxx* | ||
/content/yyy* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,155 @@ | ||
######################################################################## | ||
# Makefile for web site management | ||
# Makefile | ||
# | ||
# Project: jqt | ||
# Author: <Joan Josep Ordinas Rosa> [email protected] | ||
# Description: Makefile for JQT web site management. | ||
# Published: https://fadado.github.io/jqt/ | ||
# | ||
# Variables: | ||
# $(Metadata) | ||
# Rules: | ||
# $(Metadata) directory target and clobber method | ||
# | ||
######################################################################## | ||
|
||
######################################################################## | ||
# Load _Make_ configuration. | ||
######################################################################## | ||
|
||
# Make configuration | ||
include make.d/prelude.make | ||
include make.d/configuration.make | ||
|
||
# jqt version | ||
Version := 0.5.1 | ||
# Do not try to rebuilt static makefiles. | ||
Makefile make.d/configuration.make: ; | ||
|
||
# Metadata directory | ||
Metadata := .meta | ||
######################################################################## | ||
# Metadata directory for all generated make and metadata files. | ||
######################################################################## | ||
|
||
# Do not build to clobber immediately | ||
Metadata ?= .meta | ||
|
||
$(Metadata): | ||
$(info ==> $@) | ||
mkdir --parents $@ >/dev/null 2>&1 || true | ||
|
||
# Delete all generated metadata | ||
clobber:: ; @rm -rf $(Metadata) | ||
|
||
######################################################################## | ||
# Print debug info. | ||
######################################################################## | ||
|
||
ifneq (,$(TRACE)) | ||
ifdef MAKE_RESTARTS | ||
$(info Makefile phase restarted: $(MAKE_RESTARTS)) | ||
endif | ||
endif | ||
|
||
######################################################################## | ||
# Check command line sanity. | ||
######################################################################## | ||
|
||
# Target 'clobber' must be alone. | ||
ifeq (clobber,$(filter clobber,$(MAKECMDGOALS))) | ||
ifneq (1,$(words $(MAKECMDGOALS))) | ||
$(error Target "clobber" must be alone) | ||
endif | ||
endif | ||
|
||
# Do not build to clobber immediately. | ||
ifeq (clobber,$(MAKECMDGOALS)) | ||
ifeq (,$(wildcard $(Metadata))) | ||
$(error Nothing to clobber) | ||
endif | ||
endif | ||
|
||
# Do not build to clean immediately | ||
# Do not build to clean immediately. | ||
ifeq (clean,$(filter clean,$(MAKECMDGOALS))) | ||
ifeq (,$(wildcard $(Metadata))) | ||
$(error Nothing to clean) | ||
endif | ||
endif | ||
|
||
# ====================================================================== | ||
# Check _root_ intentions. | ||
ifeq (,$(filter install uninstall,$(MAKECMDGOALS))) | ||
ifeq (0,$(shell id --user)) | ||
$(error Root only can make "(un)install" targets) | ||
endif | ||
else | ||
ifneq (0,$(shell id --user)) | ||
$(error Only root can make "(un)install" targets) | ||
endif | ||
endif | ||
|
||
######################################################################## | ||
# Include all makefile phases. | ||
######################################################################## | ||
|
||
# Recursive variable used in all included makefiles. This works because the | ||
# included files do not include other makefiles. | ||
|
||
THIS = $(lastword $(MAKEFILE_LIST)) | ||
|
||
######################################################################## | ||
# Derive metadata from `config.yaml` or `config.json`. | ||
|
||
-include $(Metadata)/phase1.make | ||
include make.d/config.make | ||
# | ||
# Variables defined in phase1.make: | ||
# __phase_1 | ||
# Assets | ||
# Blocks | ||
# Content | ||
# Data | ||
# Destination | ||
# Layouts | ||
# Styles | ||
# Defined rules for: | ||
# $(Metadata) | ||
# $(Metadata)/config.json | ||
# $(Metadata)/phase1.make | ||
# $(Metadata)/site.json | ||
# ====================================================================== | ||
include make.d/phase1.make | ||
|
||
# Do not try to rebuilt static makefiles. | ||
make.d/phase1.make: ; | ||
|
||
# Warning: | ||
# | ||
# If `__phase_1` is not defined because `phase1.make` does not exists, after | ||
# this point most of the file is ignored, but `phase1.make` is built because a | ||
# rule exists in the file `config.make`. Then this `Makefile` is restarted, | ||
# `MAKE_RESTARTS` is be equal to 1, `phase1.make` is now loaded and | ||
# this point the rest of the file is ignored, but `phase1.make` is built | ||
# because a rule exists in the file `config.make`. Then this `Makefile` is | ||
# restarted, `MAKE_RESTARTS` is be equal to 1, `phase1.make` is now loaded and | ||
# `__phase_1` is defined. Equivalent situation happens in all phases. | ||
|
||
ifdef __phase_1 | ||
|
||
# ====================================================================== | ||
######################################################################## | ||
# Build metadata from filesystem introspection. | ||
|
||
-include $(Metadata)/phase2.make | ||
include make.d/data.make | ||
# | ||
# Variables defined in phase2.make: | ||
# __phase_2 | ||
# DataCSV | ||
# DataJSON | ||
# DataMD | ||
# DataYAML | ||
# DestinationPages | ||
# DestinationPaths | ||
# MetadataPages | ||
# MetadataPaths | ||
# Defined rules for: | ||
# $(Metadata)/phase2.make | ||
# $(DataFiles) | ||
# $(DestinationPaths) | ||
# $(Metadata)/pages-by-id.json | ||
# $(MetadataPages) | ||
# $(MetadataPaths) | ||
# Defined targets: | ||
# init | ||
# ====================================================================== | ||
include make.d/phase2.make | ||
|
||
# Do not try to rebuilt static makefiles. | ||
make.d/phase2.make: ; | ||
|
||
ifdef __phase_2 | ||
|
||
# ====================================================================== | ||
######################################################################## | ||
# Define standard rules and rules for HTML pages and nodes. | ||
|
||
-include $(Metadata)/phase3.make | ||
include make.d/pages.make | ||
# | ||
# Load rules for pages and nodes. | ||
# | ||
# Variables defined in phase3.make: | ||
# __phase_3 | ||
# Defined rules for: | ||
# $(Metadata)/phase3.make | ||
# Defined targets: | ||
# all | ||
# build | ||
# clean | ||
# clobber | ||
# fresh | ||
# touch | ||
# ====================================================================== | ||
include make.d/phase3.make | ||
|
||
# Do not try to rebuilt static makefiles. | ||
make.d/phase3.make: ; | ||
|
||
ifdef __phase_3 | ||
|
||
# ====================================================================== | ||
######################################################################## | ||
# Several complementary makefiles. | ||
|
||
include make.d/sitemap.make | ||
include make.d/styles.make | ||
include make.d/tools.make | ||
# | ||
# Several complementary files. | ||
# | ||
# Defined rules for: | ||
# $(Destination)/sitemap.xml | ||
# $(Destination)/sitemap.xml.gz | ||
# $(Destination)/styles.css | ||
# Defined targets: | ||
# help | ||
# lint | ||
# valid | ||
# ====================================================================== | ||
##include make.d/tools.make | ||
|
||
# Do not try to rebuilt static makefiles. | ||
make.d/sitemap.make: ; | ||
make.d/styles.make: ; | ||
##make.d/tools.make: ; | ||
|
||
######################################################################## | ||
include config.make | ||
# | ||
# Project specific makefile. All the previous modules are expected to be | ||
# independent, valid for any project without any change. This file must | ||
# exist but can be empty. | ||
######################################################################## | ||
|
||
include config.make | ||
|
||
# Do not try to rebuilt static makefiles. | ||
config.make: ; | ||
|
||
endif # __phase_3 | ||
endif # __phase_2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.