-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (57 loc) · 1.38 KB
/
Makefile
File metadata and controls
78 lines (57 loc) · 1.38 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
78
SHELL = /bin/sh
# Command variables.
GZIP = gzip
HELP2MAN = help2man
HELP2MANFLAGS = --no-info --locale en_US
INSTALL = install
SHELLCHECK = shellcheck
# Install commands.
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -d
# Common prefix for installation directories.
prefix = /usr/local
exec_prefix = $(prefix)
datarootdir = $(prefix)/share
# Where to put the executable.
bindir = $(exec_prefix)/bin
# Where to put the manual files.
mandir = $(datarootdir)/man
man1dir = $(mandir)/man1
# The program.
program = dotfiler
description = maintain your dotfiles easily
source = $(program).sh
manual = $(program).1
# Output files.
program_out = $(DESTDIR)$(bindir)/$(program)
manual_out = $(DESTDIR)$(man1dir)/$(manual)
.PHONY: all
all: check $(program) man
.PHONY: check
check: $(source)
$(SHELLCHECK) $<
.PHONY: install
install: $(program) man installdirs
$(INSTALL_PROGRAM) $(program) $(program_out)
-$(INSTALL_DATA) $(manual) $(manual_out) \
&& $(GZIP) $(manual_out)
.PHONY: installdirs
installdirs:
$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_DIR) $(DESTDIR)$(man1dir)
.PHONY: man
man: $(manual)
$(manual): $(program)
-$(HELP2MAN) --output=$@ --name='$(description)' \
$(HELP2MANFLAGS) ./$<
$(program): $(source)
cp $< $@
.PHONY: uninstall
uninstall:
-rm $(program_out)
-rm $(manual_out)*
.PHONY: clean
clean:
-rm $(program)
-rm $(manual)