1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
14 # The Original Code is [Open Source Virtual Machine.].
16 # The Initial Developer of the Original Code is
17 # Adobe System Incorporated.
18 # Portions created by the Initial Developer are Copyright (C) 2010
19 # the Initial Developer. All Rights Reserved.
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK ***** */
38 # Makefile for building AVM shell for Android.
40 #****************************************************************************
41 # The following Android SDK commands must be run before invoking this
43 # the android sdk volume should be mounted to /Volumes/android
44 # cd /Volumes/android/device
48 # make MAKECMDGOALS=release
49 # make MAKECMDGOALS=debug
51 #****************************************************************************
53 #****************************************************************************
54 # Targets of the build
55 #****************************************************************************
57 FINAL_TARGET
:= avmshell
59 # make sure this is the first (and so default) target
60 .PHONY
: default_target
63 #****************************************************************************
64 # Variables and includes
65 #****************************************************************************
67 ENABLE_NANOJIT
:= true
69 ANDROID_MAKEFILE_DIR
:= .
77 ifeq (${MAKECMDGOALS},release
)
78 BUILD_CONFIG
:= Release
84 # some libraries that we link with are not in the official NDK, so we need to tell the compiler line
85 # where to pick those libraries up from. We don't wan't to use this path more generally because we
86 # want to keep a clear understanding of what libraries we are using that are not part of the NDK.
87 # We do this by setting the ANDR_OUT_SYS_LIB_DIR path and then explicitly linking to non-NDK libraries
88 # using this path. This has the effect of making us require that we pick a "product" to link against
89 # even though our targets are, in spirit, supposed to represent more generic configurations.
91 ifeq (${TARGET_ARCH},ARMV7-A
)
92 ARCH_CFLAGS
:= -march
=armv7-a
-mtune
=cortex-a8
-mfloat-abi
=softfp
-mfpu
=neon
-D__ARM_ARCH__
=7 -DARMV6_ASSEMBLY
-DTARGET_NEON
-DSDK_ON2_OPT
-DSDK_ON2_OPT_ARM11
-DFP_ON2_USE_C_FILTERING_FUNCTIONS
93 PLATFORM_LDFLAGS
:= $(PLATFORM_LDFLAGS
) -Wl
,--fix-cortex-a8
94 INCLUDE_ARM_ASM_FILES
:= 1
95 HAS_OPENGL_ES2_SUPPORT
:= 0
96 ANDR_OUT_SYS_LIB_DIR
:= $(ANDROID_BUILD_TOP
)/out
/target
/product
/sholes
/system
/lib
99 ifeq (${TARGET_ARCH},ARMV6
)
100 ARCH_CFLAGS
:= -march
=armv6
-mfloat-abi
=soft
-D__ARM_ARCH__
=6 -DARMV5_ASSEMBLY
-DARMV6_ASSEMBLY
101 INCLUDE_ARM_ASM_FILES
:= 1
102 HAS_OPENGL_ES2_SUPPORT
:= 0
103 ANDR_OUT_SYS_LIB_DIR
:= $(ANDROID_BUILD_TOP
)/out
/target
/product
/generic
/system
/lib
106 ifeq (${TARGET_ARCH},ARMV5
)
107 ARCH_CFLAGS
:= -march
=armv5te
-mfloat-abi
=soft
-mtune
=xscale
-D__ARM_ARCH__
=5 -DARMV5_ASSEMBLY
108 INCLUDE_ARM_ASM_FILES
:= 0
109 HAS_OPENGL_ES2_SUPPORT
:= 0
110 ANDR_OUT_SYS_LIB_DIR
:= $(ANDROID_BUILD_TOP
)/out
/target
/product
/generic
/system
/lib
113 $(warning is not a supported target architecture
)
118 BUILD_ROOT
:= .
/build
/android
119 BUILD_RESULTS_DIR
:= ${BUILD_ROOT}/results
/${FINAL_TARGET}/${TARGET_ARCH}/${BUILD_CONFIG}
120 BUILD_INT_ROOT
:= ${BUILD_ROOT}/int
121 BUILD_INT_DIR
:= ${BUILD_INT_ROOT}/${FINAL_TARGET}/${TARGET_ARCH}/${BUILD_CONFIG}
122 OBJDIR
:= ${BUILD_INT_DIR}/obj
123 LIBDIR
:= ${BUILD_INT_DIR}/lib
125 # warnings for both c and c++
126 # disable -Werror 2/1/2010 dschaffe
127 FLASH_C_WARNINGS
:= -Wall
-Wdisabled-optimization
-Wextra
-Wformat
=2 -Winit-self
-Winvalid-pch
-Wlogical-op
-Wmissing-include-dirs
-Wpointer-arith
-Wstrict-aliasing
=3 -Wstrict-overflow
=1 -Wwrite-strings
-Wno-missing-field-initializers
-Wno-type-limits
-Wno-unused-parameter
-Wno-clobbered
129 # additional warnings that are only for c++
130 FLASH_CXX_WARNINGS
:= -Wctor-dtor-privacy
-Wnon-virtual-dtor
-Woverloaded-virtual
-Wsign-promo
-Wstrict-null-sentinel
-Wno-missing-braces
-Wno-multichar
-Wno-psabi
-Wno-reorder
-Wno-switch
-Wno-invalid-offsetof
132 # re-#define ZLIB's "compress()" to "zlib_compress()" to avoid libys.a link errors
133 MMGC_DEFINES
:= -DAVMFEATURE_OVERRIDE_GLOBAL_NEW
=0 -DRTMFPUTIL_OVERRIDE_OPERATOR_NEW
134 FLASH_DEFINES
:= -DANDROID
-DNETSCAPE
-DDISABLE_DRM
-DGENERIC_PLATFORM
-DHAVE_SYS_UIO_H
-Dlinux
-DNEEDS_IN6_H
-DUNIX
-Dcompress
=zlib_compress
$(MMGC_DEFINES
)
135 ifeq (${HAS_OPENGL_ES2_SUPPORT},1)
136 FLASH_DEFINES
:= $(FLASH_DEFINES
) -DFEATURE_GPU_ACCEL_OPENGLES2
-DFEATURE_GPU_VECTOR
-DGL_GLEXT_PROTOTYPES
139 # some cflags that are used by all Android builds as defined by Google
140 GOOGLE_COMMON_CFLAGS
:= -fmessage-length
=0 -fpic
-fno-strict-aliasing
-mlong-calls
-mthumb-interwork
-fsigned-char
-funwind-tables
-fstack-protector
142 # cflags that we use for both c and c++, and for both debug-like and release-like targets
143 FLASH_COMMON_CFLAGS
:= $(GOOGLE_COMMON_CFLAGS
) $(FLASH_C_WARNINGS
) $(FLASH_DEFINES
) $(ARCH_CFLAGS
) -finline-limit
=200 -MD
-fwrapv
145 # additional cflags that we use only for c++, but for both debug-like and release-like targets
146 FLASH_COMMON_CXXFLAGS
:= $(FLASH_COMMON_CFLAGS
) -fno-exceptions
-fno-rtti
$(FLASH_CXX_WARNINGS
)
148 FLASH_DEBUG_CFLAGS
:= -DDEBUG
-D_DEBUG
-DASYNC_DEBUG
-O0
-ggdb3
149 FLASH_DEBUG_CXXFLAGS
:= $(FLASH_DEBUG_CFLAGS
)
151 FLASH_RELEASE_CFLAGS
:= -DNDEBUG
-O3
-fomit-frame-pointer
-fvisibility
=hidden
-finline-functions
-fgcse-after-reload
-frerun-cse-after-loop
-frename-registers
152 FLASH_RELEASE_CXXFLAGS
:= $(FLASH_RELEASE_CFLAGS
) -fvisibility-inlines-hidden
155 ifeq ($(DISABLE_RTMPE
),1)
156 FLASH_COMMON_CXXFLAGS
:= $(FLASH_COMMON_CXXFLAGS
) -DDISABLE_RTMPE
159 # link libys.a and silence its linker warnings
160 YS_LIB
:= $(FLASHRUNTIME_CODE_ROOT
)/third_party
/yellowstone
/libs
/GCC-arm
/$(YS_ARCH
)/libys.a
161 PLATFORM_LDFLAGS
:= $(PLATFORM_LDFLAGS
) -Wl
,--no-enum-size-warning
162 endif # DISABLE_RTMPE
165 # ^^^ If any CXXFLAGS need CFLAGS flags, then combine them in the previous CXXFLAGS definitions. ^^^
166 # To simplify this code, CONFIG FLAGS should strictly use CFLAGS or CXXFLAGS, as appropriate.
168 ifeq (${BUILD_CONFIG},Debug
)
169 CONFIG_CFLAGS
:= $(FLASH_COMMON_CFLAGS
) $(FLASH_DEBUG_CFLAGS
)
170 CONFIG_CXXFLAGS
:= $(FLASH_COMMON_CXXFLAGS
) $(FLASH_DEBUG_CXXFLAGS
)
172 CONFIG_CFLAGS
:= $(FLASH_COMMON_CFLAGS
) $(FLASH_RELEASE_CFLAGS
)
173 CONFIG_CXXFLAGS
:= $(FLASH_COMMON_CXXFLAGS
) $(FLASH_RELEASE_CXXFLAGS
)
176 FLASH_CFLAGS_ARM
:= $(CONFIG_CFLAGS
)
177 FLASH_CXXFLAGS_ARM
:= $(CONFIG_CXXFLAGS
)
178 FLASH_CFLAGS_THUMB
:= $(FLASH_CFLAGS_ARM
) -mthumb
179 FLASH_CXXFLAGS_THUMB
:= $(FLASH_CXXFLAGS_ARM
) -mthumb
181 CC
:= $(ANDROID_EABI_TOOLCHAIN
)/arm-eabi-gcc
182 AS
:= $(ANDROID_EABI_TOOLCHAIN
)/arm-eabi-as
183 AR
:= $(ANDROID_EABI_TOOLCHAIN
)/arm-eabi-ar
184 LD
:= $(ANDROID_EABI_TOOLCHAIN
)/arm-eabi-ld
185 STRIP
:= $(ANDROID_EABI_TOOLCHAIN
)/arm-eabi-strip
187 INC
:= -I
$(ANDROID_BUILD_TOP
)/bionic
/libc
/arch-arm
/include \
188 -I
$(ANDROID_BUILD_TOP
)/bionic
/libc
/kernel
/arch-arm \
189 -I
$(ANDROID_BUILD_TOP
)/bionic
/libc
/kernel
/common \
190 -I
$(ANDROID_BUILD_TOP
)/bionic
/libm
/include \
191 -I
$(ANDROID_BUILD_TOP
)/bionic
/libstdc
++/include \
192 -I
$(ANDROID_BUILD_TOP
)/bionic
/libc
/include \
193 -I
$(ANDROID_BUILD_TOP
)/external
/webkit
/WebKit
/android
/stl \
194 -I
$(ANDROID_BUILD_TOP
)/external
/openssl
/include \
195 -I
$(ANDROID_BUILD_TOP
)/frameworks
/base
/opengl
/include
197 # Link flags for a headless (command-line) application:
198 LFLAGS_HEADLESS
:= -nostdlib
-Bdynamic \
199 -Wl
,-T
,$(ANDROID_BUILD_TOP
)/build
/core
/armelf.x \
200 -Wl
,-dynamic-linker
,/system
/bin
/linker \
202 -L
$(ANDROID_PRODUCT_OUT
)/system
/lib \
203 -Wl
,-rpath-link
=$(ANDROID_PRODUCT_OUT
)/system
/lib \
204 $(ANDROID_PRODUCT_OUT
)/obj
/lib
/crtbegin_dynamic.o \
205 $(ANDROID_PRODUCT_OUT
)/obj
/lib
/crtend_android.o
207 # Define these to use the ctuils atomics API
208 #LFLAGS_HEADLESS := $(LFLAGS_HEADLESS) -lcutils
209 #INC := $(INC) -I$(ANDROID_BUILD_TOP)/system/core/include
217 # compile-files-arm function:
218 # ${1} = obj directory name
219 define compile-files-arm
220 @mkdir
-p
${OBJDIR}/${1}
222 @
$(CC
) $(FLASH_CXXFLAGS_ARM
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
225 # compile-files function:
226 # ${1} = obj directory name
228 @mkdir
-p
${OBJDIR}/${1}
230 @
$(CC
) $(FLASH_CXXFLAGS_THUMB
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
233 # compile-c-files-arm function:
234 # ${1} = obj directory name
235 define compile-c-files-arm
236 @mkdir
-p
${OBJDIR}/${1}
238 @
$(CC
) $(FLASH_CFLAGS_ARM
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
241 # compile-c-files function:
242 # ${1} = obj directory name
243 define compile-c-files
244 @mkdir
-p
${OBJDIR}/${1}
246 @
$(CC
) $(FLASH_CFLAGS_THUMB
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
249 # compile-asm-files function:
250 # ${1} = obj directory name
251 define compile-asm-files
252 @mkdir
-p
${OBJDIR}/${1}
259 define compile-files-arm
261 @mkdir
-p
${OBJDIR}/${1}
262 $(CC
) $(FLASH_CXXFLAGS_ARM
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
266 @mkdir
-p
${OBJDIR}/${1}
267 $(CC
) $(FLASH_CXXFLAGS_THUMB
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
270 # compile-c-files-arm function:
271 # ${1} = obj directory name
272 # ${2} = *_DEFS defines
273 define compile-c-files-arm
274 @mkdir
-p
${OBJDIR}/${1}
275 $(CC
) $(FLASH_CFLAGS_ARM
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
278 # compile-c-files function:
279 # ${1} = obj directory name
280 # ${2} = *_DEFS defines
281 define compile-c-files
282 @mkdir
-p
${OBJDIR}/${1}
283 $(CC
) $(FLASH_CFLAGS_THUMB
) ${AVMSHELL_DEFS} $(INC
) -o
$@
-c
$<
286 # compile-asm-files function:
287 # ${1} = obj directory name
288 define compile-asm-files
289 @mkdir
-p
${OBJDIR}/${1}
296 # ${1} = *_OBJS files
302 # Display the state of some Makefile variables:
305 ifeq ($(ENABLE_NANOJIT
),true
)
306 @echo nanojit ENabled
308 @echo nanojit DISabled
311 @echo Speak status ENabled
313 @echo Speak status DISabled
318 # Modify variables set by make.common before including other makefiles:
319 INC
:= -I.
-I..
-I..
/..
-I..
/..
/shell -I..
/..
/core
-I..
/..
/eval
-I..
/..
/MMgc
-I..
/..
/pcre
-I..
/..
/extensions
-I..
/..
/VMPI
-I..
/..
/vmbase
-I..
/..
/generated
-I..
/..
/other-licenses
/zlib
-I..
/..
/other-licenses
$(INC
)
321 AVMSHELL_DEFS
:= -DUNIX
-Dlinux
-DUSE_PTHREAD_MUTEX
-DNO_SYS_SIGNAL
-DHAVE_STDARG
-DNO_CONSOLE_FWRITE
-DAVMPLUS_ARM
-DAVMPLUS_UNIX
-DAVMSHELL_BUILD
323 ifneq ($(ENABLE_NANOJIT
),true
)
324 AVMSHELL_DEFS
:= ${AVMSHELL_DEFS} -DAVMPLUS_DISABLE_NJ
327 include $(ANDROID_MAKEFILE_DIR
)/make.avm
328 include $(ANDROID_MAKEFILE_DIR
)/make.mmgc
329 include $(ANDROID_MAKEFILE_DIR
)/make.zlib
331 LDFLAGS
:= -lc
-lm
-lstdc
++ -lssl
-lgcc
333 #****************************************************************************
335 #****************************************************************************
337 SHELL_SRCS
:= ..
/..
/shell/ConsoleOutputStream.
cpp \
338 ..
/..
/shell/DebugCLI.
cpp \
339 ..
/..
/shell/DomainClass.
cpp \
340 ..
/..
/shell/FileClass.
cpp \
341 ..
/..
/shell/FileInputStream.
cpp \
342 ..
/..
/shell/PosixFile.
cpp \
343 ..
/..
/shell/PosixPartialPlatform.
cpp \
344 ..
/..
/shell/ShellCore.
cpp \
345 ..
/..
/shell/SystemClass.
cpp \
346 ..
/..
/shell/avmshell.
cpp \
347 ..
/..
/shell/avmshellUnix.
cpp \
348 ..
/..
/shell/swf.
cpp \
349 ..
/..
/shell/..
/extensions
/DictionaryGlue.
cpp \
350 ..
/..
/shell/..
/extensions
/JavaGlue.
cpp \
351 ..
/..
/shell/..
/extensions
/SamplerScript.
cpp \
352 ..
/..
/shell/..
/extensions
/Selftest.
cpp \
353 ..
/..
/shell/..
/extensions
/SelftestInit.
cpp \
354 ..
/..
/shell/..
/extensions
/ST_avmplus_basics.
cpp \
355 ..
/..
/shell/..
/extensions
/ST_avmplus_peephole.
cpp \
356 ..
/..
/shell/..
/extensions
/ST_mmgc_basics.
cpp \
357 ..
/..
/shell/..
/extensions
/ST_mmgc_threads.
cpp \
358 ..
/..
/shell/..
/extensions
/ST_mmgc_weakref.
cpp \
359 ..
/..
/shell/..
/extensions
/ST_mmgc_dependent.
cpp \
360 ..
/..
/shell/..
/extensions
/ST_mmgc_gcheap.
cpp \
361 ..
/..
/shell/..
/extensions
/ST_mmgc_finalize_uninit.
cpp \
362 ..
/..
/shell/..
/extensions
/ST_vmpi_threads.
cpp \
363 ..
/..
/shell/..
/extensions
/ST_mmgc_575631.
cpp \
366 #****************************************************************************
368 #****************************************************************************
370 ALL_SRCS
:= ${SHELL_SRCS} ${AVMPLUS_SRCS} ${MMGC_SRCS} ${ZLIB_SRC}
371 SHELL_OBJS
:= $(addprefix ${OBJDIR}/avmshell
/, $(notdir $(addsuffix .o
, $(basename ${SHELL_SRCS}))))
372 ALL_OBJS
:= ${SHELL_OBJS} ${AVMPLUS_OBJS} ${MMGC_OBJS} ${ZLIB_OBJS}
374 #****************************************************************************
376 #****************************************************************************
378 ${FINAL_TARGET}: $(ALL_OBJS
)
379 @echo
"=== linking:" $@
"==="
380 ifeq ($(ENABLE_NANOJIT
),true
)
381 @echo Note
: nanojit ENabled
383 @echo Note
: nanojit DISabled
385 ${CC} $(LFLAGS_HEADLESS
) $(ALL_OBJS
) ${LDFLAGS} -o
$@
386 @if
[ ${SPEAK_STATUS}XXX
!= XXX
]; then say
"Build succeeded"; fi
387 @echo
"=== done:" $@
"==="
389 $(OBJDIR
)/avmshell
/%.o
: ..
/..
/shell/%.
cpp
390 ${call compile-files-arm
,avmshell
}
392 $(OBJDIR
)/avmshell
/%.o
: ..
/..
/extensions
/%.
cpp
393 ${call compile-files-arm
,avmshell
}
395 $(OBJDIR
)/avmshell
/%.o
: %.
cpp
396 ${call compile-files-arm
,avmshell
}
399 @
$(MAKE
) -j4
${FINAL_TARGET}
401 #****************************************************************************
403 #****************************************************************************
406 -rm -f core
* ${ALL_OBJS} ${FINAL_TARGET} ${AVMPLUS_LIB} ${MMGC_LIB} ${ZLIB_LIB} log outputdebug.txt
409 -adb push
${FINAL_TARGET} /data
/app
410 @if
[ ${SPEAK_STATUS}XXX
!= XXX
]; then say
"Installation complete"; fi
413 -adb
shell rm /data
/app
/${FINAL_TARGET}