ref: 77a7e3f8fcafd8d8339b7d734f2b525867904597
parent: 04c4a9ca8b06e34a203f7ddacc2263cf2077e1aa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 2 15:46:58 EST 2020
kernel: cleanup makefile for $CONF.$O target
--- a/sys/src/9/bcm/mkfile
+++ b/sys/src/9/bcm/mkfile
@@ -74,14 +74,13 @@
9:V: $p$CONF s$p$CONF
-$p$CONF:DQ: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
+$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking raw kernel' # H6: no headers, data segment aligned
- $LD -l -o $target -H6 -R4096 -T$loadaddr $OBJ $CONF.$O $LIB
+ $LD -l -o $target -H6 -R4096 -T$loadaddr $prereq
-s$p$CONF:DQ: $CONF.$O $OBJ $LIB
+s$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking kernel with symbols'
- $LD -l -o $target -R4096 -T$loadaddr $OBJ $CONF.$O $LIB
+ $LD -l -o $target -R4096 -T$loadaddr $prereq
size $target
$p$CONF.gz:D: $p$CONF
--- a/sys/src/9/bcm64/mkfile
+++ b/sys/src/9/bcm64/mkfile
@@ -69,14 +69,13 @@
9:V: $p$CONF s$p$CONF
-$p$CONF:DQ: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
+$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking raw kernel' # H6: no headers, data segment aligned
- $LD -s -l -o $target -H6 -R0x10000 -T$loadaddr $OBJ $CONF.$O $LIB
+ $LD -s -l -o $target -H6 -R0x10000 -T$loadaddr $prereq
-s$p$CONF:DQ: $CONF.$O $OBJ $LIB
+s$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking kernel with symbols'
- $LD -l -o $target -R0x10000 -T$loadaddr $OBJ $CONF.$O $LIB
+ $LD -l -o $target -R0x10000 -T$loadaddr $prereq
size $target
$p$CONF.gz:D: $p$CONF
--- a/sys/src/9/cycv/mkfile
+++ b/sys/src/9/cycv/mkfile
@@ -64,12 +64,11 @@
/$objtype/lib/libmp.a\
/$objtype/lib/libc.a\
-$p$CONF.u:D: $p$CONF
+$p$CONF.u:D: $p$CONF
aux/aout2uimage $p$CONF
-$p$CONF:D: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -T$KTZERO -l $OBJ $CONF.$O $LIB
+$p$CONF:D: $OBJ $CONF.$O $LIB
+ $LD -o $target -T$KTZERO -l $prereq
<../boot/bootmkfile
<../port/portmkfile
--- a/sys/src/9/kw/mkfile
+++ b/sys/src/9/kw/mkfile
@@ -74,16 +74,13 @@
9:V: $p$CONF s$p$CONF
-$p$CONF:DQ: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
+$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking raw kernel'
-# sleep 1 # avoid relinking later
- $LD -o $target -H0 -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -H0 -R4096 -T$loadaddr -l $prereq
-s$p$CONF:DQ: $CONF.$O $OBJ $LIB
+s$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking kernel with symbols'
-# sleep 1 # avoid relinking later
- $LD -o $target -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -R4096 -T$loadaddr -l $prereq
size $target
$p$CONF.gz:D: $p$CONF
--- a/sys/src/9/mtx/mkfile
+++ b/sys/src/9/mtx/mkfile
@@ -66,9 +66,8 @@
loadaddr = 0x80004020
-$p$CONF: $CONF.c $OBJ $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -R4 -o $target -T$loadaddr -l $OBJ $CONF.$O $LIB
+$p$CONF: $OBJ $CONF.$O $LIB
+ $LD -R4 -o $target -T$loadaddr -l $prereq
ls -l $target
install:V: $p$CONF
--- a/sys/src/9/omap/mkfile
+++ b/sys/src/9/omap/mkfile
@@ -70,15 +70,13 @@
9:V: $p$CONF s$p$CONF
-$p$CONF:DQ: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
+$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking raw kernel'
- $LD -o $target -H0 -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -H0 -R4096 -T$loadaddr -l $prereq
-s$p$CONF:DQ: $CONF.$O $OBJ $LIB
+s$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking kernel with symbols'
-# $LD -o $target -R4096 -T$loadaddr -l -a $OBJ $CONF.$O $LIB >$target.list
- $LD -o $target -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -R4096 -T$loadaddr -l $prereq
size $target
$p$CONF.gz:D: $p$CONF
--- a/sys/src/9/pc/mkfile
+++ b/sys/src/9/pc/mkfile
@@ -76,9 +76,8 @@
VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
-$p$CONF: $CONF.c $OBJ $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -T$KTZERO -l $OBJ $CONF.$O $LIB
+$p$CONF: $OBJ $CONF.$O $LIB
+ $LD -o $target -T$KTZERO -l $prereq
size $target
# don't strip the gzipped kernels -- too frustrating when that's all you have!
--- a/sys/src/9/pc64/mkfile
+++ b/sys/src/9/pc64/mkfile
@@ -74,9 +74,8 @@
VGA=`{cd ../pc; echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{cd ../pc; echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
-$p$CONF: $CONF.c $OBJ $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -T$KTZERO -R4096 -l $OBJ $CONF.$O $LIB
+$p$CONF: $OBJ $CONF.$O $LIB
+ $LD -o $target -T$KTZERO -R4096 -l $prereq
size $target
install:V: $p$CONF
--- a/sys/src/9/port/portmkfile
+++ b/sys/src/9/port/portmkfile
@@ -42,13 +42,13 @@
%.$O: /$objtype/include/u.h ../port/lib.h mem.h dat.h fns.h io.h ../port/error.h ../port/portdat.h ../port/portfns.h
-../port/systab.h: /sys/src/libc/9syscall/sys.h ../port/mksystab
+../port/systab.h:D: /sys/src/libc/9syscall/sys.h ../port/mksystab
rc ../port/mksystab > ../port/systab.h
-$CONF.$O: $CONF.c
+$CONF.$O: $CONF.c $OBJ $LIB
$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
-$CONF.c: ../port/mkdevc $CONF
+$CONF.c:D: ../port/mkdevc $CONF
rc ../port/mkdevc $CONF > $CONF.c
{echo 'uchar configfile[]={'
xd -1x $CONF |
@@ -59,13 +59,13 @@
errstr.h:D: ../port/mkerrstr ../port/error.h
rc ../port/mkerrstr > errstr.h
-%.i: %.out
+%.i:D: %.out
{echo 'uchar '^$stem^'[]={'
xd -1x <$stem.out |
sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
echo '};'} > $target
-%.db: main.$O
+%.db:D: main.c
$CC -s$stem main.c | dbfmt > $stem.db
alloc.$O ucalloc.$O devswap.$O devproc.$O: /sys/include/pool.h
--- a/sys/src/9/ppc/mkfile
+++ b/sys/src/9/ppc/mkfile
@@ -72,14 +72,12 @@
it:V: $p$CONF
-9blast: $CONF.c $OBJ $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -T$loadaddr -R4096 -l $OBJ $CONF.$O $LIB
- size $p$CONF
+9blast: $OBJ $CONF.$O $LIB
+ $LD -o $target -T$loadaddr -R4096 -l $prereq
+ size $target
-9ucu: $CONF.c $OBJ $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -R0x1000 -H5 -o $target -T$loadaddr -l $OBJ $CONF.$O $LIB
+9ucu: $OBJ $CONF.$O $LIB
+ $LD -R0x1000 -H5 -o $target -T$loadaddr -l $prereq
install:V: $p$CONF
cp $p$CONF /$objtype/$p$CONF
--- a/sys/src/9/sgi/mkfile
+++ b/sys/src/9/sgi/mkfile
@@ -68,9 +68,8 @@
/$objtype/lib/libip.a\
/$objtype/lib/libc.a\
-$p$CONF: $OBJ $CONF.c $LIB
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -l -R8 -H3 -T$KTZERO $OBJ $CONF.$O $LIB
+$p$CONF: $OBJ $CONF.$O $LIB
+ $LD -o $target -l -R8 -H3 -T$KTZERO $prereq
size $target
install:V: $p$CONF
--- a/sys/src/9/teg2/mkfile
+++ b/sys/src/9/teg2/mkfile
@@ -83,15 +83,13 @@
9:V: $p$CONF s$p$CONF
-$p$CONF:DQ: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
+$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking raw kernel' # H6: no headers, data segment aligned
- $LD -o $target -H6 -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -H6 -R4096 -T$loadaddr -l $prereq
-s$p$CONF:DQ: $CONF.$O $OBJ $LIB
+s$p$CONF:DQ: $OBJ $CONF.$O $LIB
echo '# linking 9 kernel with symbols'
-# $LD -o $target -R4096 -T$loadaddr -l -a $OBJ $CONF.$O $LIB >$target.list
- $LD -o $target -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
+ $LD -o $target -R4096 -T$loadaddr -l $prereq
size $target
$p$CONF.gz:D: $p$CONF
--- a/sys/src/9/xen/mkfile
+++ b/sys/src/9/xen/mkfile
@@ -93,18 +93,12 @@
PAE=`{echo $PAE | sed 's/yes/yes[extended-cr3]/'}
XENELF='LOADER=generic,XEN_VER=xen-3.0,ELF_PADDR_OFFSET=0,VIRT_BASE='$KZERO',VIRT_ENTRY='$KTZERO',PAE='$PAE
-#$p$CONF: $CONF.c $OBJ $LIB xenbin.$cputype
-# $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
-# $LD -o $target.tmp -T$KTZERO -l $OBJ $CONF.$O $LIB
-# ./xenbin.$cputype <$target.tmp >$target
-# rm $target.tmp
-# size $target
-
-$p$CONF: $CONF.c $OBJ $LIB xenelf.$cputype
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target.elf -H5 -T$KTZERO -P$KPZERO -l $OBJ $CONF.$O $LIB
- ./xenelf.$cputype $target.elf $target __xen_guest ''$XENELF''
+$p$CONF:D: $p$CONF.elf xenelf.$cputype
+ ./xenelf.$cputype $prereq(1) $target __xen_guest ''$XENELF''
size $target
+
+$p$CONF.elf:D: $OBJ $CONF.$O $LIB
+ $LD -o $target -H5 -T$KTZERO -P$KPZERO -l $prereq
$p$CONF.gz: $p$CONF
#strip -o /fd/1 $p$CONF | gzip -9 > $p$CONF.gz
--- a/sys/src/9/zynq/mkfile
+++ b/sys/src/9/zynq/mkfile
@@ -64,9 +64,8 @@
/$objtype/lib/libmp.a\
/$objtype/lib/libc.a\
-$p$CONF:D: $CONF.c $OBJ $LIB mkfile
- $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
- $LD -o $target -T$KTZERO -l $OBJ $CONF.$O $LIB
+$p$CONF:D: $OBJ $CONF.$O $LIB
+ $LD -o $target -T$KTZERO -l $prereq
<../boot/bootmkfile
<../port/portmkfile