9front - general discussion about 9front
 help / color / mirror / Atom feed
* cmd/mkfile rewrite
@ 2020-04-29  4:12 Amavect .
  2020-04-30 18:49 ` [9front] " cinap_lenrek
  0 siblings, 1 reply; 11+ messages in thread
From: Amavect . @ 2020-04-29  4:12 UTC (permalink / raw)
  To: 9front

All,

I've cleaned up /sys/src/cmd/mkfile
http://okturing.com/src/8412/body
Eventually, I'll get /sys/src/mkfile installall to work.

Thanks,
Amavect


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-04-29  4:12 cmd/mkfile rewrite Amavect .
@ 2020-04-30 18:49 ` cinap_lenrek
  2020-05-01  1:00   ` Amavect .
  0 siblings, 1 reply; 11+ messages in thread
From: cinap_lenrek @ 2020-04-30 18:49 UTC (permalink / raw)
  To: 9front

nice! i'll take a look.

one thing that i had on my wish list for while was a target
to compile the compilers and ther dependencies first.

--
cinap


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-04-30 18:49 ` [9front] " cinap_lenrek
@ 2020-05-01  1:00   ` Amavect .
  2020-05-01 14:34     ` cinap_lenrek
  0 siblings, 1 reply; 11+ messages in thread
From: Amavect . @ 2020-05-01  1:00 UTC (permalink / raw)
  To: 9front

Good idea!
mk install.compilers
http://okturing.com/src/8417/body
mk install compiles cc first, then [$OS][acl], and then the rest.

Thanks,
Amavect


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01  1:00   ` Amavect .
@ 2020-05-01 14:34     ` cinap_lenrek
  2020-05-01 17:27       ` Amavect
  0 siblings, 1 reply; 11+ messages in thread
From: cinap_lenrek @ 2020-05-01 14:34 UTC (permalink / raw)
  To: 9front

> Good idea!
> mk install.compilers
> http://okturing.com/src/8417/body
> mk install compiles cc first, then [$OS][acl], and then the rest.

the compiler target should go to /sys/src/mkfile, not in /sys/src/cmd/mkfile
i think... but almost there.

now all we need is to build libc and libbio (and libstdio for cpp)
first before the compilers... after that, we can also compile cpp.

note that we should probably clean the compilers first before recompiling
here as the headers of these libraries might have changed and the object
files having been compiled with the previous headers before.

thats gives us the native compilers.

for APE, can do something similar like compiling the ape library dependencies
for pcc and then pcc itself.

the idea here is to avoid rebuilding everything twice. basically to
get the compilers up to date first before then rebuilding everything.

if you wanted a full update, you'd do a mk compilers and then mk nuke
&& mk install.

at least thats how i'd imagine it... tell me something is missing here.

--
cinap


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 14:34     ` cinap_lenrek
@ 2020-05-01 17:27       ` Amavect
  2020-05-01 18:18         ` ori
  2020-05-01 18:26         ` ori
  0 siblings, 2 replies; 11+ messages in thread
From: Amavect @ 2020-05-01 17:27 UTC (permalink / raw)
  To: 9front

Consider moving the compilers to /sys/src/comp, then.
Compilers are special enough to get their own dir.
Then it would be easy to build compiler prereqs first.

No need to clean beforehand.
Have the headers be a prereq for each %.$O.
This is straightforward to do.
(Technically, all mkfiles should prereq the headers.)
(This is not done in practice.)

A full update should just be a mk install.

Thanks,
Amavect


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 17:27       ` Amavect
@ 2020-05-01 18:18         ` ori
  2020-05-01 18:33           ` cinap_lenrek
  2020-05-01 18:26         ` ori
  1 sibling, 1 reply; 11+ messages in thread
From: ori @ 2020-05-01 18:18 UTC (permalink / raw)
  To: amavect, 9front

> Consider moving the compilers to /sys/src/comp, then.
> Compilers are special enough to get their own dir.
> Then it would be easy to build compiler prereqs first.

The compiler prereqs are libc and libbio -- and I think
we want to build those *twice*. Once to get the compilers
updated, and once to build them with the new compilers.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 17:27       ` Amavect
  2020-05-01 18:18         ` ori
@ 2020-05-01 18:26         ` ori
  1 sibling, 0 replies; 11+ messages in thread
