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
61 CPP_ASM_FLAGS = -x assembler-with-cpp
\r
65 space = $(empty) $(empty)
\r
68 # Libs related to GCC(libgcc.a, libgcov.a) is located under
\r
69 # lib/gcc/<machine>/<version>/<multilib>
\r
70 # Libs related to the library (libc.a,libm.a,etc) are under:
\r
71 # <machine>/lib/<multilib>
\r
73 # Can't remember why haven't I just used gcc to link instead of ld? (it should
\r
74 # figure out the things below by itself)
\r
76 # It seems some versions of make want "\=" and some "="
\r
77 # "=" - msys cpmake on windows 7
\r
78 gcc_lib_path := "$(subst /libgcc.a,,$(shell $(CC) $(CFLAGS) --print-libgcc-file-name))"
\r
79 gcc_lib_path := $(subst \libgcc.a,,$(gcc_lib_path))
\r
80 lib_lib_path := "$(subst /libc.a,,$(shell $(CC) $(CFLAGS) --print-file-name=libc.a))"
\r
81 lib_lib_path := $(subst \libc.a,,$(lib_lib_path))
\r
82 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
83 cc_inc_path := $(realpath $(text_chunk))
\r
84 libpath-y += -L$(lib_lib_path)
\r
85 libpath-y += -L$(gcc_lib_path)
\r
87 # ---------------------------------------------------------------------------
\r
90 # LDFLAGS - linker flags
\r
91 # LDOUT - How to Generate linker output file
\r
92 # LDMAPFILE - How to generate mapfile
\r
93 # ldcmdfile-y - link cmd file
\r
94 # libpath-y - lib paths
\r
95 # libitem-y - the libs with path
\r
96 # lib-y - the libs, without path
\r
99 LD = $(CROSS_COMPILE)ld
\r
107 # Don't use a map file if we are compiling for native target.
\r
108 ifneq ($(CROSS_COMPILE),)
\r
109 LDFLAGS += -Map $(subst .$(TE),.map, $@)
\r
114 libitem-y += $(libitem-yy)
\r
116 LD_START_GRP = --start-group
\r
117 LD_END_GRP = --end-group
\r
119 #LDFLAGS += --gc-section
\r
121 # ---------------------------------------------------------------------------
\r
124 # ASFLAGS - assembler flags
\r
125 # ASOUT - how to generate output file
\r
127 AS = $(CROSS_COMPILE)as
\r
129 ASFLAGS += --gdwarf2
\r
132 # ---------------------------------------------------------------------------
\r
135 #DDUMP = $(Q)$(COMPILER_ROOT)/$(cross_machine-y)-objcopy
\r
136 #DDUMP_FLAGS = -O srec
\r
137 OBJCOPY = $(CROSS_COMPILE)objcopy
\r
139 # ---------------------------------------------------------------------------
\r
142 # AROUT - archiver flags
\r
144 AR = $(CROSS_COMPILE)ar
\r
149 define do-memory-footprint
\r
150 @$(CROSS_COMPILE)objdump -h $@ | gawk -f $(ROOTDIR)/scripts/hc1x_memory.awk
\r
153 define do-memory-footprint
\r
154 @gawk --non-decimal-data -f $(ROOTDIR)/scripts/memory_footprint_gcc.awk $(subst .elf,.map,$@)
\r