~pixelherodev/zyg

ref: 7dccbd7d9dc502f2cd859c4c7ebd84a0d8f3acd7 zyg/mkfile -rw-r--r-- 1.5 KiB
7dccbd7dNoam Preil merge 3 months ago
                                                                                
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
71
</$objtype/mkfile

all:V: $O.out.zyg

$O.out.zyg: driver.$O parser.$O lexer.$O queue.$O sema.$O lib/z80e/registers.$O lib/z80e/cpu.$O lib/z80e/log.$O
	pcc -o $target $prereq -l9 -lc3

install:V: /$objtype/bin/zyg

/$objtype/bin/zyg: $O.out.zyg
	cp $prereq $target

CFLAGS=$CFLAGS -D _POSIX_SOURCE -D_PLAN9_SOURCE -D_BSD_EXTENSION -D_LIMITS_EXTENSION -D_PLAN9_$objtype

%.$O:Q: %.c `{walk | grep '\.h$' | grep -v '^\.git'}
	echo cc $stem.c
	if(! ~ $mode release)
		pcc -c $CFLAGS $stem.c -DDEBUG -o $target
	if not
		pcc -c $CFLAGS $stem.c -o $target

clean:
	rm -f *.$O zyg $O.out.* lib/z80e/*.$O

usage/%:QV: $O.out.zyg
	$prereq --debug usage test/$stem.zig

test/%:QV: $O.out.zyg
	$prereq -S $target.zig

testall:VQ:
	if(@{walk test | grep -e '\.zig$' ; echo} | while(case=`{read}){
		if(~ $#case 0)
			exit
		if(! @{
			succeed=1
			name=`{echo $case | sed -e 's$^test/$$' -e 's/\.zig$//'}
			cat test/broken | while(ignore=`{read})
				if(~ $name $ignore)
					exit
			if(! @{
				cat test/failing | while(ignore=`{read}){
					ignore=`{echo $ignore | sed 's/:.*//'}
					if(~ $name $ignore)
						exit fail
				}
				exit 0
			})
				succeed=0
			if(! mk test/$name){
				if(~ $succeed 1){
					echo [FAIL] $case
					exit failure
				}
				if not {
					echo [EXPECT_FAIL] $case `{cat test/failing | grep '^'^$name^':'}
					exit
				}
			}
			if(~ $succeed 1){
				echo [PASS] $case
			}
			if not{
				echo [UNEXPECTED_PASS] $case `{cat test/failing | grep '^'^$name^':'}
				exit failure
			}
		})
			exit failure
	})
		echo all tests passed