From 858872bab80ea4adb22e80f5212acf34628b1168 Mon Sep 17 00:00:00 2001 From: Christos Kontas Date: Thu, 1 Feb 2018 10:10:24 +0100 Subject: [PATCH] Makefile: split the target from the PHONY rule A PHONY rule is executed always. The target of the `readme' rule is to create the `www/data/readme.json', which depends only on `README.md'. If we specify these dependencies separately, make(1) won't build the `readme.json', if it's not necessary. And yet, we can refer to this creation by typing `make readme'. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 05bca0e..ccbb8d6 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,9 @@ release: bin bindata.go docs: readme cd www && hugo -d ../docs -readme: www/data - cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > www/data/readme.json +readme: www/data/readme.json +www/data/readme.json: www/data README.md + cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > www/data/readme.json www/data bin: mkdir -p $@