3 # Arch specific settings
\r
5 include $(ROOTDIR)/$(ARCH_PATH-y)/scripts/gcc.mk
\r
9 HOST := $(shell uname)
\r
12 # If we are using codesourcery and cygwin..
\r
13 ifneq ($(findstring CYGWIN,$(UNAME)),)
\r
14 cygpath:= $(shell cygpath -m $(shell which cygpath))
\r
15 export CYGPATH=$(cygpath)
\r
18 # ---------------------------------------------------------------------------
\r
20 # CCFLAGS - compile flags
\r
22 CC = $(CROSS_COMPILE)gcc
\r
23 cflags-$(CFG_OPT_RELEASE) += -O3
\r
24 cflags-$(CFG_OPT_DEBUG) += -g -O0
\r
26 # Remove sections if needed.. may be problems with other compilers here.
\r
27 #cflags-y += -ffunction-sections
\r
29 ifneq ($(filter -O2 -O3 -O1,$(cflags-y)),)
\r
30 cflags-y += -fno-schedule-insns -fno-schedule-insns2
\r
34 #cflags-y += -fno-common
\r
35 cflags-y += -std=gnu99
\r
37 # Generate dependencies
\r
42 #cflags-y += -Winline # warn if inline failed
\r
43 #cflags-y += -pedantic
\r
46 cflags-y += -fno-strict-aliasing # Use restict keyword instead.
\r
47 cflags-y += -fno-builtin
\r
49 # Get machine cflags
\r
50 #cflags-y += $(cflags-$(ARCH))
\r
52 CFLAGS = $(cflags-y) $(cflags-yy)
\r
56 # ---------------------------------------------------------------------------
\r
60 CPP_ASM_FLAGS = -x assembler-with-cpp
\r
64 space = $(empty) $(empty)
\r
67 # Libs related to GCC(libgcc.a, libgcov.a) is located under
\r
68 # lib/gcc/<machine>/<version>/<multilib>
\r
69 # Libs related to the library (libc.a,libm.a,etc) are under:
\r
70 # <machine>/lib/<multilib>
\r
72 # Can't remember why haven't I just used gcc to link instead of ld? (it should
\r
73 # figure out the things below by itself)
\r
75 # It seems some versions of make want "\=" and some "="
\r
76 # "=" - msys cpmake on windows 7
\r
77 gcc_lib_path := "$(subst /libgcc.a,,$(shell $(CC) $(CFLAGS) --print-libgcc-file-name))"
\r
78 gcc_lib_path := $(subst \libgcc.a,,$(gcc_lib_path))
\r
79 lib_lib_path := "$(subst /libc.a,,$(shell $(CC) $(CFLAGS) --print-file-name=libc.a))"
\r
80 lib_lib_path := $(subst \libc.a,,$(lib_lib_path))
\r
81 text_chunk := $(subst \,/,$(shell touch gcc_path_probe.c; $(CC) -v -c gcc_path_probe.c &> gcc_path_probe.tmp;gawk -f $(TOPDIR)/scripts/gcc_getinclude.awk gcc_path_probe.tmp))
\r
82 cc_inc_path := $(realpath $(text_chunk))
\r
83 libpath-y += -L$(lib_lib_path)
\r
84 libpath-y += -L$(gcc_lib_path)
\r
86 # ---------------------------------------------------------------------------
\r
89 # LDFLAGS - linker flags
\r
90 # LDOUT - How to Generate linker output file
\r
91 # LDMAPFILE - How to generate mapfile
\r
92 # ldcmdfile-y - link cmd file
\r
93 # libpath-y - lib paths
\r
94 # libitem-y - the libs with path
\r
95 # lib-y - the libs, without path
\r
98 LD = $(CROSS_COMPILE)ld
\r
106 # Don't use a map file if we are compiling for native target.
\r
107 ifneq ($(CROSS_COMPILE),)
\r
108 LDFLAGS += -Map $(subst .$(TE),.map, $@)
\r
113 libitem-y += $(libitem-yy)
\r
115 LD_START_GRP = --start-group
\r
116 LD_END_GRP = --end-group
\r
118 #LDFLAGS += --gc-section
\r
120 # ---------------------------------------------------------------------------
\r
123 # ASFLAGS - assembler flags
\r
124 # ASOUT - how to generate output file
\r
126 AS = $(CROSS_COMPILE)as
\r
128 ASFLAGS += --gdwarf2
\r
131 # ---------------------------------------------------------------------------
\r
134 #DDUMP = $(Q)$(COMPILER_ROOT)/$(cross_machine-y)-objcopy
\r
135 #DDUMP_FLAGS = -O srec
\r
136 OBJCOPY = $(CROSS_COMPILE)objcopy
\r
138 # ---------------------------------------------------------------------------
\r
141 # AROUT - archiver flags
\r
143 AR = $(CROSS_COMPILE)ar
\r