about summary refs log tree commit diff
path: root/Makefile
blob: c70f5ee7c4e1012e79fc0dbe0652a3a7af95d1f8 (plain) (blame)
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
CFLAGS=-g -O2 -Wall -Wno-switch -Wextra

DESTDIR=
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man

ALL = necho
LINKS = zecho qecho jecho secho

all: $(ALL) $(LINKS) $(LINKS:=.1)

README: necho.1
	mandoc -Tutf8 $< | col -bx >$@

necho: necho.c

$(LINKS): necho
	ln -sf necho $@

$(LINKS:=.1): necho.1
	ln -sf necho.1 $@

check: FRC all
	prove -v

install: FRC all
	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
	install -m0755 $(ALL) $(DESTDIR)$(BINDIR)
	install -m0644 $(ALL:=.1) $(DESTDIR)$(MANDIR)/man1
	for l in $(LINKS); do \
		ln -sf necho $(DESTDIR)$(BINDIR)/$$l; \
		ln -sf necho.1 $(DESTDIR)$(MANDIR)/man1/$$l.1; \
	done

clean: FRC
	rm -f $(ALL) $(LINKS) $(LINKS:=.1)

FRC: