]> rtime.felk.cvut.cz Git - arc.git/blob - scripts/cc_cw.mk
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / scripts / cc_cw.mk
1 \r
2 \r
3 HOST := $(shell uname)\r
4 export prefix\r
5 \r
6 # CW and paths...\r
7 # Bin:   PowerPC_EABI_Tools/Command_Line_Tools/mwXXXXXX\r
8 # libs:  PowerPC_EABI_Support/Runtime/Lib/Runtime.XXXX\r
9 #        PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib\r
10 \r
11 #CW_COMPILE=/c/devtools/cw_55xx\r
12 CW_BIN = $(CW_COMPILE)/PowerPC_EABI_Tools/Command_Line_Tools\r
13 CW_LIB = $(CW_COMPILE)/PowerPC_EABI_Support/Runtime/Lib\r
14 \r
15 \r
16 # ---------------------------------------------------------------------------\r
17 # Compiler\r
18 # CCFLAGS - compile flags\r
19 \r
20 CC      =       $(CW_BIN)/mwcceppc.exe\r
21 \r
22 cflags-y                += -cpp_exceptions=off\r
23 cflags-y                += -readonlystrings\r
24 cflags-y                += -RTTI=off\r
25 cflags-y                += -dialect=c99\r
26 cflags-y                += -gccext=on\r
27 cflags-y                += -gdwarf-2\r
28 cflags-y                += -gccinc\r
29 cflags-y                += -cwd explicit\r
30 cflags-y                += -msgstyle gcc\r
31 cflags-$(CFG_OPT_RELEASE)        += -opt level=2\r
32 cflags-$(CFG_OPT_DEBUG)        += -opt off \r
33 \r
34 # Generate dependencies, \r
35 # Should be -MMD here but it only gives the *.c files (for some reason\r
36 # the compiler thinks all include files are system file, option?)\r
37 cflags-y                += -gccdepends -MD\r
38 \r
39 # Warnings\r
40 cflags-y          += -W=most\r
41 \r
42 # Conformance\r
43 cflags-y          += -abi=eabi\r
44 cflags-$(CFG_VLE) += -ppc_asm_to_vle  # Convert ppc to vle ppc\r
45 cflags-$(CFG_VLE) += -vle  # Convert ppc to vle ppc\r
46 cflags-y          += -abi=eabi\r
47 cflags-y          += -proc=5565\r
48 cflags-y          += -fp=soft\r
49 cflags-y          += -use_isel=on\r
50 #cflags-y          += -sdata=0xFFFF -sdata2=16\r
51 cflags-y          += -sdata=0 -sdata2=0\r
52 \r
53 #cflags-y          += -fno-strict-aliasing\r
54 #cflags-y          += -fno-builtin\r
55 \r
56 # Get machine cflags\r
57 #cflags-y               += $(cflags-$(CFG_ARCH))\r
58 \r
59 CFLAGS = $(cflags-y) $(cflags-yy)\r
60 \r
61 CCOUT           = -o $@ \r
62 \r
63 # ---------------------------------------------------------------------------\r
64 # Preprocessor\r
65 \r
66 CPP     =       $(CC) -E\r
67 CPPOUT = -precompile\r
68 \r
69 CPP_ASM_FLAGS += -ppopt noline -ppopt nopragma -dialect c\r
70 \r
71 comma = ,\r
72 empty = \r
73 space = $(empty) $(empty)\r
74 \r
75 \r
76 cw_lib_path += -L$(CW_COMPILE)/PowerPC_EABI_Support/Runtime/Lib\r
77 cw_lib_path += -L$(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Lib\r
78 cc_inc_path += $(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include\r
79 cc_inc_path += $(CW_COMPILE)/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include\r
80 inc-y += $(cc_inc_path)\r
81 libpath-y += $(cw_lib_path)\r
82 \r
83 \r
84 # libnames .bare - No operating system\r
85 #          .E    - e500, e200\r
86 #          UC    - Noooooo\r
87 #          S     - software float\r
88 # nothing really matches.......\r
89 lib-$(CFG_VLE) += -lRuntime.PPCEABI.VS.a   # is this VLE?\r
90 lib-$(CFG_VLE) += -lMSL_C.PPCEABI.bare.SZ.VS.a\r
91 ifneq ($(CFG_VLE),y)\r
92 lib-y += -lRuntime.PPCEABI.S.a \r
93 lib-y += -lMSL_C.PPCEABI.bare.SZ.S.a\r
94 endif\r
95 \r
96 C_TO_ASM = -P\r
97 \r
98 # ---------------------------------------------------------------------------\r
99 # Linker\r
100 #\r
101 # LDFLAGS               - linker flags\r
102 # LDOUT                 - How to Generate linker output file\r
103 # LDMAPFILE     - How to generate mapfile \r
104 # ldcmdfile-y   - link cmd file\r
105 # libpath-y             - lib paths\r
106 # libitem-y             - the libs with path\r
107 # lib-y                 - the libs, without path\r
108 \r
109 \r
110 LD = $(CW_BIN)/mwldeppc.exe\r
111 \r
112 LDSCRIPT = -lcf\r
113 \r
114 # To make "rom" images (make LOAD() work)\r
115 ldflags-y += -romaddr 0x0 \r
116 ldflags-y += -rambuffer 0x0\r
117 #ldflags-y += -nodefaults\r
118 ldflags-y += -gdwarf-2\r
119 ldflags-y += -m _start\r
120 TE = elf\r
121 ldflags-y += -map $(subst .$(TE),.map, $@)\r
122 \r
123 LDFLAGS += $(ldflags-y) \r
124 LDOUT           = -o $@\r
125 \r
126 LD_FILE = -lcf\r
127 \r
128 libitem-y += $(libitem-yy)\r
129 \r
130 # ---------------------------------------------------------------------------\r
131 # Assembler\r
132 #\r
133 # ASFLAGS               - assembler flags\r
134 # ASOUT                 - how to generate output file\r
135 \r
136 AS      =       $(CW_BIN)/mwasmeppc.exe\r
137 \r
138 asflags-y += -gnu_mode\r
139 asflags-y += -proc e500 -gdwarf-2\r
140 asflags-$(CFG_VLE) += -vle\r
141 ASFLAGS += $(asflags-y)\r
142 ASOUT = -o $@\r
143 \r
144 # Memory footprint\r
145 define do-memory-footprint \r
146         @gawk --non-decimal-data -f $(ROOTDIR)/scripts/memory_footprint_$(COMPILER).awk $(subst .elf,.map,$@) \r
147 endef\r
148 \r
149 # Dependency generation\r
150 define do-compile-post \r
151         @sed -e "/.*PowerPC_EABI_Support/d;s/ \\\/ qqaass/;s/\\\/\//g;s/qqaass/\\\/" $(subst .o,.d,$@) > $(subst .o,.d,$@)d\r
152         @mv $(subst .o,.d,$@)d $(subst .o,.d,$@)\r
153 endef\r
154 \r
155 define do-memory-footprint2-$(CFG_MEMORY_FOOTPRINT2)\r
156         @gawk -f $(ROOTDIR)/scripts/memory_footprint2_$(COMPILER).awk  $(subst .$(TE),.map, $@)\r
157 endef\r
158 \r
159 \r
160 \r
161 \r
162 \r
163 \r