]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Add mach-type generation for SH
authorPaul Mundt <lethal@linux-sh.org>
Sun, 15 Jun 2003 02:56:00 +0000 (19:56 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 15 Jun 2003 02:56:00 +0000 (19:56 -0700)
This adds the missing arch/sh/tools directory, which includes mach-type
generation scripts for building include/asm-sh/machtypes.h.

arch/sh/tools/Makefile [new file with mode: 0644]
arch/sh/tools/mach-types [new file with mode: 0644]
arch/sh/tools/machgen.sh [new file with mode: 0644]

diff --git a/arch/sh/tools/Makefile b/arch/sh/tools/Makefile
new file mode 100644 (file)
index 0000000..268bf3e
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# arch/sh/tools/Makefile
+#
+# Copyright (C) 2003  Paul Mundt
+#
+# This file is subject to the terms and conditions of the GNU General Public
+# License.  See the file "COPYING" in the main directory of this archive
+# for more details.
+#
+# Shamelessly cloned from ARM.
+#
+
+include/asm-sh/machtypes.h: $(obj)/machgen.sh $(obj)/mach-types
+       @echo '  Generating $@'
+       @$(CONFIG_SHELL) $(obj)/machgen.sh $(obj)/mach-types > $@
+
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
new file mode 100644 (file)
index 0000000..50fb93d
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# List of boards.
+#
+
+#
+# MACH_<xxx>           CONFIG_<xxx>
+#
+SE                     SH_SOLUTION_ENGINE
+7751SE                 SH_7751_SOLUTION_ENGINE         
+HP600                  SH_HP600
+HP620                  SH_HP620
+HP680                  SH_HP680
+HP690                  SH_HP690
+HD64461                        HD64461
+HD64465                        HD64465
+SH2000                 SH_SH2000
+SATURN                 SH_SATURN
+DREAMCAST              SH_DREAMCAST
+BIGSUR                 SH_BIGSUR
+ADX                    SH_ADX
+MPC1211                        SH_MPC1211
+
diff --git a/arch/sh/tools/machgen.sh b/arch/sh/tools/machgen.sh
new file mode 100644 (file)
index 0000000..5ccf3ba
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# include/asm-sh/machtype.h header generation script for SuperH
+#
+# Copyright (C) 2003 Paul Mundt
+#
+# This is pretty much a quick and dirty hack based off of the awk
+# script written by rmk that ARM uses to achieve the same sort of
+# thing.
+#
+# Unfortunately this script has a dependance on bash/sed/cut/tr,
+# though they should be prevalent enough for this dependancy not
+# to matter overly much.
+#
+# As a note for anyone attempting to manually invoke this script,
+# it expects to be run straight out of the arch/sh/tools/ directory
+# as it doesn't look at TOPDIR to figure out where asm-sh is
+# located.
+#
+# See the note at the top of the generated header for additional
+# information.
+#
+# Released under the terms of the GNU GPL v2.0.
+#
+
+[ $# -ne 1 ] && echo "Usage: $0 <mach defs>" && exit 1
+
+cat << EOF > tmp.h
+/*
+ * Automagically generated, don't touch.
+ */
+#ifndef __ASM_SH_MACHTYPES_H
+#define __ASM_SH_MACHTYPES_H
+
+#include <linux/config.h>
+
+/*
+ * We'll use the following MACH_xxx defs for placeholders for the time
+ * being .. these will all go away once sh_machtype is assigned per-board.
+ *
+ * For now we leave things the way they are for backwards compatibility.
+ */
+
+/* Mach types */
+EOF
+
+newline='
+'
+IFS=$newline
+
+rm -f tmp2.h
+
+for entry in `cat $1 | sed -e 's/\#.*$//g;/^$/d' | tr '\t' ' ' | tr -s ' '`; do
+       board=`echo $entry | cut -f1 -d' '`
+
+       printf "#ifdef CONFIG_`echo $entry | cut -f2 -d' '`\n" >> tmp.h
+       printf "  #define MACH_$board\t\t1\n#else\n  #define MACH_$board\t\t0\n#endif\n" >> tmp.h
+       printf "#define mach_is_`echo $board | tr '[A-Z]' '[a-z]'`()\t\t\t(MACH_$board)\n" >> tmp2.h
+done
+
+printf "\n/* Machtype checks */\n" >> tmp.h
+cat tmp2.h >> tmp.h && rm -f tmp2.h
+
+cat << EOF >> tmp.h
+
+#endif /* __ASM_SH_MACHTYPES_H */
+EOF
+
+cat tmp.h
+rm -f tmp.h
+