-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (28 loc) · 885 Bytes
/
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
VERSION := 0.0.1
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
CFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 -pipe -DVERSION=\"$(VERSION)\"
all: parmap
.PHONY: clean debug doc fmt install test uninstall
clean:
rm -f parmap
debug: VERSION := $(VERSION)-debug
debug: CFLAGS += -O0 -g
debug: clean parmap
doc: parmap.1
fmt:
clang-format -i --Werror --style=file parmap.c
install: parmap
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
install -m755 parmap $(DESTDIR)$(BINDIR)/parmap
install -m644 parmap.1 $(DESTDIR)$(MANDIR)/man1/parmap.1
parmap: parmap.c
$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
parmap.1: parmap.1.md
pandoc -s -t man parmap.1.md -o parmap.1
test: debug
cram --shell zsh -v tests/*.t
uninstall:
rm -f $(DESTDIR)$(BINDIR)/parmap $(DESTDIR)$(MANDIR)/man1/parmap.1
-rmdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1