-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
62 lines (49 loc) · 1.35 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
SHELL=/bin/sh
# DESTDIR is used in a non-standard way for compatibility
prefix=$(DESTDIR)/usr
CC=cc
CFLAGS+=-O2 -std=c89 -Wpedantic -Wall -Wextra -Wunused -Wshadow -Wdouble-promotion -Wstrict-overflow=5
INSTALL=install
INSTALL_DATA=$(INSTALL) -m 644
bindir=$(prefix)/bin
datarootdir=$(prefix)/share
mandir=$(datarootdir)/man
man6dir=$(mandir)/man6
BASHCOMPLDIR=$(datarootdir)/bash-completion/completions
ZSHCOMPLDIR=$(datarootdir)/zsh/site-functions
DIRS=$(prefix) $(bindir) $(datarootdir) $(mandir) $(man6dir) $(BASHCOMPLDIR) $(ZSHCOMPLDIR)
STRIP=strip
ifeq ($(OS),Windows_NT)
X = .exe
else
ifeq ($(shell uname), SunOS)
STRIP=gstrip
else ifeq ($(shell uname), Darwin)
STRIP=echo
endif
endif
PROG=gti$X
MANPAGE=gti.6.gz
$(PROG): *.c
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^
-$(STRIP) -s $@
$(MANPAGE): gti.6
gzip -9 -n -c gti.6 > gti.6.gz
$(DIRS):
mkdir -p "$@"
install: $(PROG) $(MANPAGE) $(DIRS)
$(INSTALL) $(PROG) $(bindir)/$(PROG)
$(INSTALL_DATA) $(MANPAGE) $(man6dir)/$(MANPAGE)
$(INSTALL_DATA) completions/gti.bash $(BASHCOMPLDIR)/$(PROG)
$(INSTALL_DATA) completions/gti.zsh $(ZSHCOMPLDIR)/_$(PROG)
uninstall:
rm -f $(bindir)/$(PROG)
rm -f $(man6dir)/$(MANPAGE)
fmt: *.c
VERSION_CONTROL=never indent -kr -i4 -ppi4 -nut -l100 -cp0 -ncs -sob \
-T HANDLE \
$^
.PHONY: clean install uninstall
clean:
rm -f $(PROG)
rm -f $(MANPAGE)