OUT_DIR:=./output
LIB_DIR:=./lib
OUT_WRAPPER_FILE:=$(OUT_DIR)/MyFlashLib_wrapper.c
INTERFACE_FILE:=./include/MyFlashLib.i
SOURCE_DIR:=./src
SOURCES:= $(SOURCE_DIR)/MyFlashLib.cpp \
$(SOURCE_DIR)/main.cpp
ABC_FILES:=$(OUT_DIR)/MyFlashLib.abc
CFLAGS:=-Werror -Wno-write-strings -Wno-trigraphs -jvmopt=-Xmx1G
AS_MODULE_FILE:=$(OUT_DIR)/MyFlashLib.as
ASC2FLAGS:=-merge -md \
-import D:\FlasCC_1.0.0\sdk\usr\lib\builtin.abc \
-import D:\FlasCC_1.0.0\sdk\usr\lib\playerglobal.abc
GCC_OUTPUT_FILE:=lib/MyFlashLib.swc
SWF_OUT_FILE:=test.swf
SWF_PROJECT_FILE:=test/test.as
MODULE_NAME:= MyFlashLib
PACKAGE_NAME:=mylibs.MyFlashLib
SWF_COMPILER_FLAGS:=-static-link-runtime-shared-libraries \
-compiler.omit-trace-statements=false \
-debug=false
FLACC_DIR:=D:\FlasCC_1.0.0\sdk
FLEX_DIR:=D:\Program\ Files\Adobe\Adobe\ Flash\ Builder\ 4.6\sdks\4.6.0
all:
@if [ -d $(OUT_DIR) ] ; then true; \
else mkdir $(OUT_DIR); \
fi
@if [ -d $(LIB_DIR) ] ; then true; \
else mkdir $(LIB_DIR); \
fi
@echo "生成模块声明文件"
$(FLACC_DIR)\usr\bin\swig -as3 -module $(MODULE_NAME) -outdir $(OUT_DIR) -includeall -ignoremissing -o $(OUT_WRAPPER_FILE) $(INTERFACE_FILE)
@echo "编译AS文件到字节码文件"
java -jar $(FLACC_DIR)\usr\lib\asc2.jar $(ASC2FLAGS) $(AS_MODULE_FILE)
@echo "生成模块"
$(FLACC_DIR)\usr\bin\g++ $(SOURCES) $(OUT_WRAPPER_FILE) $(ABC_FILES) $(CFLAGS) -I./include -emit-swc=$(PACKAGE_NAME) -o $(GCC_OUTPUT_FILE)
@echo "生成项目文件"
$(FLEX_DIR)\bin\mxmlc $(SWF_PROJECT_FILE) $(SWF_COMPILER_FLAGS) -library-path+=$(GCC_OUTPUT_FILE) -o $(SWF_OUT_FILE)