aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/mkfile
blob: eca4f4df445f7bfdcef6e2923386fa295ddc49ee (plain)
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
<$PLAN9/src/mkhdr

SYSOFILES=`{sh ./sysofiles.sh}
LIB=libthread.a
OFILES=\
	$SYSOFILES\
	bg.$O\
	channel.$O\
	daemonize.$O\
	exec.$O\
	ioproc.$O\
	iorw.$O\
	ref.$O\
	thread.$O\
	wait.$O\

<$PLAN9/src/mksyslib

HFILES=thread.h threadimpl.h

tprimes: test/tprimes.$O
	9l -o $target test/$target.$O
tspawn: test/tspawn.$O
	9l -o $target test/$target.$O
tspawnloop: test/tspawnloop.$O
	9l -o $target test/$target.$O

tprimes tspawn tspawnloop: $PLAN9/lib/$LIB

%.$O: %.c
	$CC -o $target $CFLAGS -I. $stem.c

# cannot use generic .S rule because it conflicts
# with generic .s rule in mkcommon on case-insensitive
# systems like Mac OS X.

OpenBSD-%-asm.$O:	OpenBSD-%-asm.S
	$CC $CFLAGS OpenBSD-$stem-asm.S

Linux-sparc64-context.$O: Linux-sparc64-context.S
	$CC -m64 -mcpu=v9 $CFLAGS Linux-sparc64-context.S

sparc64-ucontext.$O: sparc64-ucontext.c
	$CC -m64 -mcpu=v9 $CFLAGS sparc64-ucontext.c

test:V: tprimes tspawn
	primes 1 10007 >p1.txt
	$PLAN9/bin/time ./tprimes 10000 >tp1.txt
	cmp p1.txt tp1.txt
	primes 1 1009 >p2.txt
	$PLAN9/bin/time ./tprimes 1000 >tp2.txt
	cmp p2.txt tp2.txt
	echo tspawn should take 3 seconds, not 6
	$PLAN9/bin/time ./tspawn sleep 3 >/dev/null

CLEANFILES=p1.txt p2.txt tp1.txt tp2.txt test/*.$O tprimes tspawn