-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
182 lines (148 loc) · 5.6 KB
/
Makefile
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#
# ruBooks.app Makefile
#
CC=arm-apple-darwin9-gcc
CFLAGS=-O3
CPPFLAGS= -maspen-version-min=2.0
LD=$(CC)
LDFLAGS= -maspen-version-min=2.0 \
-lz -lobjc \
-F/toolchain/sys/System/Library/PrivateFrameworks \
-framework CoreFoundation -framework Foundation \
-framework UIKit -framework QuartzCore -framework CoreGraphics \
-framework Celestial -framework CoreFoundation -framework CoreSurface \
-framework GraphicsServices -lcrypto
# -Wl,-syslibroot,
# -lobjc -ObjC
# VERSION=$(shell ./getversion.sh)
VERSION = 0.921.1
SOURCES=$(wildcard source/palm/*.c source/palm/*.m source/*.c source/*.m)
OBJECTS=$(patsubst source/%,obj/%,$(patsubst source/palm/%,obj/%, \
$(patsubst %.c,%.o,$(filter %.c,$(SOURCES))) \
$(patsubst %.m,%.o,$(filter %.m,$(SOURCES))) \
$(patsubst %.cpp,%.o,$(filter %.cpp,$(SOURCES))) \
))
# Override this on the command line for nightly builds.
REPOTAG=colel.info
IMAGES=$(wildcard images/*.*)
CONFIG_FILES=$(wildcard configuration/*.plist);
LOCALIZATION_FILES=localization
ARCHIVE=ruBooks-$(VERSION).zip
BASEURL=http://colel.info/rubooks/
SCP_BASE=www:~/wwwroot/rubooks/
NIGHTLY_PICKUP=/tmp/rubooks-nightly
QUIET=false
ifeq ($(QUIET),true)
QC = @echo "Compiling [$@]";
QD = @echo "Computing dependencies [$@]";
QL = @echo "Linking [$@]";
QN = > /dev/null 2>&1
else
QC =
QD =
QL =
QN =
endif
all: ruBooks
# pull in dependency info for *existing* .o files
# this needs to be done after the default target is defined (to avoid defining a meaningless default target)
-include $(OBJECTS:.o=.d)
test:
echo $(OBJECTS)
bundle: ruBooks.app
ruBooks: obj/ruBooks
obj/ruBooks: $(OBJECTS) lib/libjpeg.a
$(QL)$(LD) $(LDFLAGS) -v -o $@ $^ $(QN)
# more complicated dependency computation, so all prereqs listed
# will also become command-less, prereq-less targets
# sed: put the real target (obj/*.o) in the dependency file
# sed: strip the target (everything before colon)
# sed: remove any continuation backslashes
# fmt -1: list words one per line
# sed: strip leading spaces
# sed: add trailing colons
obj/%.o: source/%.m
@mkdir -p obj
$(QC)$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(QD)$(CC) -MM -c $(CFLAGS) $(CPPFLAGS) $< > obj/$*.d
@cp -f obj/$*.d obj/$*.d.tmp
@sed -e 's|.*:|obj/$*.o:|' < obj/$*.d.tmp > obj/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < obj/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> obj/$*.d
@rm -f obj/$*.d.tmp
obj/%.o: source/%.c
@mkdir -p obj
$(QC)$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(QD)$(CC) -MM -c $(CFLAGS) $(CPPFLAGS) $< > obj/$*.d
@cp -f obj/$*.d obj/$*.d.tmp
@sed -e 's|.*:|obj/$*.o:|' < obj/$*.d.tmp > obj/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < obj/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> obj/$*.d
@rm -f obj/$*.d.tmp
obj/%.o: source/palm/%.m
@mkdir -p obj
$(QC)$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(QD)$(CC) -MM -c $(CFLAGS) $(CPPFLAGS) $< > obj/$*.d
@cp -f obj/$*.d obj/$*.d.tmp
@sed -e 's|.*:|obj/$*.o:|' < obj/$*.d.tmp > obj/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < obj/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> obj/$*.d
@rm -f obj/$*.d.tmp
obj/%.o: source/palm/%.c
@mkdir -p obj
$(QC)$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(QD)$(CC) -MM -c $(CFLAGS) $(CPPFLAGS) $< > obj/$*.d
@cp -f obj/$*.d obj/$*.d.tmp
@sed -e 's|.*:|obj/$*.o:|' < obj/$*.d.tmp > obj/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < obj/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> obj/$*.d
@rm -f obj/$*.d.tmp
clean:
rm -rf obj ruBooks.app ruBooks-*.tbz ruBooks-*.zip repo.xml repo.xml.gz
obj/Info.plist: Info.plist.tmpl
@echo "Building Info.plist for version $(VERSION)."
@sed -e 's|__VERSION__|$(VERSION)|g' < $< > $@
repo.xml: repo.xml.tmpl package
sed -e 's|__VERSION__|$(VERSION)|g' \
-e 's|__PKG_SIZE__|$(shell ./filesize.sh $(ARCHIVE))|g' \
-e 's|__RELEASE_DATE__|$(shell date +%s)|g' \
-e 's|__PKG_URL__|$(BASEURL)$(ARCHIVE)|g' \
-e 's|__REPOTAG__| $(REPOTAG)|g' \
-e 's|__MD5__|$(shell ./getMd5.sh $(ARCHIVE))|g' \
-e 's/^[[:space:]]*\(\([[:space:]]*[^[:space:]][^[:space:]]*\)*\)[[:space:]]*$($)/\1/' \
< repo.xml.tmpl > $@
gzip -9 < $@ > [email protected]
ruBooks.app: obj/ruBooks obj/Info.plist $(IMAGES) $(CONFIG_FILES)
@echo "Creating application bundle."
@rm -fr ruBooks.app
@mkdir -p ruBooks.app
@cp $^ ruBooks.app/
@cp -r localization/*.* ruBooks.app/
# @cp -r localization/English.lproj ruBooks.app/
# @cp -r localization/Russian.lproj ruBooks.app/
# @cp -r localization/Chinese.lproj ruBooks.app/
# @cp -r localization/Japanese.lproj ruBooks.app/
# @cp -r localization/German.lproj ruBooks.app/
# @cp -r localization/ko.lproj ruBooks.app/
# @cp -r localization/ru.lproj ruBooks.app/
deploy: obj/ruBooks
scp obj/ruBooks iphone:/Applications/ruBooks.app/
#ssh iphone chmod +x /Applications/ruBooks.app/ruBooks
deploy-app: bundle
scp -r ruBooks.app root@iphone:/Applications/
package: bundle
zip -y -r9 $(ARCHIVE) ruBooks.app
deploy-repo: package repo.xml
scp $(ARCHIVE) $(SCP_BASE)
scp repo.xml $(SCP_BASE)
# The nightly build builds the ZIP and repo XML, then places them both in a known location
# where the build server will find them to deploy to the site.
# The lock file ensure that the deployment job won't try to move files that are half copied.
nightly: package repo.xml
mkdir -p $(NIGHTLY_PICKUP)
touch $(NIGHTLY_PICKUP)/lock-file
cp repo.xml $(NIGHTLY_PICKUP)
cp repo.xml.gz $(NIGHTLY_PICKUP)
cp ruBooks-*.zip $(NIGHTLY_PICKUP)
chmod g+w $(NIGHTLY_PICKUP)/*
rm $(NIGHTLY_PICKUP)/lock-file