9front - general discussion about 9front
 help / color / mirror / Atom feed
From: BurnZeZ@feline.systems
To: 9front@9front.org
Subject: /sys/src/cmd/mkfile *.y error prevention
Date: Sun, 4 Sep 2016 23:16:29 -0400	[thread overview]
Message-ID: <e7dd0d822eadeed2842c044be55c397f@meiling.znet> (raw)

[-- 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

                 reply	other threads:[~2016-09-05  3:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7dd0d822eadeed2842c044be55c397f@meiling.znet \
    --to=burnzez@feline.systems \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).