2013-04-05 13:19:39 +08:00
|
|
|
EXECUTABLE = HelloCpp
|
2013-04-04 09:26:55 +08:00
|
|
|
|
|
|
|
INCLUDES = -I.. -I../Classes
|
|
|
|
|
|
|
|
SOURCES = main.cpp \
|
|
|
|
../Classes/AppDelegate.cpp \
|
|
|
|
../Classes/HelloWorldScene.cpp
|
|
|
|
|
2013-04-05 13:19:39 +08:00
|
|
|
RESOURCE_PATH = ../Resources/iphone
|
|
|
|
|
2013-04-09 10:17:10 +08:00
|
|
|
RESOURCES = CloseNormal.png \
|
|
|
|
CloseSelected.png \
|
|
|
|
HelloWorld.png
|
|
|
|
|
|
|
|
FONT_PATH = ../Resources/fonts
|
2013-04-05 13:19:39 +08:00
|
|
|
|
2013-04-04 09:26:55 +08:00
|
|
|
COCOS_ROOT = ../../../..
|
|
|
|
include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk
|
|
|
|
|
|
|
|
SHAREDLIBS += -lcocos2d
|
|
|
|
COCOS_LIBS = $(LIB_DIR)/libcocos2d.so
|
|
|
|
|
2013-04-05 13:19:39 +08:00
|
|
|
$(TARGET).js: $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
|
2013-04-04 09:26:55 +08:00
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
|
|
|
|
|
2013-06-26 02:44:29 +08:00
|
|
|
|
|
|
|
ifeq ($(shell uname -s),Darwin)
|
|
|
|
ARIEL_TTF := /Library/Fonts/Arial.ttf
|
|
|
|
else
|
|
|
|
ARIEL_TTF := $(COCOS_ROOT)/samples/Cpp/TestCpp/Resources/fonts/arial.ttf
|
|
|
|
endif
|
|
|
|
|
2013-04-05 13:19:39 +08:00
|
|
|
$(TARGET).data:
|
|
|
|
@mkdir -p $(@D)
|
2013-04-09 10:17:10 +08:00
|
|
|
$(eval RESTMP := $(shell mktemp -d /tmp/cocos-emscripten.XXXXXX))
|
|
|
|
# Always need a font path, so ensure that it is created first.
|
|
|
|
mkdir -p $(RESTMP)/fonts
|
|
|
|
(cd $(RESOURCE_PATH) && cp -a $(RESOURCES) $(RESTMP))
|
|
|
|
(cd $(FONT_PATH) && cp -a * $(RESTMP)/fonts)
|
|
|
|
# NOTE: we copy the system arial.ttf so that there is always a fallback.
|
2013-06-26 02:44:29 +08:00
|
|
|
cp $(ARIEL_TTF) $(RESTMP)/fonts/arial.ttf
|
2013-04-09 10:17:10 +08:00
|
|
|
(cd $(RESTMP); python $(PACKAGER) $(EXECUTABLE).data $(patsubst %,--preload %,$(RESOURCES)) --preload fonts --pre-run > $(EXECUTABLE).data.js)
|
|
|
|
mv $(RESTMP)/$(EXECUTABLE).data $@
|
|
|
|
mv $(RESTMP)/$(EXECUTABLE).data.js $@.js
|
|
|
|
rm -rf $(RESTMP)
|
2013-04-05 13:19:39 +08:00
|
|
|
|
|
|
|
$(BIN_DIR)/index.html: index.html
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
cp index.html $(@D)
|
|
|
|
|
2013-04-04 09:26:55 +08:00
|
|
|
$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
|