Skip to contentSkip to conversation

perl removal: Use sed instead of perl to generate x86/kernel/cpu/capflags.c.

PATCH New Rob Landley 1 participant 1 message Jan 23, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 perl removal: Use sed instead of perl to generate x86/kernel/cpu/capflags.c.

From: Rob Landley <[email protected]>

Replace perl header file generator with smaller/faster/simpler C version.

Hasn't changed since last submission, which was:

Message-ID: <[email protected]>
Subject: Re: [PATCH] Use sed instead of perl to generate x86/kernel/cpu/capflags.c.

---

I ran the attached test script to compare the output of the C program with the output of the perl version for every HZ from 1 to 5000 to make sure it was producing the same constants.

 kernel/Makefile      |   10 -
 kernel/mktimeconst.c |  109 +++++++++++
 kernel/timeconst.pl  |  378 -----------------------------------------
 3 files changed, 115 insertions(+), 382 deletions(-)
kernel/Makefile +6 -4
index 5669f71..ba9ce6d 100644
@@ -133,8 +133,10 @@ $(obj)/config_data.h: $(obj)/config_data.gz FORCE
 
 $(obj)/time.o: $(obj)/timeconst.h
 
-quiet_cmd_timeconst  = TIMEC   $@
-      cmd_timeconst  = $(PERL) $< $(CONFIG_HZ) > $@
+hostprogs-y	+= mktimeconst
+quiet_cmd_mktimeconst = TIMEC   $@
+	cmd_mktimeconst = $(obj)/mktimeconst $(CONFIG_HZ) $@ || ( rm -f $@ && exit 1 )
+
 targets += timeconst.h
-$(obj)/timeconst.h: $(src)/timeconst.pl FORCE
-	$(call if_changed,timeconst)
+$(obj)/timeconst.h: $(obj)/mktimeconst FORCE
+	$(call if_changed,mktimeconst)
kernel/mktimeconst.c new file +109 -0

109 lines not on this page · raw message

kernel/timeconst.pl deleted +0 -378

378 lines not on this page · raw message

--------------070402000802050303040701
Content-Type: application/x-sh; name="loopy.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="loopy.sh"

#!/bin/bash

gcc mktimeconst.c || exit 1

X=1
while [ $X -lt 5000 ]
do
echo $X

perl ~/linux/linux/kernel/timeconst.pl $X | sed 's/KERNEL_TIMECONST/__KERNEL_TIMECONST/;/Automatically generated/d;/^$/d'> temp.txt ./a.out $X temp2.txt
sed -i '/Automatically generated/d;/^$/d' temp2.txt

  diff -uw temp.txt temp2.txt || exit 1

X=$(($X+1))
done

--------------070402000802050303040701--