Blob


1 <$PLAN9/src/mkhdr
3 SYSOFILES=`{sh ./sysofiles.sh}
4 LIB=libthread.a
5 OFILES=\
6 $SYSOFILES\
7 channel.$O\
8 daemonize.$O\
9 exec.$O\
10 ioproc.$O\
11 iorw.$O\
12 ref.$O\
13 thread.$O\
15 <$PLAN9/src/mksyslib
17 HFILES=thread.h threadimpl.h
18 OpenBSD.$O FreeBSD.$O: BSD.c
19 NetBSD.$O: Linux.c
21 tprimes: tprimes.$O
22 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
23 tspawn: tspawn.$O
24 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
25 tspawnloop: tspawnloop.$O
26 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
28 %.$O: %.c
29 $CC $CFLAGS -I. $stem.c
31 # cannot use generic .S rule because it conflicts
32 # with generic .s rule in mkcommon on case-insensitive
33 # systems like Mac OS X.
35 OpenBSD-%-asm.$O: OpenBSD-%-asm.S
36 $CC $CFLAGS OpenBSD-$stem-asm.S
38 test:V: tprimes tspawn
39 primes 1 10007 >p1.txt
40 $PLAN9/bin/time ./tprimes 10000 >tp1.txt
41 cmp p1.txt tp1.txt
42 primes 1 1009 >p2.txt
43 $PLAN9/bin/time ./tprimes 1000 >tp2.txt
44 cmp p2.txt tp2.txt
45 echo tspawn should take 3 seconds, not 6
46 $PLAN9/bin/time ./tspawn sleep 3 >/dev/null
48 CLEANFILES=p1.txt p2.txt tp1.txt tp2.txt