File: Makefile

package info (click to toggle)
libaio 0.3.113-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,404 kB
  • sloc: ansic: 956; makefile: 150; sh: 45
file content (70 lines) | stat: -rw-r--r-- 1,915 bytes parent folder | download
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
# foo.
TEST_SRCS:=$(shell find cases/ -name \*.t | sort -n -t/ -k2)
EXTRAPROGS:=cases/8.p cases/10.p cases/23.p
PARTPROGS:=$(filter-out $(EXTRAPROGS), $(patsubst %.t,%.p,$(TEST_SRCS)))
PROGS:=$(PARTPROGS) $(EXTRAPROGS)
HARNESS_SRCS:=main.c
# io_queue.c

MK_CPPFLAGS = -I../src -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(CPPFLAGS)
CFLAGS ?= -Wall -Werror -g -O2
MK_CFLAGS = $(CFLAGS)
#-lpthread -lrt
MK_LDFLAGS = main.c $(LIBAIO) -lpthread $(LDFLAGS)

# gcc-11 does not like the test case in 3.t that
# passes an invalid pointer (-1) to the kernel, so
# tell the compiler we do not need a warning here
cases/3.p:	MK_CFLAGS+=-Wno-stringop-overflow

# Change this on the build line to run tests against the installed libraries:
# make LIBAIO=-laio partcheck
LIBAIO?=../src/libaio.a

all: $(PROGS)

$(PROGS): %.p: %.t $(HARNESS_SRCS)
	$(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS)

clean:
	rm -f $(PROGS) *.o runtests.out tempfile testfile
	rm -f testdir/rofile testdir/wofile testdir/rwfile
	rmdir testdir || true

.PHONY:

testdir/rofile: testdir .PHONY
	rm -f $@
	echo "test" >$@
	chmod 400 $@

testdir/wofile: testdir .PHONY
	rm -f $@
	echo "test" >$@
	chmod 200 $@

testdir/rwfile: testdir .PHONY
	rm -f $@
	echo "test" >$@
	chmod 600 $@

testdir testdir.enospc testdir.ext2:
	mkdir $@

root: .PHONY
	@if [ `id -u` -ne 0 ]; then echo Need root for check, try partcheck >&2; exit 1; fi

partcheck: $(PARTPROGS) testdir/rofile testdir/rwfile testdir/wofile
	./runtests.sh $(PARTPROGS)

ext2.img:
	dd if=/dev/zero bs=1M count=10 of=$@
	mke2fs -F -b 4096 $@

extracheck: $(EXTRAPROGS) root testdir.ext2 testdir.enospc ext2.img
	mount -o loop -t ext2 ext2-enospc.img testdir.enospc
	./runtests.sh cases/10.p; ret=$$?; umount testdir.enospc; exit $$ret
	mount -o loop -t ext2 ext2.img testdir.ext2
	./runtests.sh cases/8.p; ret=$$?; umount testdir.ext2; exit $$ret

check: partcheck extracheck