Home | History | Annotate | Download | only in Tools
      1 #/*
      2 # ** Copyright 2003-2010, VisualOn, Inc.
      3 # **
      4 # ** Licensed under the Apache License, Version 2.0 (the "License");
      5 # ** you may not use this file except in compliance with the License.
      6 # ** You may obtain a copy of the License at
      7 # **
      8 # **     http://www.apache.org/licenses/LICENSE-2.0
      9 # **
     10 # ** Unless required by applicable law or agreed to in writing, software
     11 # ** distributed under the License is distributed on an "AS IS" BASIS,
     12 # ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # ** See the License for the specific language governing permissions and
     14 # ** limitations under the License.
     15 # */
     16 
     17 # special macro definitions for building 
     18 VOPREDEF=-DLINUX -D_LINUX 
     19 
     20 VOPRJ ?= 
     21 VONJ ?= eclair
     22 VOTT ?= v6
     23 # control the version to release out
     24 # available: eva(evaluation), rel(release)
     25 VOVER=
     26 ifeq ($(VOVER), eva)
     27 VOPREDEF+=-D__VOVER_EVA__
     28 endif
     29 
     30 # for debug or not: yes for debug, any other for release
     31 VODBG?=ye
     32 
     33 # for detecting memory leak
     34 VODML=
     35 ifeq ($(VODML), yes)
     36 VOPREDEF+=-DDMEMLEAK
     37 endif
     38 
     39 VOPREDEF+=-D__VOTT_ARM__ -D__VONJ_ECLAIR__
     40 TCROOTPATH:=/opt/eclair
     41 GCCVER:=4.4.0
     42 TCPATH:=$(TCROOTPATH)/prebuilt/linux-x86/toolchain/arm-eabi-$(GCCVER)
     43 CCTPRE:=$(TCPATH)/bin/arm-eabi-
     44 AS:=$(CCTPRE)as
     45 AR:=$(CCTPRE)ar
     46 NM:=$(CCTPRE)nm
     47 CC:=$(CCTPRE)gcc
     48 GG:=$(CCTPRE)g++
     49 LD:=$(CCTPRE)ld
     50 SIZE:=$(CCTPRE)size
     51 STRIP:=$(CCTPRE)strip
     52 RANLIB:=$(CCTPRE)ranlib
     53 OBJCOPY:=$(CCTPRE)objcopy
     54 OBJDUMP:=$(CCTPRE)objdump
     55 READELF:=$(CCTPRE)readelf
     56 STRINGS:=$(CCTPRE)strings
     57 
     58 # target product dependcy
     59 # available: dream, generic
     60 VOTP:=sapphire-open
     61 CCTLIB:=$(TCROOTPATH)/out/target/product/$(VOTP)/obj/lib
     62 CCTINC:=-I$(TCROOTPATH)/system/core/include \
     63 	-I$(TCROOTPATH)/hardware/libhardware/include \
     64 	-I$(TCROOTPATH)/hardware/ril/include \
     65 	-I$(TCROOTPATH)/hardware/libhardware_legacy/include \
     66 	-I$(TCROOTPATH)/dalvik/libnativehelper/include \
     67 	-I$(TCROOTPATH)/dalvik/libnativehelper/include/nativehelper \
     68 	-I$(TCROOTPATH)/frameworks/base/include \
     69 	-I$(TCROOTPATH)/frameworks/base/core/jni \
     70 	-I$(TCROOTPATH)/frameworks/base/libs/audioflinger \
     71 	-I$(TCROOTPATH)/external/skia/include \
     72 	-I$(TCROOTPATH)/out/target/product/$(VOTP)/obj/include \
     73 	-I$(TCROOTPATH)/bionic/libc/arch-arm/include \
     74 	-I$(TCROOTPATH)/bionic/libc/include \
     75 	-I$(TCROOTPATH)/bionic/libstdc++/include \
     76 	-I$(TCROOTPATH)/bionic/libc/kernel/common \
     77 	-I$(TCROOTPATH)/bionic/libc/kernel/arch-arm \
     78 	-I$(TCROOTPATH)/bionic/libm/include \
     79 	-I$(TCROOTPATH)/bionic/libm/include/arm \
     80 	-I$(TCROOTPATH)/bionic/libthread_db/include \
     81 	-I$(TCROOTPATH)/bionic/libm/arm \
     82 	-I$(TCROOTPATH)/bionic/libm \
     83 	-I$(TCROOTPATH)/frameworks/base/include/android_runtime 
     84 	#-I$(TCROOTPATH)/out/target/product/$(VOTP)/obj/SHARED_LIBRARIES/libm_intermediates
     85 
     86 CCTCFLAGS:=-msoft-float -mthumb-interwork -fno-exceptions -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -fmessage-length=0 -finline-functions -finline-limit=600 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fstrict-aliasing -funswitch-loops
     87 #-fwide-exec-charset=charset=UTF-32 
     88 
     89 # for target exe
     90 TELDFLAGS:=-nostdlib -Bdynamic -Wl,-T,$(TCROOTPATH)/build/core/armelf.x -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,--no-undefined -Wl,-rpath-link=$(CCTLIB) -L$(CCTLIB) 
     91 
     92 VOTEDEPS:=$(CCTLIB)/crtbegin_dynamic.o $(CCTLIB)/crtend_android.o $(TCPATH)/lib/gcc/arm-eabi/$(GCCVER)/interwork/libgcc.a -lc -lm
     93 
     94 # for target lib
     95 TLLDFLAGS:=-nostdlib -Wl,-T,$(TCROOTPATH)/build/core/armelf.xsc -Wl,--gc-sections -Wl,-shared,-Bsymbolic -L$(CCTLIB) -Wl,--no-whole-archive -Wl,--no-undefined $(TCPATH)/lib/gcc/arm-eabi/$(GCCVER)/interwork/libgcc.a 
     96 
     97 VOTLDEPS:=-lm -lc
     98 
     99 
    100 ifeq ($(VOTT), v4)
    101 VOCFLAGS:=-mtune=arm9tdmi -march=armv4t
    102 VOASFLAGS:=-march=armv4t -mfpu=softfpa
    103 endif
    104 
    105 ifeq ($(VOTT), v5)
    106 VOCFLAGS:=-march=armv5te
    107 VOASFLAGS:=-march=armv5te -mfpu=vfp
    108 endif
    109 
    110 ifeq ($(VOTT), v5x)
    111 VOCFLAGS:=-march=armv5te -mtune=xscale
    112 VOASFLAGS:=-march=armv5te -mfpu=vfp
    113 endif
    114 
    115 ifeq ($(VOTT), v6)
    116 #VOCFLAGS:=-march=armv6 -mtune=arm1136jf-s 
    117 #VOASFLAGS:=-march=armv6
    118 VOCFLAGS:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -mapcs -mtpcs-leaf-frame -mlong-calls
    119 VOASFLAGS:=-march=armv6j -mcpu=arm1136jf-s -mfpu=arm1136jf-s -mfloat-abi=softfp -mapcs-float -mapcs-reentrant
    120 endif
    121 
    122 #
    123 # global link options
    124 VOLDFLAGS:=-Wl,-x,-X,--as-needed
    125 
    126 
    127 ifeq ($(VOTT), v7)
    128 VOCFLAGS+=-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    129 VOASFLAGS+=-march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    130 VOLDFLAGS+=-Wl,--fix-cortex-a8
    131 endif
    132 
    133 #global compiling options for ARM target
    134 ifneq ($(VOTT), pc)
    135 VOASFLAGS+=--strip-local-absolute -R
    136 endif 
    137 
    138 
    139 ifeq ($(VODBG), yes)
    140 VOCFLAGS+=-D_DEBUG -g
    141 else
    142 VOCFLAGS+=-DNDEBUG -O3
    143 endif
    144 
    145 VOCFLAGS+=$(VOPREDEF) $(VOMM) -Wall -fsigned-char -fomit-frame-pointer -fno-leading-underscore -fpic -fPIC -pipe -ftracer -fforce-addr -fno-bounds-check #-fvisibility=hidden #-fvisibility-inlines-hidden ##-ftree-loop-linear  -mthumb -nostdinc  -dD -fprefetch-loop-arrays
    146 
    147 
    148 ifneq ($(VOTT), pc)
    149 VOCFLAGS+=$(CCTCFLAGS) $(CCTINC)
    150 VOCPPFLAGS:=-fno-rtti $(VOCFLAGS)
    151 
    152 ifeq ($(VOMT), exe)
    153 VOLDFLAGS+=$(TELDFLAGS)
    154 endif
    155 
    156 ifeq ($(VOMT), lib)
    157 VOLDFLAGS+=$(TLLDFLAGS)
    158 endif
    159 else
    160 VOCPPFLAGS:=$(VOCFLAGS)
    161 ifeq ($(VOMT), lib)
    162 VOLDFLAGS+=-shared
    163 endif
    164 endif
    165 
    166 ifeq ($(VODBG), yes)
    167 #VOLDFLAGS:=
    168 endif
    169 
    170 # where to place object files 
    171 OBJDIR=obj
    172 
    173