generated from HariSekhon/Template-Repo
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMakefile
91 lines (75 loc) · 1.76 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#
# Author: Hari Sekhon
# Date: 2016-01-17 12:56:53 +0000 (Sun, 17 Jan 2016)
#
# vim:ts=4:sts=4:sw=4:noet
#
# https://github.com/HariSekhon/Knowledge-Base
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
#
# https://www.linkedin.com/in/HariSekhon
#
ifneq ("$(wildcard bash-tools/Makefile.in)", "")
include bash-tools/Makefile.in
endif
REPO := HariSekhon/Knowledge-Base
CODE_FILES := $(shell git ls-files | grep -E -e '\.md$$' | sort)
# serialize
MAKEFLAGS = -j1
.PHONY: *
# causes weird inheritance condition from Makefile.in that causes triggering of git and printenv targets after build and push
#default: build push
default:
$(MAKE) build
@echo
@#$(MAKE) push
build: init
@echo ====================
@echo Knowledge Base Build
@echo ====================
@echo
@$(MAKE) git-summary
@echo
@#$(MAKE) generate-index
@$(MAKE) index
@$(MAKE) references
@$(MAKE) mdl
@echo
@#$(MAKE) pre-commit
@echo "All Checks Passed"
generate-indexes:
@# markdown_replace_index.sh is from DevOps-Bash-tools repo being in the $PATH
@git ls-files --cached "*.md" | \
grep -v README.md | \
while read -r filename; do \
if ! git status --porcelain "$$filename" | grep -q . ; then \
markdown_replace_index.sh "$$filename"; \
echo; \
fi; \
done
generate-index: generate-indexes
@:
indexes: generate-indexes
@:
pre-commit:
pre-commit run --all
precommit: pre-commit
@:
index:
@echo "Checking all *.md files are in the README.md index"
@echo
.github/scripts/check_index.sh
@echo
references:
@echo "Checking all *.md files references exist"
@echo
.github/scripts/check_markdown_references.sh
@echo
init:
@echo
@echo "running init:"
git submodule update --init --recursive
@echo
push: build
git push