Makefile

| No Comments | No TrackBacks
INFOPLIST_FILE=Info.plist
LANG_FILES=$(wildcard *.lproj)
SOURCES=$(wildcard *.m)
RESPNG=$(wildcard *.png)
SND=$(wildcard *.mp3)
RESOURCES=Resources

CC=/usr/local/bin/arm-apple-darwin-gcc
CFLAGS=-g -O2 -Wall -fsigned-char
LD=$(CC)
LDFLAGS=-I/usr/local/arm-apple-darwin/include -lobjc -ObjC -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices -framework UIKit -framework LayerKit -framework PhotoLibrary  -framework MusicLibrary -framework CFNetwork

WRAPPER_NAME=$(PRODUCT_NAME).app
EXECUTABLE_NAME=$(PRODUCT_NAME)
SOURCES_ABS=$(addprefix $(SRCROOT)/,$(SOURCES))
RESPNG_ABS=$(addprefix $(SRCROOT)/,$(RESPNG))
LANG_FILES_ABS=$(addprefix $(SRCROOT)/,$(LANG_FILES))
SND_ABS=$(addprefix $(SRCROOT)/,$(SND))
INFOPLIST_ABS=$(addprefix $(SRCROOT)/,$(INFOPLIST_FILE))
OBJECTS=\
    $(patsubst %.c,%.o,$(filter %.c,$(SOURCES))) \
    $(patsubst %.cc,%.o,$(filter %.cc,$(SOURCES))) \
    $(patsubst %.cpp,%.o,$(filter %.cpp,$(SOURCES))) \
    $(patsubst %.m,%.o,$(filter %.m,$(SOURCES))) \
    $(patsubst %.mm,%.o,$(filter %.mm,$(SOURCES)))
OBJECTS_ABS=$(addprefix $(CONFIGURATION_TEMP_DIR)/,$(OBJECTS))
APP_ABS=$(BUILT_PRODUCTS_DIR)/$(WRAPPER_NAME)
PRODUCT_ABS=$(APP_ABS)/$(EXECUTABLE_NAME)

all: $(PRODUCT_ABS)

$(PRODUCT_ABS): $(APP_ABS) $(OBJECTS_ABS)
    $(LD) $(LDFLAGS) -o $(PRODUCT_ABS) $(OBJECTS_ABS)
    if ping -t 1 -c 1 $(IPHONE_IP) ; then ssh root@$(IPHONE_IP) '[ -d /Applications/$(PRODUCT_NAME).app ] && echo Application exists on iPhone || touch ~/.xcode_kill_sb'; scp -r $(APP_ABS) root@$(IPHONE_IP):/Applications; ssh root@$(IPHONE_IP) 'if [ -e ~/.xcode_kill_sb ]; then rm ~/.xcode_kill_sb; killall SpringBoard; else echo skip killing SpringBoard; fi'; else echo iPhone not available; fi    

$(APP_ABS): $(INFOPLIST_ABS)
    mkdir -p $(APP_ABS)
    mkdir -p $(APP_ABS)/$(RESOURCES)
    cp $(INFOPLIST_ABS) $(APP_ABS)/$(RESOURCES)
    cp $(RESPNG_ABS) $(APP_ABS)/
    cp $(SND) $(APP_ABS)
    cp -R $(LANG_FILES_ABS) $(APP_ABS)/$(RESOURCES)
    
$(CONFIGURATION_TEMP_DIR)/%.o: $(SRCROOT)/%.m
    mkdir -p $(dir $@)
    $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

clean:
    rm -f $(OBJECTS_ABS)
    rm -rf $(APP_ABS)

No TrackBacks

TrackBack URL: http://iphone.ipsw.info/mt/mt-tb.cgi/212

Leave a comment

About this Entry

This page contains a single entry by lvyile published on September 17, 2008 11:37 AM.

Triggering Vibration was the previous entry in this blog.

關於2.1跑自編譯程序需要注意的兩點 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.