changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/mkfile

changeset 7250: 5ddd42593f0b
parent: 76b0f3013f0a
child: ca43df3d5f56
author: cinap_lenrek@felloff.net
date: Sun, 19 May 2019 17:11:57 +0200
permissions: -rw-r--r--
description: vmx: handle build arch exclude in /sys/src/cmd/mkfile
1 </$objtype/mkfile
2 
3 TARG=`{ls *.[cy] | sed '/\.tab\.c$/d;s/..$//'}
4 HFILES=/$objtype/include/u.h /sys/include/libc.h /sys/include/bio.h
5 BIN=/$objtype/bin
6 PROGS=${TARG:%=$O.%}
7 LDFLAGS=
8 YFLAGS=-d
9 
10 NOTSYS=sml|dup|.+\..+
11 PCONLY=vmx
12 NOMK=$NOTSYS|`{~ $objtype (386 amd64) || echo $PCONLY}
13 
14 cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile}
15 DIRS=`{echo */mkfile | sed 's,/mkfile *,\n,g' | grep -v '^('$NOMK')$'}
16 APEDIRS=bzip2 compress cvs eqn grap gs links-ape lp pic postscript spin \
17  tex troff
18 
19 none:VQ:
20  echo usage: mk cmds, dirs, all, install, installall, '$O'.cmd, cmd.install, or cmd.installall
21 
22 cmds:V: $PROGS
23 
24 ape:V: $APE
25  for(i in $APEDIRS) @{
26  cd $i
27  echo mk $i
28  mk $MKFLAGS all
29  }
30 
31 dirs:V:
32  for(i in cc $DIRS) @{
33  cd $i
34  echo mk $i
35  mk $MKFLAGS all
36  }
37 
38 all:V: $PROGS dirs
39 
40 ^([$OS])\.(.*):R: \2.\1
41  $stem1^l $LDFLAGS -o $target $stem2.$stem1
42 
43 .*\.[$OS]:R: $HFILES
44 
45 (.*)\.([$OS])'$':R: \1.c
46  $stem2^c $CFLAGS $stem1.c
47 
48 &:n: $O.&
49  mv $O.$stem $stem
50 
51 %.tab.h %.tab.c:D: %.y
52  $YACC $YFLAGS -s $stem $prereq
53 
54 %.install:V: $BIN/%
55 
56 $cpuobjtype._cp: /bin/cp
57  cp $prereq $target
58 
59 %.safeinstall: $O.% $cpuobjtype._cp
60  test -e $BIN/$stem && mv $BIN/$stem $BIN/_$stem
61  ./$cpuobjtype._cp $O.$stem $BIN/$stem
62 
63 %.safeinstallall:
64  for(objtype in $CPUS)
65  mk $stem.safeinstall
66  mk $stem.clean
67 
68 $BIN/%: $O.% $cpuobjtype._cp
69  ./$cpuobjtype._cp $O.$stem $BIN/$stem
70 
71 %.directories:V:
72  for(i in $DIRS) @{
73  cd $i
74  echo mk $i
75  mk $MKFLAGS $stem
76  }
77 
78 clean:V: cleanfiles clean.directories
79 
80 nuke:V: cleanfiles nuke.directories
81 
82 directories:V: install.directories
83 
84 cleanfiles:V:
85  rm -f [$OS].out *.[$OS] y.tab.? y.debug y.output [$OS].$TARG [$OS].units.tab $TARG bc.c bc.tab.h units.tab.h units.c mpc.c mpc.tab.h [$OS]._cp
86 
87 %.clean:V:
88  rm -f [$OS].$stem $stem.[$OS]
89 
90 install:V:
91  test -e $cpuobjtype._cp || cp /bin/cp $cpuobjtype._cp
92  mk $MKFLAGS $TARG.install
93  mk $MKFLAGS directories
94 
95 installall:V:
96  for(objtype in $CPUS)
97  mk $MKFLAGS install
98 
99 %.installall: %.c
100  test -e $cpuobjtype._cp || cp /bin/cp $cpuobjtype._cp
101  for (objtype in $CPUS) {
102  rfork e
103  mk $stem.install &
104  }
105  wait
106  rm -f $stem.[$OS] y.tab.? $stem.tab.? y.debug y.output [$OS].$stem bc.c bc.tab.h units.c mpc.c
107 
108 %.acid: %.$O $HFILES
109  $CC $CFLAGS -a $stem.c >$target
110 
111 (bc|units|mpc|pc).c:R: \1.tab.c
112  mv $stem1.tab.c $stem1.c
113 
114 $BIN/init: $O.init
115  cp $prereq /$objtype/init
116 
117 $O.cj: cj.$O
118  $LD $LDFLAGS -o $O.cj cj.$O /$objtype/lib/libjpg.a
119 
120 %.update:V:
121  update $stem.c /386/bin/$stem
122 
123 compilers:V:
124  for(i in ?c)
125  if(! ~ $i cc rc) @{
126  cd $i
127  mk clean
128  objtype=$cputype mk install
129  mk clean
130  }
131  for(i in ?c)
132  if(! ~ $i cc rc) @{
133  cd $i
134  mk clean
135  mk installall
136  mk clean
137  }