aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: cded8f3de38702b7edfee9ecbb625adbff200055 (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
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
79
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)


all: loc
loc.o: loc.c arg.h

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

.o:
	$(CC) -o $@ $< $(LDFLAGS)

check: loc
	test "$$(./loc < tests/0)" = 0
	test "$$(./loc - < tests/0)" = 0
	test "$$(./loc tests/1 tests/2 | sed 's/:  */: /')" = "$$(printf '%s\n' 'tests/1: 0' 'tests/2: 1' 1)"
	test "$$(./loc -s tests/1 tests/2)" = 1
	test "$$(./loc tests/0)" = 0
	test "$$(./loc tests/1)" = 0
	test "$$(./loc tests/2)" = 1
	test "$$(./loc tests/3)" = 0
	test "$$(./loc tests/4)" = 2
	test "$$(./loc tests/5)" = 2
	test "$$(./loc tests/6)" = 1
	test "$$(./loc tests/7)" = 0
	test "$$(./loc tests/8)" = 1
	test "$$(./loc tests/9)" = 1
	test "$$(./loc tests/10)" = 2
	test "$$(./loc tests/11)" = 0
	test "$$(./loc tests/12)" = 1
	test "$$(./loc tests/13)" = 2
	test "$$(./loc tests/14)" = 1
	test "$$(./loc tests/15)" = 0
	test "$$(./loc tests/16)" = 0
	test "$$(./loc tests/17)" = 1
	test "$$(./loc tests/18)" = 0
	test "$$(./loc tests/19)" = 1
	test "$$(./loc tests/20)" = 1
	test "$$(./loc tests/21)" = 1
	test "$$(./loc tests/22)" = 1
	test "$$(./loc tests/23)" = 1
	test "$$(./loc tests/24)" = 1
	test "$$(./loc tests/25)" = 0
	test "$$(./loc tests/26)" = 3
	test "$$(./loc tests/27)" = 3
	test "$$(./loc tests/28)" = 3
	test "$$(./loc tests/29)" = 3
	test "$$(./loc tests/30)" = 1
	test "$$(./loc tests/31)" = 1
	test "$$(./loc tests/32)" = 1
	test "$$(./loc tests/33)" = 1
	test "$$(./loc tests/34)" = 2
	test "$$(./loc tests/35)" = 2
	test "$$(./loc tests/36)" = 2
	test "$$(./loc tests/37)" = 1
	test "$$(./loc tests/38)" = 0
	test "$$(./loc tests/39)" = 1
	test "$$(./loc tests/40)" = 2

install: loc
	mkdir -p -- "$(DESTDIR)$(PREFIX)/bin/"
	mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1/"
	cp -- loc "$(DESTDIR)$(PREFIX)/bin/loc"
	cp -- loc.1 "$(DESTDIR)$(MANPREFIX)/man1/loc.1"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/bin/loc"
	-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/loc.1"

clean:
	-rm -f -- *.o *.su loc

.SUFFIXES:
.SUFFIXES: .o .c

.PHONY: all check install uninstall clean