-
Notifications
You must be signed in to change notification settings - Fork 11
/
mkfile
63 lines (47 loc) · 1.45 KB
/
mkfile
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
# mkfile for Plan 9
# By Nils M Holm and contributors, 2008-2018
</$objtype/mkfile
TARG= s9
OFILES= s9.$O s9core.$O plan9.$O s9-ffi.$O
CLEANFILES= s9.image test.image
CFLAGS= -FVw -Dplan9 -'DEXTENSIONS=sys_init();'
EXTRASCM= -l ext/sys-plan9/plan9.scm -l ext/sys-plan9/plan9-tools.scm
s9dir= /lib/s9fes
all:V: s9 s9.image
tests:V: coretest test realtest srtest libtest
s9: $O.out
cp $prereq $target
chmod +x $target
s9.image: s9 s9.scm config.scm
S9_IMAGE_DIR=. S9FES_LIBRARY_PATH=lib:contrib \
./s9 -i - -l config.scm $EXTRASCM -d $target
plan9.$O: ext/sys-plan9/plan9.c
$CC $CFLAGS -p -I `{pwd} ext/sys-plan9/plan9.c
s9-ffi.$O: ext/sys-plan9/s9-ffi.c
$CC $CFLAGS ext/sys-plan9/s9-ffi.c
coretest:V: s9core.c s9core.h s9import.h
$CC -Dplan9 -DTEST -o s9test.$O s9core.c
$LD -o s9test s9test.$O
./s9test
rm -f s9test.$O s9test
libtest:V: s9 test.image
ape/psh util/$target.sh
%test:V: s9 test.image util/%test.scm
./s9 -i ./test -f util/$target.scm
test.image: s9 s9.scm
./s9 -i - -d $target
inst: s9 s9.image
mkdir -p $s9dir
mkdir -p $s9dir/^($objtype lib ext contrib help)
cp s9 /$objtype/bin/s9fes
cp s9.image $s9dir/$objtype/s9.image
cp s9.scm $s9dir/s9fes.scm
cp lib/* $s9dir/lib
cp contrib/* $s9dir/contrib
{ x = `{pwd}; tar c help | { cd $s9dir; tar x }; cd $x }
sed -e 's|^s9dir=.*|s9dir='$s9dir'|' <util/s9.rc >/rc/bin/s9
chmod 755 /rc/bin/s9
deinst:
rm -rf /lib/s9fes
rm -f /rc/bin/s9 /$objtype/bin/s9fes
</sys/src/cmd/mkone