-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (55 loc) · 1.84 KB
/
Copy pathMakefile
File metadata and controls
70 lines (55 loc) · 1.84 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
PREFIX ?= /usr/local
readme := README.md
# Directory containing external files that should not be edited
srcdir := src
# Directory containing editable scripts and converted files from $(srcdir)
bindir := bin
# Install everything in $(bindir) except LICENSE* files
bin = $(filter-out $(wildcard $(bindir)/LICENSE*),$(wildcard $(bindir)/*))
# Where to find and install completions
completions = completions
completionsdir = share/bash-completion/$(completions)
all: $(bindir)/fsystemctl $(readme)
install: all
install -d $(PREFIX)/$(bindir)
install $(bin) $(PREFIX)/$(bindir)
install -d $(PREFIX)/$(completionsdir)
install $(completions)/* $(PREFIX)/$(completionsdir)
# Convert fuzzy-sys to an executable script and
# change the name used in the help output
$(bindir)/fsystemctl: $(srcdir)/fuzzy-sys
mkdir -p $(dir $@)
> $@
chmod +x $@
echo "#!/bin/bash" >> $@
echo "#" >> $@
sed 's/^/# /' $(srcdir)/UNLICENSE.fuzzy-sys >> $@
echo "#" >> $@
echo "# Modified from:" >> $@
echo "# https://github.com/NullSense/fuzzy-sys/blob/master/fuzzy-sys.plugin.zsh" >> $@
echo "#" >> $@
cat $< >> $@
echo '$(notdir $<) "$$*"' >> $@
sed -i 's/$(notdir $<)/$(notdir $@)/' $@
clean:
$(RM) $(readme)
distclean: clean
$(RM) $(bindir)/fsystemctl
# Generate README.md from 'abstract' tags
#
readme_hdr := readme.header
readme_ext := readme.external
# Base URL for README links
SRCPATH := https://github.com/jbrubake/fzf-scripts/blob/master
# Look for 'abstract' in all tracked files
scripts := $(shell git ls-files $(bindir))
$(readme): peru.yaml $(readme_hdr) $(readme_ext) $(scripts)
> $@
# Read abstracts from internal files
cat $(readme_hdr) >> $@
./mkreadme.awk -v base_url=$(SRCPATH) $(filter-out $< $(readme_hdr) $(readme_ext),$^) >> $@
echo >> $@
# Read abstracts from $< (external files)
cat $(readme_ext) >> $@
./mkreadme.awk < $< | sort >> $@
echo >> $@