forked from javacom/toolchain4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GenericMakefileForApps4
158 lines (138 loc) · 4.76 KB
/
GenericMakefileForApps4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Makefile for gcc compiler for toolchain 4 (SDK Headers)
PROJECTNAME:=MyApp
APPFOLDER:=$(PROJECTNAME).app
INSTALLFOLDERi:=$(PROJECTNAME).app
TOOLCHAIN:=/toolchain4
SDK:=$(TOOLCHAIN)/sys
MINIMUMVERSION:=4.0
DEPLOYMENTTARGET:=$(MINIMUMVERSION)
IPHONEOSMINVERSION:=40000
#define __IPHONE_3_0 30000
#define __IPHONE_4_0 40000
#define __IPHONE_3_0 30000
#define __IPHONE_4_0 40000
#define __IPHONE_4_1 40100
#define __IPHONE_4_2 40200
DEBUG=DEBUGOFF
#CC:=$(TOOLCHAIN)/pre/bin/arm-apple-darwin9-gcc
CC:=clang -ccc-host-triple arm-apple-darwin9
CPP:=$(TOOLCHAIN)/pre/bin/arm-apple-darwin9-g++
LD:=$(TOOLCHAIN)/pre/bin/arm-apple-darwin9-gcc
LDFLAGS := -lobjc -Obj-C
LDFLAGS += -framework CoreFoundation
LDFLAGS += -framework Foundation
LDFLAGS += -framework UIKit
LDFLAGS += -framework CoreGraphics
//LDFLAGS += -framework AVFoundation
//LDFLAGS += -framework AddressBook
//LDFLAGS += -framework AddressBookUI
//LDFLAGS += -framework AudioToolbox
//LDFLAGS += -framework AudioUnit
//LDFLAGS += -framework CFNetwork
//LDFLAGS += -framework CoreAudio
//LDFLAGS += -framework CoreData
//LDFLAGS += -framework CoreFoundation
//LDFLAGS += -framework GraphicsServices
//LDFLAGS += -framework CoreLocation
//LDFLAGS += -framework ExternalAccessory
//LDFLAGS += -framework GameKit
//LDFLAGS += -framework IOKit
//LDFLAGS += -framework MapKit
//LDFLAGS += -framework MediaPlayer
//LDFLAGS += -framework MessageUI
//LDFLAGS += -framework MobileCoreServices
//LDFLAGS += -framework OpenAL
//LDFLAGS += -framework OpenGLES
//LDFLAGS += -framework QuartzCore
//LDFLAGS += -framework Security
//LDFLAGS += -framework StoreKit
//LDFLAGS += -framework System
//LDFLAGS += -framework SystemConfiguration
//LDFLAGS += -framework CoreSurface
//LDFLAGS += -framework GraphicsServices
//LDFLAGS += -framework Celestial
//LDFLAGS += -framework WebCore
//LDFLAGS += -framework WebKit
//LDFLAGS += -framework SpringBoardUI
//LDFLAGS += -framework TelephonyUI
//LDFLAGS += -framework JavaScriptCore
//LDFLAGS += -framework PhotoLibrary
LDFLAGS += -isysroot $(SDK)
//LDFLAGS += -F"$(SDK)/System/Library/Frameworks"
LDFLAGS += -F"$(SDK)/System/Library/PrivateFrameworks"
LDFLAGS += -Wl,-dead_strip -all_load -miphoneos-version-min=$(MINIMUMVERSION)
LDFLAGS += -bind_at_load
LDFLAGS += -multiply_defined suppress
LDFLAGS += -arch=armv6
//LDFLAGS += -march=armv6
//LDFLAGS += -mcpu=arm1176jzf-s
CFLAGS += -ObjC -fblocks
CFLAGS += -std=c99 #-Wall
CFLAGS += -isysroot $(SDK)
CFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=$(IPHONEOSMINVERSION)
ifeq ($(DEBUG),DEBUGOFF)
CFLAGS += -g0 -O2
else
CFLAGS += -g
CFLAGS += -D$(DEBUG)
endif
CFLAGS += -Wno-attributes -Wno-trigraphs -Wreturn-type -Wunused-variable
ifeq ($(DEBUG),DEBUGOFF)
CPPFLAGS += -g0 -O2
else
CPPFLAGS += -g
CPPFLAGS += -D$(DEBUG)
endif
CPPFLAGS += -isysroot $(SDK)
CPPFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=$(IPHONEOSMINVERSION)
CPPFLAGS += -Wno-attributes -Wno-trigraphs -Wreturn-type -Wunused-variable
CPPFLAGS += -I"$(SDK)/usr/include/c++/4.2.1"
CPPFLAGS += -I"$(SDK)/usr/include/c++/4.2.1/armv7-apple-darwin9"
BUILDDIR=./build/$(MINIMUMVERSION)
SRCDIR1=.
OBJS+=$(patsubst %.m,%.o,$(wildcard $(SRCDIR1)/*.m))
OBJS+=$(patsubst %.c,%.o,$(wildcard $(SRCDIR1)/*.c))
PCH:=$(wildcard *.pch)
INFOPLIST:=$(wildcard *Info.plist)
CFLAGS += -I"$(SRCDIR1)"
CPPLAGS += -I"$(SRCDIR1)"
all: $(PROJECTNAME)
$(PROJECTNAME): $(OBJS)
export IPHONEOS_DEPLOYMENT_TARGET=$(DEPLOYMENTTARGET);$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@
%.o: %.m
$(CC) -include $(PCH) -c $(CFLAGS) $< -o $@
%.o: %.c
$(CC) -include $(PCH) -c $(CFLAGS) $< -o $@
%.o: %.cpp
$(CPP) -include $(PCH) -c $(CPPFLAGS) $< -o $@
dist: $(PROJECTNAME)
rm -rf $(BUILDDIR)
mkdir -p $(BUILDDIR)/$(APPFOLDER)
ifneq ($(RESOURCES),)
cp -r $(RESOURCES) $(BUILDDIR)/$(APPFOLDER)
rm -fr $(BUILDDIR)/$(APPFOLDER)/.svn
rm -fr $(BUILDDIR)/$(APPFOLDER)/*/.svn
endif
cp $(INFOPLIST) $(BUILDDIR)/$(APPFOLDER)/Info.plist
@echo "APPL????" > $(BUILDDIR)/$(APPFOLDER)/PkgInfo
export CODESIGN_ALLOCATE=$(TOOLCHAIN)/pre/bin/arm-apple-darwin9-codesign_allocate; $(TOOLCHAIN)/pre/bin/ldid -S $(PROJECTNAME)
mv $(PROJECTNAME) $(BUILDDIR)/$(APPFOLDER)
mkdir -p $(BUILDDIR)/Payload
cd $(BUILDDIR)/Payload; ln -s ../$(APPFOLDER) .
cd $(BUILDDIR); zip -r $(PROJECTNAME).ipa Payload > /dev/null
rm -fr $(BUILDDIR)/Payload
install: dist
ping -t 3 -c 1 $(IPHONE_IP)
ssh root@$(IPHONE_IP) 'rm -fr /Applications/$(INSTALLFOLDER)'
scp -r $(BUILDDIR)/$(APPFOLDER) root@$(IPHONE_IP):/Applications/$(INSTALLFOLDER)
@echo "Application $(INSTALLFOLDER) installed"
ssh mobile@$(IPHONE_IP) 'uicache'
uninstall:
ping -t 3 -c 1 $(IPHONE_IP)
ssh root@$(IPHONE_IP) 'rm -fr /Applications/$(INSTALLFOLDER)'
@echo "Application $(INSTALLFOLDER) uninstalled"
clean:
@rm -f $(SRCDIR1)/*.o
@rm -rf $(BUILDDIR)
@rm -f $(PROJECTNAME)
.PHONY: all dist install uninstall clean