Re: Patch to ask if user has egcs/pgcc / add me to credits

Phil Rosenthal (lkernel@villaweb.net)
Sat, 27 Jun 1998 22:48:09 -0400 (EDT)


Something I just realized...
for pgcc/egcs: there are other flags like -mamdk6
Doesn't this ask that we add another thing to the processor type so that
there can be a -mamdk6 option to compile the kernel optimized for the AMD
chips? (there may be other -m options too, I just know about amdk6)
--Phil Rosenthal

On Fri, 26 Jun 1998, Niels Kristian Bech Jensen wrote:

> On Fri, 26 Jun 1998, Peter-Paul Witta wrote:
>
> > On Tue, 23 Jun 1998, Marcelo de Paula Bezerra wrote:
> >
> >
> > why couldn't we simply parse a gcc --version in the toplevel makefile,
> > and set variables correspondig so that the arch/xxxx/Makefile can
> > implement proper compiling flags?
> >
> > i guess this hasnt been done yet because it's a Bad Idea. could someone
> > kindly express why?
> >
> I've done it for the Intel platform. Try this patch. Feedback is welcome.
>
> diff -urN linux-2.1.106/Makefile linux/Makefile
> --- linux-2.1.106/Makefile Wed Jun 17 06:57:01 1998
> +++ linux/Makefile Wed Jun 24 09:40:03 1998
> @@ -24,7 +24,7 @@
> FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
>
> HOSTCC =gcc
> -HOSTCFLAGS =-O2 -fomit-frame-pointer
> +HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>
> CROSS_COMPILE =
>
> @@ -85,7 +85,7 @@
> # standard CFLAGS
> #
>
> -CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
> +CFLAGS = $(HOSTCFLAGS)
>
> ifdef SMP
> CFLAGS += -D__SMP__
> @@ -155,21 +155,10 @@
>
> include arch/$(ARCH)/Makefile
>
> -ifdef SMP
> -
> .S.s:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
> -
> -else
> -
> -.S.s:
> - $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
> -
> -endif
>
> Version: dummy
> @rm -f include/linux/compile.h
> diff -urN linux-2.1.106/arch/i386/Makefile linux/arch/i386/Makefile
> --- linux-2.1.106/arch/i386/Makefile Wed Jun 17 06:53:55 1998
> +++ linux/arch/i386/Makefile Wed Jun 24 09:41:06 1998
> @@ -13,39 +13,51 @@
> # Copyright (C) 1994 by Linus Torvalds
> #
>
> -AS86 =$(CROSS_COMPILE)as86 -0 -a
> -AS386 =$(CROSS_COMPILE)as86 -3
> -LD86 =$(CROSS_COMPILE)ld86 -0
> -
> LD=$(CROSS_COMPILE)ld -m elf_i386
> CPP=$(CC) -E
> OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
> LDFLAGS=-e stext
> LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS)
>
> -CFLAGS_PIPE := -pipe
> +OLD_GCC := $(shell if $(CC) -v 2>&1 | grep 'version 2.7' > /dev/null; then echo y; else echo n; fi)
> +
> CFLAGS_NSR := -fno-strength-reduce
> -CFLAGS := $(CFLAGS) $(CFLAGS_PIPE) $(CFLAGS_NSR)
> +CFLAGS_ALIGN := -malign-loops=2 -malign-jumps=2 -malign-functions=2
>
> ifdef CONFIG_M386
> -CFLAGS := $(CFLAGS) -m386 -DCPU=386
> +ifeq ($(OLD_GCC),y)
> +CFLAGS_PROC := $(CFLAGS_NSR) -m386 -DCPU=386
> +else
> +CFLAGS_PROC := -march=i386 -DCPU=386
> +endif
> endif
>
> ifdef CONFIG_M486
> -CFLAGS := $(CFLAGS) -m486 -DCPU=486
> +ifeq ($(OLD_GCC),y)
> +CFLAGS_PROC := $(CFLAGS_NSR) -m486 -DCPU=486
> +else
> +CFLAGS_PROC := -march=i486 -DCPU=486
> +endif
> endif
>
> ifdef CONFIG_M586
> -CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
> +ifeq ($(OLD_GCC),y)
> +CFLAGS_PROC := $(CFLAGS_NSR) -m486 $(CFLAGS_ALIGN) -DCPU=586
> +else
> +CFLAGS_PROC := -march=pentium -DCPU=586
> +endif
> endif
>
> ifdef CONFIG_M686
> -CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
> +ifeq ($(OLD_GCC),y)
> +CFLAGS_PROC := $(CFLAGS_NSR) -m486 $(CFLAGS_ALIGN) -DCPU=686
> +else
> +CFLAGS_PROC := -march=pentiumpro -DCPU=686
> endif
> -
> -ifdef SMP
> -CFLAGS := $(CFLAGS) -D__SMP__
> endif
> +
> +CFLAGS_PIPE := -pipe
> +CFLAGS := $(CFLAGS) $(CFLAGS_PIPE) $(CFLAGS_PROC)
>
> HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
>
> diff -urN linux-2.1.106/arch/i386/boot/Makefile linux/arch/i386/boot/Makefile
> --- linux-2.1.106/arch/i386/boot/Makefile Thu Apr 24 04:01:14 1997
> +++ linux/arch/i386/boot/Makefile Wed Jun 24 09:40:03 1998
> @@ -8,9 +8,8 @@
> # Copyright (C) 1994 by Linus Torvalds
> #
>
> -ifdef SMP
> -HOSTCFLAGS := $(HOSTCFLAGS) -D__SMP__
> -endif
> +AS86 =$(CROSS_COMPILE)as86 -0 -a
> +LD86 =$(CROSS_COMPILE)ld86 -0
>
> BOOT_INCL = $(TOPDIR)/include/linux/config.h \
> $(TOPDIR)/include/linux/autoconf.h \
> diff -urN linux-2.1.106/arch/i386/boot/compressed/Makefile linux/arch/i386/boot/compressed/Makefile
> --- linux-2.1.106/arch/i386/boot/compressed/Makefile Mon Dec 22 02:27:17 1997
> +++ linux/arch/i386/boot/compressed/Makefile Wed Jun 24 09:40:03 1998
> @@ -22,10 +22,6 @@
> ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
> BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
>
> -ifdef SMP
> -CFLAGS := $(CFLAGS) -D__SMP__
> -endif
> -
> all: vmlinux
>
> vmlinux: piggy.o $(OBJECTS)
> @@ -34,18 +30,8 @@
> bvmlinux: piggy.o $(OBJECTS)
> $(LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o
>
> -ifdef SMP
> -
> head.o: head.S $(TOPDIR)/include/linux/tasks.h
> - $(CC) -D__SMP__ -traditional -c head.S
> -
> -else
> -
> -head.o: head.S $(TOPDIR)/include/linux/tasks.h
> - $(CC) -traditional -c head.S
> -
> -endif
> -
> + $(CC) $(AFLAGS) -traditional -c head.S
>
> piggy.o: $(SYSTEM)
> tmppiggy=_tmp_$$$$piggy; \
> diff -urN linux-2.1.106/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile
> --- linux-2.1.106/arch/i386/kernel/Makefile Wed Jun 17 06:52:11 1998
> +++ linux/arch/i386/kernel/Makefile Wed Jun 24 09:40:03 1998
> @@ -7,13 +7,8 @@
> #
> # Note 2! The CFLAGS definitions are now in the main makefile...
>
> -ifdef SMP
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
> -else
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
> -endif
>
> all: kernel.o head.o init_task.o
>
> @@ -39,19 +34,11 @@
> endif
> endif
>
> -
> ifdef SMP
> -
> O_OBJS += io_apic.o smp.o trampoline.o
> +endif
>
> head.o: head.S $(TOPDIR)/include/linux/tasks.h
> - $(CC) -D__ASSEMBLY__ -D__SMP__ -traditional -c $*.S -o $*.o
> -
> -else
> -
> -head.o: head.S $(TOPDIR)/include/linux/tasks.h
> - $(CC) -D__ASSEMBLY__ -traditional -c $*.S -o $*.o
> -
> -endif
> + $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $*.S -o $*.o
>
> include $(TOPDIR)/Rules.make
> diff -urN linux-2.1.106/arch/i386/lib/Makefile linux/arch/i386/lib/Makefile
> --- linux-2.1.106/arch/i386/lib/Makefile Sat Jan 10 23:51:20 1998
> +++ linux/arch/i386/lib/Makefile Wed Jun 24 09:40:03 1998
> @@ -2,13 +2,8 @@
> # Makefile for i386-specific library files..
> #
>
> -ifdef SMP
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
> -else
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
> -endif
>
> L_TARGET = lib.a
> L_OBJS = checksum.o semaphore.o locks.o delay.o usercopy.o getuser.o putuser.o
> diff -urN linux-2.1.106/arch/sparc/kernel/Makefile linux/arch/sparc/kernel/Makefile
> --- linux-2.1.106/arch/sparc/kernel/Makefile Wed Jun 17 06:51:33 1998
> +++ linux/arch/sparc/kernel/Makefile Wed Jun 24 09:40:03 1998
> @@ -7,24 +7,12 @@
> #
> # Note 2! The CFLAGS definitions are now in the main makefile...
>
> -ifdef SMP
> -
> .S.s:
> $(CPP) -D__ASSEMBLY__ $(AFLAGS) -ansi $< -o $*.s
>
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c $< -o $*.o
>
> -else
> -
> -.S.s:
> - $(CPP) -D__ASSEMBLY__ -ansi $< -o $*.s
> -
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -ansi -c $< -o $*.o
> -
> -endif
> -
> all: kernel.o head.o init_task.o
>
> O_TARGET := kernel.o
> @@ -46,17 +34,8 @@
> O_OBJS += auxio.o
> endif
>
> -ifdef SMP
> -
> head.o: head.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c $*.S -o $*.o
> -
> -else
> -
> -head.o: head.S
> - $(CC) -D__ASSEMBLY__ -ansi -c $*.S -o $*.o
> -
> -endif
>
> check_asm: dummy
> @echo "/* Automatically generated. Do not edit. */" > asm_offsets.h
> diff -urN linux-2.1.106/arch/sparc/lib/Makefile linux/arch/sparc/lib/Makefile
> --- linux-2.1.106/arch/sparc/lib/Makefile Wed Jun 17 06:51:34 1998
> +++ linux/arch/sparc/lib/Makefile Wed Jun 24 09:40:03 1998
> @@ -45,8 +45,6 @@
> memset.o: memset.S
> $(CC) -D__ASSEMBLY__ -ansi -c -o memset.o memset.S
>
> -ifdef SMP
> -
> locks.o: locks.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c -o locks.o locks.S
>
> @@ -56,20 +54,9 @@
> bitops.o: bitops.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c -o bitops.o bitops.S
>
> +ifdef SMP
> irqlock.o: irqlock.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c -o irqlock.o irqlock.S
> -
> -else
> -
> -locks.o: locks.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o locks.o locks.S
> -
> -atomic.o: atomic.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o atomic.o atomic.S
> -
> -bitops.o: bitops.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o bitops.o bitops.S
> -
> endif
>
> strlen.o: strlen.S
> diff -urN linux-2.1.106/arch/sparc/mm/Makefile linux/arch/sparc/mm/Makefile
> --- linux-2.1.106/arch/sparc/mm/Makefile Wed Jun 17 06:51:34 1998
> +++ linux/arch/sparc/mm/Makefile Wed Jun 24 09:40:03 1998
> @@ -22,8 +22,6 @@
>
> include $(TOPDIR)/Rules.make
>
> -ifdef SMP
> -
> hypersparc.o: hypersparc.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c -o hypersparc.o hypersparc.S
>
> @@ -35,19 +33,3 @@
>
> tsunami.o: tsunami.S
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c -o tsunami.o tsunami.S
> -
> -else
> -
> -hypersparc.o: hypersparc.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o hypersparc.o hypersparc.S
> -
> -turbosparc.o: turbosparc.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o turbosparc.o turbosparc.S
> -
> -viking.o: viking.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o viking.o viking.S
> -
> -tsunami.o: tsunami.S
> - $(CC) -D__ASSEMBLY__ -ansi -c -o tsunami.o tsunami.S
> -
> -endif
> diff -urN linux-2.1.106/arch/sparc64/kernel/Makefile linux/arch/sparc64/kernel/Makefile
> --- linux-2.1.106/arch/sparc64/kernel/Makefile Wed Jun 17 06:51:37 1998
> +++ linux/arch/sparc64/kernel/Makefile Wed Jun 24 09:40:03 1998
> @@ -7,23 +7,11 @@
> #
> # Note 2! The CFLAGS definitions are now in the main makefile...
>
> -ifdef SMP
> -
> .S.s:
> $(CPP) -D__ASSEMBLY__ $(AFLAGS) -ansi $< -o $*.s
>
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c $< -o $*.o
> -
> -else
> -
> -.S.s:
> - $(CPP) -D__ASSEMBLY__ -ansi $< -o $*.s
> -
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -ansi -c $< -o $*.o
> -
> -endif
>
> all: kernel.o head.o init_task.o
>
> diff -urN linux-2.1.106/arch/sparc64/mm/Makefile linux/arch/sparc64/mm/Makefile
> --- linux-2.1.106/arch/sparc64/mm/Makefile Thu Jul 31 22:09:17 1997
> +++ linux/arch/sparc64/mm/Makefile Wed Jun 24 09:40:03 1998
> @@ -7,23 +7,11 @@
> #
> # Note 2! The CFLAGS definition is now in the main makefile...
>
> -ifdef SMP
> -
> .S.s:
> $(CPP) -D__ASSEMBLY__ $(AFLAGS) -ansi $< -o $*.s
>
> .S.o:
> $(CC) -D__ASSEMBLY__ $(AFLAGS) -ansi -c $< -o $*.o
> -
> -else
> -
> -.S.s:
> - $(CPP) -D__ASSEMBLY__ -ansi $< -o $*.s
> -
> -.S.o:
> - $(CC) -D__ASSEMBLY__ -ansi -c $< -o $*.o
> -
> -endif
>
> O_TARGET := mm.o
> O_OBJS := ultra.o fault.o init.o generic.o asyncd.o extable.o modutil.o
> diff -urN linux-2.1.106/drivers/char/Makefile linux/drivers/char/Makefile
> --- linux-2.1.106/drivers/char/Makefile Wed Jun 17 06:55:59 1998
> +++ linux/drivers/char/Makefile Wed Jun 24 09:40:04 1998
> @@ -456,7 +456,7 @@
> fastdep:
>
> conmakehash: conmakehash.c
> - $(HOSTCC) -o conmakehash conmakehash.c
> + $(HOSTCC) $(HOSTCFLAGS) -o conmakehash conmakehash.c
>
> consolemap_deftbl.c: $(FONTMAPFILE) conmakehash
> ./conmakehash $(FONTMAPFILE) > consolemap_deftbl.c
> diff -urN linux-2.1.106/drivers/char/conmakehash.c linux/drivers/char/conmakehash.c
> --- linux-2.1.106/drivers/char/conmakehash.c Wed Jun 17 06:45:06 1998
> +++ linux/drivers/char/conmakehash.c Wed Jun 24 09:40:04 1998
> @@ -52,7 +52,6 @@
> void addpair(int fp, int un)
> {
> int i;
> - unicode hu;
>
> if ( un <= 0xfffe )
> {
> diff -urN linux-2.1.106/drivers/char/hfmodem/Makefile linux/drivers/char/hfmodem/Makefile
> --- linux-2.1.106/drivers/char/hfmodem/Makefile Tue Aug 5 18:48:55 1997
> +++ linux/drivers/char/hfmodem/Makefile Wed Jun 24 09:40:04 1998
> @@ -25,7 +25,7 @@
> .PHONY: all
>
> gentbl: gentbl.c
> - $(HOSTCC) -Wall $< -o $@ -lm
> + $(HOSTCC) $(HOSTCFLAGS) $< -o $@ -lm
>
> TBLHDR := tables.h
>
> diff -urN linux-2.1.106/drivers/net/hamradio/soundmodem/Makefile linux/drivers/net/hamradio/soundmodem/Makefile
> --- linux-2.1.106/drivers/net/hamradio/soundmodem/Makefile Thu Sep 4 22:25:28 1997
> +++ linux/drivers/net/hamradio/soundmodem/Makefile Wed Jun 24 09:40:04 1998
> @@ -46,7 +46,7 @@
> .PHONY: all
>
> gentbl: gentbl.c
> - $(HOSTCC) -Wall $< -o $@ -lm
> + $(HOSTCC) $(HOSTCFLAGS) $< -o $@ -lm
>
> TBLHDR := sm_tbl_afsk1200.h sm_tbl_afsk2400_8.h
> TBLHDR += sm_tbl_afsk2666.h sm_tbl_psk4800.h
> diff -urN linux-2.1.106/drivers/net/hamradio/soundmodem/gentbl.c linux/drivers/net/hamradio/soundmodem/gentbl.c
> --- linux-2.1.106/drivers/net/hamradio/soundmodem/gentbl.c Wed Jun 17 06:49:51 1998
> +++ linux/drivers/net/hamradio/soundmodem/gentbl.c Wed Jun 24 09:40:04 1998
> @@ -438,7 +438,7 @@
> {
> int i, j, k, l;
> float s;
> - float c[40];
> + float c[44];
> float min, max;
>
> fprintf(f, "\n/*\n * hapn4800 specific tables\n */\n\n");
> diff -urN linux-2.1.106/drivers/sound/Makefile linux/drivers/sound/Makefile
> --- linux-2.1.106/drivers/sound/Makefile Wed Jun 17 06:57:10 1998
> +++ linux/drivers/sound/Makefile Wed Jun 24 09:40:04 1998
> @@ -185,10 +185,10 @@
> # First make the utilities.
>
> bin2hex: bin2hex.c
> - $(HOSTCC) -o bin2hex bin2hex.c
> + $(HOSTCC) $(HOSTCFLAGS) -o bin2hex bin2hex.c
>
> hex2hex: hex2hex.c
> - $(HOSTCC) -o hex2hex hex2hex.c
> + $(HOSTCC) $(HOSTCFLAGS) -o hex2hex hex2hex.c
>
>
>
> diff -urN linux-2.1.106/scripts/Makefile linux/scripts/Makefile
> --- linux-2.1.106/scripts/Makefile Mon Jan 5 10:41:01 1998
> +++ linux/scripts/Makefile Wed Jun 24 09:40:04 1998
> @@ -1,4 +1,3 @@
> -HOSTCFLAGS:=$(HOSTCFLAGS) -g -Wall
> HEADER=header.tk
> TAIL=tail.tk
>
> diff -urN linux-2.1.106/scripts/lxdialog/Makefile linux/scripts/lxdialog/Makefile
> --- linux-2.1.106/scripts/lxdialog/Makefile Sat Apr 20 10:18:14 1996
> +++ linux/scripts/lxdialog/Makefile Wed Jun 24 09:40:04 1998
> @@ -1,8 +1,7 @@
> -CC = gcc
> -CPP = gcc -E
> -OPTIM = -O2 -Wall -fomit-frame-pointer
> +CC = $(HOSTCC)
> +CPP = $(HOSTCC) -E
>
> -CFLAGS = $(OPTIM) -DLOCALE
> +CFLAGS = $(HOSTCFLAGS) -DLOCALE
> LDFLAGS = -s -L .
> LDLIBS = -lncurses
>
>
> --
> Med venlig hilsen / Best regards
> nkbj@image.dk
> Niels Kristian Bech Jensen http://www.image.dk/~nkbj/
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu