Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2013 13:47:13 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253424 - head/sbin/route
Message-ID:  <201307171347.r6HDlDeK099114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Wed Jul 17 13:47:13 2013
New Revision: 253424
URL: http://svnweb.freebsd.org/changeset/base/253424

Log:
  Simplify keywords.h generation.

Modified:
  head/sbin/route/Makefile

Modified: head/sbin/route/Makefile
==============================================================================
--- head/sbin/route/Makefile	Wed Jul 17 13:41:54 2013	(r253423)
+++ head/sbin/route/Makefile	Wed Jul 17 13:47:13 2013	(r253424)
@@ -7,7 +7,7 @@ PROG=	route
 MAN=	route.8
 SRCS=	route.c keywords.h
 WARNS?=	3
-CLEANFILES+=keywords.h _keywords.tmp
+CLEANFILES+=keywords.h
 
 CFLAGS+= -DNS
 
@@ -18,13 +18,9 @@ CFLAGS+= -DINET6
 CFLAGS+= -I.
 
 keywords.h: keywords
-	sed -e '/^#/d' -e '/^$$/d' ${.CURDIR}/keywords > _keywords.tmp
-	LC_ALL=C tr 'a-z' 'A-Z' < _keywords.tmp | paste _keywords.tmp - | \
-	    awk '{ \
-		if (NF > 1) \
-			printf "#define\tK_%s\t%d\n\t{\"%s\", K_%s},\n", \
-			    $$2, NR, $$1, $$2 }' \
-	    > ${.TARGET}
-	rm -f _keywords.tmp
+	LC_ALL=C awk '!/^#|^$$/ { \
+		printf "#define\tK_%s\t%d\n\t{\"%s\", K_%s},\n", \
+		    toupper($$1), ++L, $$1, toupper($$1); \
+	}' < ${.CURDIR}/keywords > ${.TARGET} || (rm -f ${.TARGET}; false)
 
 .include <bsd.prog.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307171347.r6HDlDeK099114>