RFC: $(ARCH) in file

Riley Williams rhw en MemAlpha.CX
Vie Ene 28 21:35:12 CST 2000


Hi Khimenko.

 >>>> Why do I want this? Because I often build for an architecture
 >>>> which is not the native one. Saving the architecture in .arch
 >>>> is more convenient then typing "make ARCH=foo".

 >>> How tough is it to edit the makefile? :)

 >> Not tough, but I think it's easier for people to type

 >>         echo FOO >.arch

 >> than to mess with the Makefile.

 > It's usually MUCH better to mess with the Makefile then to add
 > kludges in mainstream kernel. I think probability of acception
 > is zero.

Whilst I'd agree with you over that, how about something like the
following patch:

===8<=== CUT ===>8===

--- linux-2.2.14/Makefile~	Tue Jan  4 18:12:10 2000
+++ linux-2.2.14/Makefile	Fri Jan 28 17:41:25 2000
@@ -216,6 +216,9 @@
 Version: dummy
 	@rm -f include/linux/compile.h
 
+arch:
+	ARCH=$(scripts/setarch)
+
 boot: vmlinux
 	@$(MAKE) -C arch/$(ARCH)/boot
 
--- linux-2.2.14/scripts/setarch~	Sat Jan  1 00:00:00 1970
+++ linux-2.2.14/scripts/setarch	Fri Jan 28 17:49:56 2000
@@ -0,0 +1,23 @@
+#!/bin/bash
+echo
+echo Which architecture should I compile for:
+echo
+declare -i N=0
+ARCHES=`ls -1d arch/* | cut -d / -f 2 | tr -s '\t\r\n' '   '`
+for ARCH in $ARCHES ; do
+    N=$N+1
+    printf '%3u: %s\n' $N `basename $ARCH`
+done
+echo
+R=0
+while [ $R -eq 0 ]; do
+    echo -n 'Your choice: '
+    sed 's/^ *//' | while read LINE ; do
+	if [ -n "$LINE" -a -z "`echo $LINE | sed 's/[0-9]*//'`" ]; then
+	    if [ $LINE -gt 0 -a $LINE -le $N ]; then
+		R=`echo $LINE`
+	    fi
+	fi
+    done
+done
+echo $ARCHES | cut -d ' ' -f $R

===8<=== CUT ===>8===

That then allows one to do...

 Q> make arch makefile
 Q> make arch dep clean modules modules_install bzImage

..and one actually gets asked which architecture one requires.
However, if one omits the "arch" from those lines, it just uses the
native architecture.

Best wishes from Riley.

 * Copyright (C) 1999, Memory Alpha Systems.
 * All rights and wrongs reserved.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux  |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch.   |
+----------------------------------------------------------------------+
 * http://www.memalpha.cx/Linux/Kernel/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda