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

MACHINE != uname -m
MACHINE !=\
	if test -d "$(MACHINE)"; then \
		printf '%s\n' "$(MACHINE)"; \
	else \
		printf '%s\n' "generic"; \
	fi

CONFIGFILE = config.mk
include $(CONFIGFILE)

BIN = true false

all: $(BIN)
true: true.o
false: false.o

.SUFFIXES:
.SUFFIXES: .o

include $(MACHINE)/build.mk

check: $(BIN:=-check)

true-check: true
	./true
	./true
	./true
	./true
	./true
	./true
	./true
	./true
	./true
	./true

false-check: false
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1
	set +e; ./false; test $$? = 1 || exit 1

install: $(BIN)
	mkdir -p -- "$(DESTDIR)/$(PREFIX)/bin"
	cp -- $(BIN) "$(DESTDIR)/$(PREFIX)/bin"
	cd -- "$(DESTDIR)/$(PREFIX)/bin" && chmod -- 755 "$(BIN)"

uninstall:
	-cd -- "$(DESTDIR)/$(PREFIX)/bin" && rm -f -- $(BIN)
	-rmdir -- "$(DESTDIR)/$(PREFIX)/bin"

clean:
	-rm -f -- *.o *.su $(BIN)

.PHONY: all check true-check false-check install uninstall clean