9front - general discussion about 9front
 help / color / mirror / Atom feed
* /sys/src/cmd/mkfile *.y error prevention
@ 2016-09-05  3:16 BurnZeZ
  0 siblings, 0 replies; only message in thread
From: BurnZeZ @ 2016-09-05  3:16 UTC (permalink / raw)
  To: 9front

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

Attached diff is a suggested change to simplify[citation needed] the
yfile stuff (only one change is needed to add a new yfile).

There's probably a better way to do it, but I'm not a mk wizard.

[-- Attachment #2: mkfile.diff --]
[-- Type: text/plain, Size: 1158 bytes --]

diff -r 094727ce1d7a sys/src/cmd/mkfile
--- a/sys/src/cmd/mkfile	Sat Sep 03 19:05:28 2016 +0200
+++ b/sys/src/cmd/mkfile	Sun Sep 04 23:08:50 2016 -0400
@@ -4,6 +4,8 @@
 HFILES=/$objtype/include/u.h /sys/include/libc.h /sys/include/bio.h
 BIN=/$objtype/bin
 PROGS=${TARG:%=$O.%}
+YPROGS=bc mpc pc units # subset of $PROGS
+YEXPR=`{echo $YPROGS | sed 's/ /|/g; s/^(.*)$/(\1)/'}
 LDFLAGS=
 YFLAGS=-d
 
@@ -82,7 +84,7 @@
 directories:V:	install.directories
 
 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
+	rm -f [$OS].out *.[$OS] y.tab.? y.debug y.output [$OS].$TARG $TARG $YPROGS.c $YPROGS.tab.h [$OS]._cp
 
 %.clean:V:
 	rm -f [$OS].$stem $stem.[$OS]
@@ -103,12 +105,12 @@
 		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
+	rm -f $stem.[$OS] y.tab.? $stem.tab.? y.debug y.output [$OS].$stem $YPROGS.c
 
 %.acid: %.$O $HFILES
 	$CC $CFLAGS -a $stem.c >$target
 
-(bc|units|mpc|pc).c:R:	\1.tab.c
+$YEXPR.c:R:	\1.tab.c
 	mv $stem1.tab.c $stem1.c
 
 $BIN/init:	$O.init

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-05  3:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-05  3:16 /sys/src/cmd/mkfile *.y error prevention BurnZeZ

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).