Add targets definition files
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 23 Aug 2014 22:03:00 +0000 (18:03 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 24 Nov 2014 13:56:10 +0000 (08:56 -0500)
Clean code to configure OS, architecture and ABI

functions/main
targets/arm926ejs [new file with mode: 0644]
targets/default [new file with mode: 0644]
targets/m68k [new file with mode: 0644]
targets/x86 [new file with mode: 0644]
targets/x86_64 [new file with mode: 0644]

index 357eb19..b92bf26 100644 (file)
@@ -94,34 +94,15 @@ DEFAULT_IPKG_SCRIPT="ipkg.def"
 
 HVMAKE="make -j ${MAKEJOBS}"
 
-case "${HVL_TARGET}" in
-    arm926*)
-        CLFS_BUILDFLAGS="-mabi=aapcs-linux -mfloat-abi=soft"
-        CLFS_TARGET="arm-linux-gnueabi"
-        CLFS_ARCH=arm
-       ;;
-    "x86_64")
-       CLFS_BUILDFLAGS="-m64"
-        CLFS_TARGET="${HVL_TARGET}-unknown-linux-gnu"
-        CLFS_ARCH=${HVL_TARGET}
-       ;;
-    "x86")
-        # No special flags
-       CLFS_BUILDFLAGS=""
-        CLFS_TARGET="i686-unknown-linux-gnu"
-        CLFS_ARCH=${HVL_TARGET}
-       ;;
-    m68k*)
-       #CLFS_BUILDFLAGS="-mcpu=51jm"
-       CLFS_BUILDFLAGS=""
-        CLFS_TARGET="${HVL_TARGET}-unknown-linux-gnu"
-        CLFS_ARCH=${HVL_TARGET}
-       ;;
-    *)
-       echo "Unsupported target architecture: ${HVL_TARGET}"
-       return ${EXIT_FAILURE}
-       ;;
-esac
+# Load default values. They can be overriden
+# by a target-specific file
+source ../targets/default
+
+if [ -f ../targets/${HVL_TARGET} ]; then
+    source ../targets/${HVL_TARGET}
+fi
+
+CLFS_TARGET="${CLFS_ARCH}-${CLFS_OS}-${CLFS_ABI}"
 
 CLFS_HOST="$(echo $MACHTYPE | \
     sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
diff --git a/targets/arm926ejs b/targets/arm926ejs
new file mode 100644 (file)
index 0000000..bade0e1
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+CLFS_BUILDFLAGS="-mabi=aapcs-linux -mfloat-abi=soft"
+CLFS_ARCH=arm
+CLFS_ABI="gnueabi"
+
diff --git a/targets/default b/targets/default
new file mode 100644 (file)
index 0000000..a2be344
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+CLFS_BUILDFLAGS=""
+CLFS_ARCH=${HVL_TARGET}
+CLFS_OS="linux"
+CLFS_ABI="gnu"
diff --git a/targets/m68k b/targets/m68k
new file mode 100644 (file)
index 0000000..6bea319
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+#CLFS_BUILDFLAGS="-mcpu=51jm"
diff --git a/targets/x86 b/targets/x86
new file mode 100644 (file)
index 0000000..7a693aa
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+
diff --git a/targets/x86_64 b/targets/x86_64
new file mode 100644 (file)
index 0000000..739bf95
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+CLFS_BUILDFLAGS="-m64"
+CLFS_OS="unknown-linux"
+