lkml.org 
[lkml]   [1998]   [Jun]   [18]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 18 Jun 1998 08:38:14 +0200 (CEST)
FromNiels Kristian Bech Jensen <>
Subject[2.1.106][PATCH] More consistent Makefiles -- please test.
Hi,
This patch updates some of the Makefiles in the 2.1.x source tree. The
changes are in two areas:

1. More consistent use of AFLAGS, HOSTCC and HOSTCFLAGS.
2. Uses the advantages of the new compilers (gcc-2.8.x, egcs, pgcc) on the
   Intel architecture.

Please CC any comments to me.


diff -urN linux-2.1.106/Makefile linux/Makefile
--- linux-2.1.106/Makefile	Wed Jun 17 06:57:01 1998
+++ linux/Makefile	Thu Jun 18 07:48:32 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
 
 CROSS_COMPILE 	=
 
@@ -85,7 +85,7 @@
 # standard CFLAGS
 #
 
-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+CFLAGS = $(HOSTCFLAGS) -fomit-frame-pointer
 
 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	Thu Jun 18 08:00:09 1998
@@ -23,28 +23,41 @@
 LDFLAGS=-e stext
 LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS)
 
+CC_MAJOR_VERSION := $(shell $(CC) -v 2>&1 | tail -1 | cut -b 13-15)
 CFLAGS_PIPE := -pipe
 CFLAGS_NSR  := -fno-strength-reduce
-CFLAGS := $(CFLAGS) $(CFLAGS_PIPE) $(CFLAGS_NSR)
+CFLAGS := $(CFLAGS) $(CFLAGS_PIPE)
 
 ifdef CONFIG_M386
-CFLAGS := $(CFLAGS) -m386 -DCPU=386
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m386 -DCPU=386
+else
+CFLAGS := $(CFLAGS) -march=i386 -DCPU=386
+endif
 endif
 
 ifdef CONFIG_M486
-CFLAGS := $(CFLAGS) -m486 -DCPU=486
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -DCPU=486
+else
+CFLAGS := $(CFLAGS) -march=i486 -DCPU=486
+endif
 endif
 
 ifdef CONFIG_M586
-CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+else
+CFLAGS := $(CFLAGS) -march=pentium -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+endif
 endif
 
 ifdef CONFIG_M686
-CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+else
+CFLAGS := $(CFLAGS) -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
 endif
-
-ifdef SMP
-CFLAGS := $(CFLAGS) -D__SMP__
 endif
 
 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	Thu Jun 18 08:00:53 1998
@@ -8,10 +8,6 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
-ifdef SMP
-HOSTCFLAGS := $(HOSTCFLAGS) -D__SMP__
-endif
-
 BOOT_INCL =	$(TOPDIR)/include/linux/config.h \
 		$(TOPDIR)/include/linux/autoconf.h \
 		$(TOPDIR)/include/asm/boot.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	Thu Jun 18 08:01:47 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	Thu Jun 18 08:03:14 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	Thu Jun 18 08:03:31 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	Thu Jun 18 08:09:29 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	Thu Jun 18 08:10:25 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	Thu Jun 18 08:10:47 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	Thu Jun 18 08:11:57 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	Thu Jun 18 08:12:12 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	Thu Jun 18 07:53:24 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/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	Thu Jun 18 07:50:56 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	Thu Jun 18 07:51:39 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/sound/Makefile linux/drivers/sound/Makefile
--- linux-2.1.106/drivers/sound/Makefile	Wed Jun 17 06:57:10 1998
+++ linux/drivers/sound/Makefile	Thu Jun 18 07:52:32 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	Thu Jun 18 07:49:09 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	Thu Jun 18 07:50:18 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

\
 
 \ /
  Last update: 2005-03-22 12:43    [from the cache]
©2003-2008