From: ori @ 2020-05-01 18:26 UTC (permalink / raw)
  To: amavect, 9front

> (Technically, all mkfiles should prereq the headers.)
> (This is not done in practice.)

Yeah. We'd need to update mk in order to tackle thiis. I have
ideas on improvements there, but it's a bunch of work.

(And it all should fit reasonably into mk; I don't think
we need to do the CADT thing and start over)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 18:18         ` ori
@ 2020-05-01 18:33           ` cinap_lenrek
  2020-05-01 23:43             ` Amavect .
  0 siblings, 1 reply; 11+ messages in thread
From: cinap_lenrek @ 2020-05-01 18:33 UTC (permalink / raw)
  To: 9front

yeah.... we want to basically to sneak in a little
compiler boot strapping pass :-)

--
cinap


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 18:33           ` cinap_lenrek
@ 2020-05-01 23:43             ` Amavect .
  2020-05-02  0:04               ` ori
  0 siblings, 1 reply; 11+ messages in thread
From: Amavect . @ 2020-05-01 23:43 UTC (permalink / raw)
  To: 9front

Having a super-perfect build between 6c and libc/libbio is probably
impossible with mk, as-is.
mk doesn't do cyclic dependencies, and I'm not sure what an advanced
build system could do to fix it.

So, this should be good enough.
mk installall now works, too.
http://okturing.com/src/8431/body
Dtracy doesn't build under power.
Here's a new cmd/mkfile to fix that.
http://okturing.com/src/8430/body

Thanks,
Amavect


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-01 23:43             ` Amavect .
@ 2020-05-02  0:04               ` ori
  2020-05-12  1:18                 ` Amavect .
  0 siblings, 1 reply; 11+ messages in thread
From: ori @ 2020-05-02  0:04 UTC (permalink / raw)
  To: amavect, 9front

> Having a super-perfect build between 6c and libc/libbio is probably
> impossible with mk, as-is.
> mk doesn't do cyclic dependencies, and I'm not sure what an advanced
> build system could do to fix it.
> 
> So, this should be good enough.
> mk installall now works, too.
> http://okturing.com/src/8431/body
> Dtracy doesn't build under power.
> Here's a new cmd/mkfile to fix that.
> http://okturing.com/src/8430/body
> 
> Thanks,
> Amavect

Could you generate the patches with 'bind -a /dist/plan9front / && hg diff',
and attach them to the email? It's easier to see what changed and review it
that way.

Thanks.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] cmd/mkfile rewrite
  2020-05-02  0:04               ` ori
@ 2020-05-12  1:18                 ` Amavect .
  0 siblings, 0 replies; 11+ messages in thread
From: Amavect . @ 2020-05-12  1:18 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 145 bytes --]

gmail sucks and replied only to ori, 10 days ago.
Here's the cmd and src mkfile diffs.
Is there anything that needs to be done?

Thanks,
Amavect

[-- Attachment #2: cmd.diff --]
[-- Type: application/octet-stream, Size: 3967 bytes --]

diff -r b43985308e3e sys/src/cmd/mkfile
--- a/sys/src/cmd/mkfile	Fri May 01 13:29:08 2020 -0700
+++ b/sys/src/cmd/mkfile	Fri May 01 19:25:21 2020 -0500
@@ -1,41 +1,24 @@
 </$objtype/mkfile
 
-TARG=`{ls *.[cy] | sed '/\.tab\.c$/d;s/..$//'}
+YTARG=`{ls *.y | sed 's/..$//'}
+TARG=`{ls *.c | sed 's/..$//'} $YTARG
 HFILES=/$objtype/include/u.h /sys/include/libc.h /sys/include/bio.h
 BIN=/$objtype/bin
