207dd0be21b447dd1138c0ac8aa72a75cdbff7fe
[librecmc/librecmc.git] / openwrt / target / linux / linux-2.4 / patches / generic / 006-build_flags.patch
1 diff -urN linux.old/Makefile linux.dev/Makefile
2 --- linux.old/Makefile  2005-08-26 13:41:41.689634168 +0200
3 +++ linux.dev/Makefile  2005-08-26 13:44:34.233403528 +0200
4 @@ -17,9 +17,9 @@
5  FINDHPATH      = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
6  
7  HOSTCC         = gcc
8 -HOSTCFLAGS     = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
9 +HOSTCFLAGS     = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
10  
11 -CROSS_COMPILE  =
12 +CROSS_COMPILE=
13  
14  #
15  # Include the make variables (CC, etc...)
16 @@ -89,6 +89,8 @@
17  # standard CFLAGS
18  #
19  
20 +check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
21 +
22  CPPFLAGS := -D__KERNEL__ -I$(HPATH)
23  
24  CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
25 @@ -91,8 +93,10 @@
26  
27  CPPFLAGS := -D__KERNEL__ -I$(HPATH)
28  
29 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
30 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
31           -fno-strict-aliasing -fno-common
32 +
33 +
34  ifndef CONFIG_FRAME_POINTER
35  CFLAGS += -fomit-frame-pointer
36  endif
37 @@ -100,6 +105,12 @@
38  endif
39  AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
40  
41 +CFLAGS += $(call check_gcc, -funit-at-a-time,)
42 +
43 +
44 +
45 +
46 +
47  #
48  # ROOT_DEV specifies the default root-device when making the image.
49  # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
50 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
51 --- linux.old/arch/mips/Makefile        2005-11-07 23:12:50.582887000 +0100
52 +++ linux.dev/arch/mips/Makefile        2005-11-07 21:57:08.537629000 +0100
53 @@ -46,10 +46,10 @@
54  GCCFLAGS       := -I $(TOPDIR)/include/asm/gcc
55  GCCFLAGS       += -G 0 -mno-abicalls -fno-pic -pipe
56  GCCFLAGS       += $(call check_gcc, -finline-limit=100000,)
57 -LINKFLAGS      += -G 0 -static -n
58 -MODFLAGS       += -mlong-calls
59 +LINKFLAGS      += -G 0 -static -n -nostdlib
60 +MODFLAGS       += -mlong-calls -fno-common
61  
62 -ifdef CONFIG_DEBUG_INFO
63 +ifdef CONFIG_REMOTE_DEBUG
64  GCCFLAGS       += -g
65  ifdef CONFIG_SB1XXX_CORELIS
66  GCCFLAGS       += -mno-sched-prolog -fno-omit-frame-pointer
67 @@ -71,13 +71,13 @@
68  set_gccflags = $(shell \
69  while :; do \
70         cpu=$(1); isa=-$(2); \
71 -       for gcc_opt in -march= -mcpu=; do \
72 +       for gcc_opt in -march= -mtune=; do \
73                 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
74                         -xc /dev/null > /dev/null 2>&1 && \
75                         break 2; \
76         done; \
77         cpu=$(3); isa=-$(4); \
78 -       for gcc_opt in -march= -mcpu=; do \
79 +       for gcc_opt in -march= -mtune=; do \
80                 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
81                         -xc /dev/null > /dev/null 2>&1 && \
82                         break 2; \
83 @@ -92,7 +92,7 @@
84  fi; \
85  gas_abi=-Wa,-32; gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
86  while :; do \
87 -       for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
88 +       for gas_opt in -Wa,-march= -Wa,-mtune=; do \
89                 $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
90                         -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
91                         break 2; \
92 @@ -174,6 +174,7 @@
93  endif
94  
95  AFLAGS         += $(GCCFLAGS)
96 +ASFLAGS                += $(GCCFLAGS)
97  CFLAGS         += $(GCCFLAGS)
98  
99  LD             += -m $(ld-emul)