]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/pc64/mkfile
pc, pc64: properly track dependencies for mem.h on autogenerated apbootstrap.h and...
[plan9front.git] / sys / src / 9 / pc64 / mkfile
1 CONF=pc64
2 CONFLIST=pc64 pccpu64
3
4 objtype=amd64
5 </$objtype/mkfile
6 p=9
7
8 # must match mem.h
9 KTZERO=0xffffffff80110000
10 APBOOTSTRAP=0xffffffff80007000
11 REBOOTADDR=0x11000
12
13 DEVS=`{rc ../port/mkdevlist $CONF}
14
15 PORT=\
16         alarm.$O\
17         alloc.$O\
18         allocb.$O\
19         auth.$O\
20         cache.$O\
21         chan.$O\
22         dev.$O\
23         edf.$O\
24         fault.$O\
25         page.$O\
26         parse.$O\
27         pgrp.$O\
28         portclock.$O\
29         print.$O\
30         proc.$O\
31         qio.$O\
32         qlock.$O\
33         random.$O\
34         rdb.$O\
35         rebootcmd.$O\
36         segment.$O\
37         syscallfmt.$O\
38         sysfile.$O\
39         sysproc.$O\
40         taslock.$O\
41         tod.$O\
42         xalloc.$O\
43
44 OBJ=\
45         l.$O\
46         cga.$O\
47         i8253.$O\
48         i8259.$O\
49         main.$O\
50         memory.$O\
51         mmu.$O\
52         trap.$O\
53         bootargs.$O\
54         $CONF.root.$O\
55         $CONF.rootc.$O\
56         $DEVS\
57         $PORT\
58
59 LIB=\
60         /$objtype/lib/libmemlayer.a\
61         /$objtype/lib/libmemdraw.a\
62         /$objtype/lib/libdraw.a\
63         /$objtype/lib/libip.a\
64         /$objtype/lib/libsec.a\
65         /$objtype/lib/libmp.a\
66         /$objtype/lib/libc.a\
67         /$objtype/lib/libfis.a\
68         /$objtype/lib/libaml.a\
69         /$objtype/lib/libdtracy.a\
70
71 ETHER=`{cd ../pc; echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
72 AUDIO=`{cd ../pc; echo devaudio.c audio*.c | sed 's/\.c/.'$O'/g'}
73 VGA=`{cd ../pc; echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
74 SDEV=`{cd ../pc; echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
75
76 $p$CONF:        $CONF.c $OBJ $LIB
77         $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
78         $LD -o $target -T$KTZERO -R4096 -l $OBJ $CONF.$O $LIB
79         size $target
80
81 install:V:      $p$CONF
82         cp $p$CONF /$objtype/
83         for(i in $EXTRACOPIES)
84                 import $i / /n/$i && cp $p$CONF $p$CONF.gz /n/$i/$objtype/
85
86
87 # copies generated by the rule below
88 PCHEADERS=usbehci.h screen.h ethermii.h mp.h io.h ahci.h \
89         yukdump.h
90
91 REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
92 ^($REPCH)\.h:R: ../pc/\1.h
93         cp $prereq .
94
95 REPCC=`{../port/mkfilelist ../pc}
96 ^($REPCC)\.$O:R:        '../pc/\1.c'
97         $CC $CFLAGS -I. -. ../pc/$stem1.c
98
99 <../boot/bootmkfile
100 <../port/portmkfile
101 <|../port/mkbootrules $CONF
102
103 l.$O:                           mem.h
104
105 $ETHER:                         ../port/etherif.h ../port/netif.h
106 $AUDIO:                         ../port/audioif.h
107 ether8003.$O ether8390.$O:      ether8390.h
108 etheryuk.$O:                    yukdump.h
109 $VGA mouse.$O:                  screen.h /sys/include/memdraw.h
110 vgavesa.$O:                     /386/include/ureg.h
111
112 mp.$O:                          mp.h apbootstrap.h 
113 apic.$O squidboy.$O:            mp.h
114 archmp.$O archacpi.$O:          mp.h
115
116 $SDEV:                          ../port/sd.h
117 sdiahci.$O:                     ahci.h
118 devaoe.$O sdaoe.$O:             ../port/aoe.h
119
120 main.$O:                        init.h reboot.h
121
122 devusb.$O usbuhci.$O usbohci.$O usbehci.$O usbehcipc.$O usbxhci.$O: ../port/usb.h
123 usbehci.$O usbehcipc.$O:        usbehci.h
124
125 trap.$O:                        /sys/include/tos.h
126
127 ethermii.$O:                    ethermii.h
128 ether8169.$O:                   ethermii.h
129 etherdp83820.$O:                ethermii.h
130 etherigbe.$O:                   ethermii.h
131 ethervgbe.$O:                   ethermii.h
132 ethervt6102.$O:                 ethermii.h
133 ethervt6105m.$O:                ethermii.h
134
135 etheriwl.$O:                    ../port/wifi.h
136 etherwpi.$O:                    ../port/wifi.h
137 etherrt2860.$O:                 ../port/wifi.h
138
139 init.h:D:               ../port/initcode.c ../pc/init9.c
140         $CC ../port/initcode.c
141         $CC ../pc/init9.c
142         $LD -l -R1 -s -o init.out init9.$O initcode.$O /$objtype/lib/libc.a
143         {echo 'uchar initcode[]={'
144          xd -1x <init.out |
145                 sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
146          echo '};'} > init.h
147
148 reboot.h:D:     rebootcode.s mem.h
149         $AS rebootcode.s
150         $LD -l -R1 -s -o reboot.out -T$REBOOTADDR rebootcode.$O
151         {echo 'uchar rebootcode[]={'
152          dd -if reboot.out -bs 1 -iseek 40 | 
153          xd -1x |
154          sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
155          echo '};'} > $target
156
157 apbootstrap.h:D:        apbootstrap.s mem.h
158         $AS apbootstrap.s
159         $LD -l -R1 -s -o apbootstrap.out -T$APBOOTSTRAP apbootstrap.$O
160         {echo 'uchar apbootstrap[]={'
161          dd -if apbootstrap.out -bs 1 -iseek 40 | 
162          xd -1x |
163          sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
164          echo '};'} > $target
165
166 sd53c8xx.i:     sd53c8xx.n
167         aux/na $prereq > $target
168
169 acid:V:
170         $CC -a -w main.c>acid
171
172 %.clean:V:
173         rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* apbootstrap.h reboot.h init.h $PCHEADERS