-PROGS=${TARG:%=$O.%}
 LDFLAGS=
 YFLAGS=-d
 
-NOTSYS=sml|dup|.+\..+
+NOTSYS=.+\..+
 PCONLY=|vmx
-NOMK=$NOTSYS`{~ $objtype (386 amd64) || echo $PCONLY}
+POWERLESS=|dtracy
+NOMK=$NOTSYS`{~ $objtype (386 amd64) || echo $PCONLY}`{~ $objtype power && echo $POWERLESS}
 
-cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile}
+Ocpu=`{sed -n 's/^O=//p' /$cputype/mkfile}
 DIRS=`{echo */mkfile | sed 's,/mkfile *,\n,g' | grep -v '^('$NOMK')$'}
-APEDIRS=bzip2 compress cvs eqn grap gs links-ape lp pic postscript spin \
-	tex troff
 
 none:VQ:
-	echo usage: mk cmds, dirs, all, install, installall, '$O'.cmd, cmd.install, or cmd.installall
-
-cmds:V:	$PROGS
-
-ape:V: $APE
-	for(i in $APEDIRS) @{
-		cd $i
-		echo mk $i
-		mk $MKFLAGS all
-	}
-
-dirs:V:
-	for(i in cc $DIRS) @{
-		cd $i
-		echo mk $i
-		mk $MKFLAGS all
-	}
-
-all:V:	$PROGS dirs
+	echo usage: mk cmds, all, allall, install, installall
+	echo '	$O'.'$cmd', '$cmd'.install, '$cmd'.installall
+	echo '	clean, nuke'
 
 ^([$OS])\.(.*):R:	\2.\1
 	$stem1^l $LDFLAGS -o $target $stem2.$stem1
@@ -45,93 +28,50 @@
 (.*)\.([$OS])'$':R:	\1.c
 	$stem2^c $CFLAGS $stem1.c
 
-&:n:	$O.&
-	mv $O.$stem $stem
+%.tab.h %.c:D:	%.y
+	$YACC $YFLAGS -o $stem.c -s $stem $prereq
 
-%.tab.h %.tab.c:D:	%.y
-	$YACC $YFLAGS -s $stem $prereq
+$BIN/%:	$O.% $Ocpu.cp
+	./$Ocpu.cp $O.$stem $BIN/$stem
 
-%.install:V: $BIN/%
+$BIN/init:	$O.init  # hack, install location is not target
+	cp $prereq /$objtype/init
 
-$cpuobjtype._cp:	/bin/cp
-	cp $prereq $target
+%.acid: %.$O $HFILES
+	$CC $CFLAGS -a $stem.c >$target
 
-%.safeinstall:	$O.% $cpuobjtype._cp
-	test -e $BIN/$stem && mv $BIN/$stem $BIN/_$stem
-	./$cpuobjtype._cp $O.$stem $BIN/$stem
-
-%.safeinstallall:
-	for(objtype in $CPUS)
-		mk $stem.safeinstall
-	mk $stem.clean
-
-$BIN/%:	$O.% $cpuobjtype._cp
-	./$cpuobjtype._cp $O.$stem $BIN/$stem
-
-%.directories:V:
+%.dirs:V:
 	for(i in $DIRS) @{
 		cd $i
 		echo mk $i
 		mk $MKFLAGS $stem
 	}
 
-clean:V:	cleanfiles clean.directories
+cmds:V:	${TARG:%=$O.%}
 
-nuke:V:		cleanfiles nuke.directories
+all:V:	cmds all.dirs
 
-directories:V:	install.directories
+allall:V:
+	for(objtype in $CPUS)
+		mk all
 
-cleanfiles:V:
-	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
+%.install:V:	$BIN/%
 
-%.clean:V:
-	rm -f [$OS].$stem $stem.[$OS]
+install:V:	${TARG:%=$BIN/%} install.dirs
 
-install:V:
-	test -e $cpuobjtype._cp || cp /bin/cp $cpuobjtype._cp
-	mk $MKFLAGS $TARG.install
-	mk $MKFLAGS directories
+%.installall:V:
+	for(objtype in $CPUS)
+		mk $stem.install
 
 installall:V:
 	for(objtype in $CPUS)
 		mk $MKFLAGS install
 
-%.installall:	%.c
-	test -e $cpuobjtype._cp || cp /bin/cp $cpuobjtype._cp
-	for (objtype in $CPUS) {
-		rfork e
-		mk $stem.install &
-	}
-	wait
-	rm -f $stem.[$OS] y.tab.? $stem.tab.? y.debug y.output [$OS].$stem bc.c bc.tab.h units.c mpc.c
+cleancmds:V:
+	rm -f *.[$OS] [$OS].* y.tab.? y.debug y.output $YTARG.c *.tab.h
 
-%.acid: %.$O $HFILES
-	$CC $CFLAGS -a $stem.c >$target
+clean:V:	cleancmds clean.dirs
 
-(bc|units|mpc|pc).c:R:	\1.tab.c
-	mv $stem1.tab.c $stem1.c
+nuke:V:		cleancmds nuke.dirs
+	rm -f *.acid
 
-$BIN/init:	$O.init
-	cp $prereq /$objtype/init
-
-$O.cj:	cj.$O
-	$LD $LDFLAGS -o $O.cj cj.$O /$objtype/lib/libjpg.a
-
-%.update:V:
-	update $stem.c /386/bin/$stem
-
-compilers:V:
-	for(i in ?c)
-		if(! ~ $i cc rc) @{
-			cd $i
-			mk clean
-			objtype=$cputype mk install
-			mk clean
-		}
-	for(i in ?c)
-		if(! ~ $i cc rc) @{
-			cd $i
-			mk clean
-			mk installall
-			mk clean
-		}


[-- Attachment #3: src.diff --]
[-- Type: application/octet-stream, Size: 875 bytes --]

diff -r b43985308e3e sys/src/mkfile
--- a/sys/src/mkfile	Fri May 01 13:29:08 2020 -0700
+++ b/sys/src/mkfile	Fri May 01 18:18:42 2020 -0500
@@ -50,7 +50,7 @@
 none:VQ:
 	echo mk all, install, clean, nuke, release, kernels, or libs
 
-all install clean nuke:VQ:
+all clean nuke:VQ:
 	date
 	for (i in $LIBS $SUBSYS $CMDS) @{
 		cd $i
@@ -58,8 +58,27 @@
 	}
 	date
 
+install:VQ:
+	date
+	if(~ $objtype spim 68000) {
+		echo $objtype architecture unsupported.
+		exit
+	}
+	for (i in libc libbio libstdio cmd/$O^(c a l) cmd/cpp) @{
+		cd $i
+		mk clean
+		mk install
+		mk clean
+	}
+	for (i in $LIBS $SUBSYS $CMDS) @{
+		cd $i
+		mk install
+	}
+	date
+
 installall:V:
-	echo "installall not supported"
+	for (objtype in $CPUS)
+		mk install
 
 release:V:
 	mk nuke
@@ -91,9 +110,3 @@
 		cd $i
 		mk clean
 	}
-
-updatelibs:V:
-	for (i in $LIBS) @{
-		cd $i
-		mk update
-	}


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-05-12  1:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29  4:12 cmd/mkfile rewrite Amavect .
2020-04-30 18:49 ` [9front] " cinap_lenrek
2020-05-01  1:00   ` Amavect .
2020-05-01 14:34     ` cinap_lenrek
2020-05-01 17:27       ` Amavect
2020-05-01 18:18         ` ori
2020-05-01 18:33           ` cinap_lenrek
2020-05-01 23:43             ` Amavect .
2020-05-02  0:04               ` ori
2020-05-12  1:18                 ` Amavect .
2020-05-01 18:26         ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).