3 HOST := $(shell uname)
\r
6 # If we are using codesourcery and cygwin..
\r
7 ifneq ($(findstring CYGWIN,$(UNAME)),)
\r
8 cygpath:= $(shell cygpath -m $(shell which cygpath))
\r
9 export CYGPATH=$(cygpath)
\r
13 # Bin: PowerPC_EABI_Tools/Command_Line_Tools/mwXXXXXX
\r
14 # libs: PowerPC_EABI_Support/Runtime/Lib/Runtime.XXXX
\r
15 # PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib
\r
17 CW_COMPILE=/c/devtools/cw_55xx
\r
18 CW_BIN=$(CW_COMPILE)/PowerPC_EABI_Tools/Command_Line_Tools
\r
19 CW_LIB=$(CW_COMPILE)/PowerPC_EABI_Support/Runtime/Lib
\r
22 # ---------------------------------------------------------------------------
\r
24 # CCFLAGS - compile flags
\r
26 CC = $(CW_BIN)/mwcceppc.exe
\r
27 #cflags-$(CFG_OPT_RELEASE) += -O3
\r
28 #cflags-$(CFG_OPT_DEBUG) += make -O0
\r
30 # Remove sections if needed.. may be problems with other compilers here.
\r
31 #cflags-y += -ffunction-sections
\r
33 #ifneq ($(filter -O2 -O3 -O1,$(cflags-y)),)
\r
34 # cflags-y += -fno-schedule-insns -fno-schedule-insns2
\r
38 #cflags-y += -fno-common
\r
39 #cflags-y += -std=gnu99
\r
40 cflags-y += -dialect=c99
\r
41 cflags-y += -gccext=on
\r
42 cflags-y += -gdwarf-2
\r
45 # Generate dependencies
\r
47 cflags-y += -gccdepends -MMD
\r
52 #cflags-y += -Winline # warn if inline failed
\r
53 #cflags-y += -pedantic
\r
56 cflags-y += -abi=eabi
\r
57 cflags-$(CFG_VLE) += -ppc_asm_to_vle # Convert ppc to vle ppc
\r
58 cflags-y += -abi=eabi
\r
59 cflags-y += -proc=5565
\r
60 cflags-y += -fp=soft
\r
61 cflags-y += -use_isel=on
\r
62 cflags-y += -sdata=0xFFFF -sdata2=16
\r
64 #cflags-y += -fno-strict-aliasing
\r
65 #cflags-y += -fno-builtin
\r
67 # Get machine cflags
\r
68 #cflags-y += $(cflags-$(ARCH))
\r
70 CFLAGS = $(cflags-y) $(cflags-yy)
\r
74 # ---------------------------------------------------------------------------
\r
79 CPP_ASM_FLAGS += -ppopt noline
\r
83 space = $(empty) $(empty)
\r
86 # Libs related to GCC(libgcc.a, libgcov.a) is located under
\r
87 # lib/gcc/<machine>/<version>/<multilib>
\r
88 # Libs related to the library (libc.a,libm.a,etc) are under:
\r
89 # <machine>/lib/<multilib>
\r
91 # It seems some versions of make want "\=" and some "="
\r
92 # "=" - msys cpmake on windows 7
\r
93 #gcc_lib_path := "$(subst /libgcc.a,,$(shell $(CC) $(CFLAGS) --print-libgcc-file-name))"
\r
94 #gcc_lib_path := $(subst \libgcc.a,,$(gcc_lib_path))
\r
95 #lib_lib_path := "$(subst /libc.a,,$(shell $(CC) $(CFLAGS) --print-file-name=libc.a))"
\r
96 #lib_lib_path := $(subst \libc.a,,$(lib_lib_path))
\r
97 #text_chunk := $(subst \,/,$(shell touch i_m_here.c; $(CC) -v -c i_m_here.c &> i_m_here.txt;gawk -f $(TOPDIR)/scripts/gcc_getinclude.awk i_m_here.txt))
\r
98 #cc_inc_path := $(realpath $(text_chunk))
\r
99 #libpath-y += -L$(lib_lib_path)
\r
100 #libpath-y += -L$(gcc_lib_path)
\r
102 cw_lib_path += -L$(CW_COMPILE)/PowerPC_EABI_Support/Runtime/Lib
\r
103 cw_lib_path += -L$(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib
\r
104 cc_inc_path += $(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include
\r
105 cc_inc_path += $(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include
\r
106 inc-y += $(cc_inc_path)
\r
107 libpath-y += $(cw_lib_path)
\r
110 # libnames .bare - No operating system
\r
113 # S - software float
\r
114 # nothing really matches.......
\r
115 lib-$(CFG_VLE) += -lRuntime.PPCEABI.VS.a # is this VLE?
\r
116 lib-$(CFG_VLE) += -lMSL_C.PPCEABI.bare.SZ.VS.a
\r
117 ifneq ($(CFG_VLE),y)
\r
118 lib-y += -lRuntime.PPCEABI.S.a
\r
119 lib-y += -lMSL_C.PPCEABI.bare.SZ.S.a
\r
124 # ---------------------------------------------------------------------------
\r
127 # LDFLAGS - linker flags
\r
128 # LDOUT - How to Generate linker output file
\r
129 # LDMAPFILE - How to generate mapfile
\r
130 # ldcmdfile-y - link cmd file
\r
131 # libpath-y - lib paths
\r
132 # libitem-y - the libs with path
\r
133 # lib-y - the libs, without path
\r
136 LD = $(CW_BIN)/mwldeppc.exe
\r
140 ldflags-y += -romaddr 0x0
\r
141 ldflags-y += -rambuffer 0x0
\r
142 #ldflags-y += -nodefaults
\r
143 ldflags-y += -gdwarf-2
\r
144 ldflags-y += -m _start
\r
146 ldflags-y += -map $(subst .$(TE),.map, $@)
\r
148 LDFLAGS += $(ldflags-y)
\r
151 #LDMAPFILE = -M > $(subst .$(TE),.map, $@)
\r
156 libitem-y += $(libitem-yy)
\r
157 #LDFLAGS += --gc-section
\r
159 # ---------------------------------------------------------------------------
\r
162 # ASFLAGS - assembler flags
\r
163 # ASOUT - how to generate output file
\r
165 AS = $(CW_BIN)/mwasmeppc.exe
\r
167 asflags-y = -proc e500 -gdwarf-2
\r
168 asflags-$(CFG_VLE) += -vle
\r
169 ASFLAGS += $(asflags-y)
\r
172 # ---------------------------------------------------------------------------
\r
175 #DDUMP = $(Q)$(COMPILER_ROOT)/$(cross_machine-y)-objcopy
\r
176 #DDUMP_FLAGS = -O srec
\r
177 OBJCOPY = $(CROSS_COMPILE)objcopy
\r
179 # ---------------------------------------------------------------------------
\r
182 # AROUT - archiver flags
\r
184 AR = $(CROSS_COMPILE)ar
\r