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\
14 wait.$O\
16 <$PLAN9/src/mksyslib
18 HFILES=thread.h threadimpl.h
19 OpenBSD.$O FreeBSD.$O: BSD.c
20 NetBSD.$O: Linux.c
22 tprimes: tprimes.$O
23 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
24 tspawn: tspawn.$O
25 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
26 tspawnloop: tspawnloop.$O
27 9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
29 %.$O: %.c
30 $CC $CFLAGS -I. $stem.c
32 # cannot use generic .S rule because it conflicts
33 # with generic .s rule in mkcommon on case-insensitive
34 # systems like Mac OS X.
36 OpenBSD-%-asm.$O: OpenBSD-%-asm.S
37 $CC $CFLAGS OpenBSD-$stem-asm.S
39 Linux-sparc64-context.$O: Linux-sparc64-context.S
40 $CC -m64 -mcpu=v9 $CFLAGS Linux-sparc64-context.S
42 Linux-sparc64-swapcontext.$O: Linux-sparc64-swapcontext.c
43 $CC -m64 -mcpu=v9 $CFLAGS Linux-sparc64-swapcontext.c
45 test:V: tprimes tspawn
46 primes 1 10007 >p1.txt
47 $PLAN9/bin/time ./tprimes 10000 >tp1.txt
48 cmp p1.txt tp1.txt
49 primes 1 1009 >p2.txt
50 $PLAN9/bin/time ./tprimes 1000 >tp2.txt
51 cmp p2.txt tp2.txt
52 echo tspawn should take 3 seconds, not 6
53 $PLAN9/bin/time ./tspawn sleep 3 >/dev/null
55 CLEANFILES=p1.txt p2.txt tp1.txt tp2.txt