-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (58 loc) · 1.85 KB
/
Makefile
File metadata and controls
78 lines (58 loc) · 1.85 KB
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
SRC := $(wildcard *.c)
BINS := $(patsubst %.c,%$(SUFFIX),$(SRC))
readme := README.md
peru = .peru/lastimports
emojify_tmpl := emojify.tmpl
emoji_db := emoji.db
emoji_shortcodes := emoji.short
all: $(BINS) $(readme)
clean:
$(RM) $(BINS)
$(RM) $(readme)
distclean: clean
$(RM) $(emojify_tmpl)
$(RM) $(emoji_db)
$(RM) $(emoji_shortcodes)
$(RM) emojify
install: all
./install.sh -Vf
# Generate README.md from 'abstract' tags
#
readme_hdr := readme.header
readme_ext := readme.external
# Base URL for README links
SRCPATH := https://github.com/jbrubake/scripts/blob/master
# Look for 'abstract' in all tracked files except those in $(ignore)
#
# Get contents of .ignore, replace * with % (so patterns work with make)
# and remove newlines (join)
ignore := $(join $(subst *,%,$(file < .ignore)),)
# Unignore source files
ignore := $(filter-out %.c,$(ignore))
# Get list of all files and remove what is in $(ignore)
# Use git ls-files to avoid pulling in untracked binaries
scripts := $(filter-out $(ignore),$(shell git ls-files))
$(readme): peru.yaml $(readme_hdr) $(readme_ext) $(scripts)
> $@
cat $(readme_hdr) >> $@
./mkreadme.awk -v base_url=$(SRCPATH) $(filter-out $< $(readme_hdr) $(readme_ext),$^) >> $@
echo >> $@
cat $(readme_ext) >> $@
./mkreadme.awk < $< | sort >> $@
echo >> $@
emojify: $(emoji_shortcodes) $(emojify_tmpl)
cat $(emojify_tmpl) | sed -e '/# List generated by/,/^)/!b' -e '/^)/!d;r $<' -e 'd' > $@
chmod +x $@
$(emoji_shortcodes): $(emoji_db)
> $@
echo '# Automatically generated list using data from:' >> $@
echo '# https://github.com/milesj/emojibase' >> $@
echo 'declare -A emojis=(' >> $@
< $< jq -r 'keys[] as $$k | "[\":\([.[$$k]] | flatten | .[]):\"]=\"\\U\($$k)\""' | sed 's/-/\\U/g' >> $@
echo ')' >> $@
$(emoji_db) $(emojify_tmpl):
peru sync
$(peru): peru.yaml
peru sync
# peru sync does not set mtime
touch $@