-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.inc
572 lines (422 loc) · 10 KB
/
makefile.inc
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
VER=CHDK
PLATFORM=s3is
PLATFORMSUB=100a
#PLATFORM=a620
#PLATFORMSUB=100f
#PLATFORM=a610
#PLATFORMSUB=100e
#PLATFORM=ixus40_sd300
#PLATFORMSUB=100k
#PLATFORM=ixus40_sd300
#PLATFORMSUB=100j
#PLATFORM=sx100is
#PLATFORMSUB=100c
#PLATFORM=sx10
#PLATFORMSUB=101a
#PLATFORM=sx1
#PLATFORMSUB=200h
#PLATFORM=sx100is
#PLATFORMSUB=100b
#PLATFORM=sx110is
#PLATFORMSUB=100b
#PLATFORM=sx130is
#PLATFORMSUB=101c
#PLATFORM=sx200is
#PLATFORMSUB=100c
# note, 100d compatible with 100c
#PLATFORM=ixus50_sd400
#PLATFORMSUB=101a
#PLATFORM=ixus50_sd400
#PLATFORMSUB=101b
#PLATFORM=ixus750_sd550
#PLATFORMSUB=100f
#PLATFORM=ixus750_sd550
#PLATFORMSUB=100g
#PLATFORM=a640
#PLATFORMSUB=100b
#PLATFORM=a700
#PLATFORMSUB=100b
#PLATFORM=a710
#PLATFORMSUB=100a
#PLATFORM=s2is
#PLATFORMSUB=100e
#PLATFORM=s2is
#PLATFORMSUB=100f
#PLATFORM=s2is
#PLATFORMSUB=100g
#PLATFORM=g7
#PLATFORMSUB=100e
#PLATFORM=g7
#PLATFORMSUB=100g
#PLATFORM=g7
#PLATFORMSUB=100i
#PLATFORM=g7
#PLATFORMSUB=100j
#PLATFORM=g9
#PLATFORMSUB=100d
#PLATFORM=g9
#PLATFORMSUB=100g
#PLATFORM=a530
#PLATFORMSUB=100a
#PLATFORM=a540
#PLATFORMSUB=100b
#PLATFORM=a560
#PLATFORMSUB=100a
#PLATFORM=a570
#PLATFORMSUB=101a
#PLATFORM=a570
#PLATFORMSUB=100e
#PLATFORM=a610
#PLATFORMSUB=100f
#PLATFORM=ixus700_sd500
#PLATFORMSUB=101a
#PLATFORM=ixus700_sd500
#PLATFORMSUB=101b
#PLATFORM=ixus800_sd700
#PLATFORMSUB=100b
#PLATFORM=ixus800_sd700
#PLATFORMSUB=101b
#PLATFORM=a720
#PLATFORMSUB=100c
#PLATFORM=ixus850_sd800
#PLATFORMSUB=100e
#PLATFORM=ixus860_sd870
#PLATFORMSUB=100c
#PLATFORM=ixus870_sd880
#PLATFORMSUB=100e
#PLATFORM=ixus870_sd880
#PLATFORMSUB=101a
#PLATFORM=ixus870_sd880
#PLATFORMSUB=102b
#PLATFORM=ixus80_sd1100
#PLATFORMSUB=100c
#PLATFORM=ixus80_sd1100
#PLATFORMSUB=101a
#PLATFORM=ixus950_sd850
#PLATFORMSUB=100c
#PLATFORM=ixus55_sd450
#PLATFORMSUB=100b
#PLATFORM=ixus55_sd450
#PLATFORMSUB=100c
#PLATFORM=ixus55_sd450
#PLATFORMSUB=100d
#PLATFORM=ixus60_sd600
#PLATFORMSUB=100a
#PLATFORM=ixus60_sd600
#PLATFORMSUB=100d
#PLATFORM=ixus70_sd1000
#PLATFORMSUB=100c
#PLATFORM=ixus70_sd1000
#PLATFORMSUB=101b
#PLATFORM=ixus70_sd1000
#PLATFORMSUB=102a
#PLATFORM=a650
#PLATFORMSUB=100d
#PLATFORM=a450
#PLATFORMSUB=100d
#PLATFORM=a460
#PLATFORMSUB=100d
#PLATFORM=a550
#PLATFORMSUB=100c
#PLATFORM=a590
#PLATFORMSUB=100e
#PLATFORM=a590
#PLATFORMSUB=101b
#PLATFORM=a630
#PLATFORMSUB=100c
#PLATFORM=s5is
#PLATFORMSUB=101a
#PLATFORM=s5is
#PLATFORMSUB=101b
#PLATFORM=ixus65_sd630
#PLATFORMSUB=100a
#PLATFORM=tx1
#PLATFORMSUB=100g
#PLATFORM=tx1
#PLATFORMSUB=101b
#PLATFORM=ixus900_sd900
#PLATFORMSUB=100c
#PLATFORM=ixus960_sd950
#PLATFORMSUB=100d
#PLATFORM=ixus970_sd890
#PLATFORMSUB=100b
#PLATFORM=ixus970_sd890
#PLATFORMSUB=100c
#PLATFORM=ixus970_sd890
#PLATFORMSUB=100f
#PLATFORM=ixus75_sd750
#PLATFORMSUB=100b
#PLATFORM=ixus75_sd750
#PLATFORMSUB=101a
#PLATFORM=ixus75_sd750
#PLATFORMSUB=102a
#PLATFORM=ixusizoom_sd30
#PLATFORMSUB=100g
#PLATFORM=a470
#PLATFORMSUB=102c
#PLATFORM=a470
#PLATFORMSUB=101b
#PLATFORM=ixus980_sd990
#PLATFORMSUB=100e
#PLATFORM=ixus980_sd990
#PLATFORMSUB=101b
#PLATFORM=a2000
#PLATFORMSUB=100c
#PLATFORM=ixus100_sd780
#PLATFORMSUB=100c
PLATFORM=ixus120_sd940
PLATFORMSUB=100e
PLATFORM=ixus120_sd940
PLATFORMSUB=101a
PLATFORM=ixus120_sd940
PLATFORMSUB=102c
PLATFORM=ixus120_sd940
PLATFORMSUB=103b
PLATFORM=ixus120_sd940
PLATFORMSUB=103c
#PLATFORM=ixus90_sd790
#PLATFORMSUB=100c
#PLATFORM=ixus90_sd790
#PLATFORMSUB=100d
#PLATFORM=g11
#PLATFORMSUB=100f
#PLATFORM=g11
#PLATFORMSUB=100j
#PLATFORM=g11
#PLATFORMSUB=100l
#PLATFORM=sx20
#PLATFORMSUB=102b
#PLATFORM=ixus85_sd770
#PLATFORMSUB=100a
#PLATFORM=ixus95_sd1200
#PLATFORMSUB=100c
#PLATFORM=sx30
#PLATFORMSUB=100e
#PLATFORM=sx30
#PLATFORMSUB=100h
#PLATFORM=sx30
#PLATFORMSUB=100l
#PLATFORM=g12
#PLATFORMSUB=100c
#PLATFORM=g12
#PLATFORMSUB=100e
#PLATFORM=g12
#PLATFORMSUB=100f
#PLATFORM=a430
#PLATFORMSUB=100b
#PLATFORM=d10
#PLATFORMSUB=100a
#PLATFORM=s95
#PLATFORMSUB=100e
#PLATFORM=s95
#PLATFORMSUB=100h
#PLATFORM=s95
#PLATFORMSUB=100i
MEMISOSIZE="(&_end-&_start)"
# override this on the command line or in buildconf to use PRIMARY.BIN from a different tree
# should be an absolute path
PRIMARY_ROOT=$(topdir)platform
include $(topdir)buildconf.inc
# optional local version of buildconf.inc, not in SVN so it can be used in autobuilds
# and to avoid getting accidentally included in svn diffs
# you may also set your default camera here
-include $(topdir)localbuildconf.inc
include $(topdir)version.inc
include $(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc
# Used in gui_debug.c for controlling memory browser allowed address ranges
# override in platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc to set camera specific value
ifdef MAXRAMADDR
PLFLAGS+=-DMAXRAMADDR=$(MAXRAMADDR)
else
PLFLAGS+=-DMAXRAMADDR=0x2000000
endif
ifdef ROMBASEADDR
PLFLAGS+=-DROMBASEADDR=$(ROMBASEADDR)
else
PLFLAGS+=-DROMBASEADDR=0xFFC00000
endif
ifdef OPT_FI2
include $(topdir)/platform/fi2.inc
endif
SILENT=SILENT
NOZERO100K=TRUE
##########################################################################
##########################################################################
##########################################################################
ESED = sed -r
# keep sort order consistent
export LC_ALL=C
ifndef OSTYPE
HOSTPLATFORM:=$(patsubst MINGW%,MINGW,$(shell uname -s))
ifeq ($(HOSTPLATFORM),MINGW)
OSTYPE = Windows
EXE = .exe
SH = sh
DEVNULL = NUL
OLDSEPARATOR = \\\\
NEWSEPARATOR = /
SORT := $(dir $(shell which uniq.exe | sed 's_$(OLDSEPARATOR)_$(NEWSEPARATOR)_g'))/sort.exe
else
ifeq ($(HOSTPLATFORM),Linux)
OSTYPE = Linux
EXE =
SH =
DEVNULL = /dev/null
SORT = sort
else
ifeq ($(HOSTPLATFORM),Darwin)
OSTYPE = Darwin
EXE =
SH =
DEVNULL = /dev/null
SORT = sort
ESED = sed -E
else
OSTYPE = Other
EXE =
SH =
DEVNULL = /dev/null
SORT = sort
endif
endif
endif
else
EXE =
SH =
DEVNULL = /dev/null
SORT = sort
endif
##########################################################################
##########################################################################
##########################################################################
HOSTCC=gcc
HOSTCFLAGS=-g -O2 -Wall
HOSTAR=ar
PAKWIF=$(topdir)tools/pakwif$(EXE)
PAKFI2=$(topdir)tools/packfi2/fi2enc$(EXE)
ENCODE_DISKBOOT=$(topdir)tools/dancingbits$(EXE)
##########################################################################
CC=arm-elf-gcc
OBJCOPY=arm-elf-objcopy
OBJDUMP=arm-elf-objdump
STRIP=arm-elf-strip
NM=arm-elf-nm
AR=arm-elf-ar
RANLIB=arm-elf-ranlib
SIZE=arm-elf-size
GCC_VERSION=$(shell $(CC) -dumpversion)
GCC_VERSION_MAJOR=$(firstword $(subst ., ,$(GCC_VERSION)))
# -msoft-float is used per default but object files are marked as hard-float
CFLAGS=-fno-inline -Os -fno-strict-aliasing
# flags for gcc v4
# CFLAGS+=-mcpu=arm946e-s
# for gcc v3, we use to allow use of strd etc
ifeq ($(GCC_VERSION_MAJOR),3)
CFLAGS+=-march=armv5te
else
ifeq ($(GCC_VERSION_MAJOR),4)
# TODO should be -mcpu, but breaks things ATM
CFLAGS+=-mtune=arm946e-s
endif
endif
CTHUMB=-mthumb
CFLAGS+=-mthumb-interwork
CFLAGS+=-I$(topdir)include -I$(topdir)platform/$(PLATFORM) $(PLFLAGS) $(CPPFLAGS)
CFLAGS+=-DPLATFORM=\"$(PLATFORM)\" -DPLATFORMSUB=\"$(PLATFORMSUB)\" -DPLATFORMID=$(PLATFORMID) -DHDK_VERSION=\"$(VER)\" -DBUILD_NUMBER=\"$(BUILD_NUMBER)\" -DCAMERA_$(PLATFORM)=1
CFLAGS+=-Wall -Wno-unused -Wno-format
LDFLAGS=-L$(topdir)lib/math -L$(topdir)lib/font
LDFLAGS+=-L$(topdir)lib/libc -L$(topdir)lib/ubasic
LDFLAGS+=-L$(topdir)platform/$(PLATFORM) -L$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)
ifdef OPT_DEBUGGING
CFLAGS+=-DOPT_DEBUGGING
endif
ifdef OPT_PTP
CFLAGS+=-DOPT_PTP
endif
ifdef OPT_LUA
CFLAGS+=-DOPT_LUA
OPT_SCRIPTING=1
endif
ifdef OPT_UBASIC
CFLAGS+=-DOPT_UBASIC
OPT_SCRIPTING=1
endif
ifdef OPT_SCRIPTING
CFLAGS+=-DOPT_SCRIPTING
endif
ifdef OPT_EXMEM_MALLOC
CFLAGS+=-DOPT_EXMEM_MALLOC
endif
ifdef OPT_EXMEM_TESTING
CFLAGS+=-DOPT_EXMEM_TESTING
endif
ifdef EXMEM_HEAP_SKIP
CFLAGS+=-DEXMEM_HEAP_SKIP=$(EXMEM_HEAP_SKIP)
endif
ifdef EXMEM_BUFFER_SIZE
CFLAGS+=-DEXMEM_BUFFER_SIZE=$(EXMEM_BUFFER_SIZE)
endif
ifdef OPT_CHDK_IN_EXMEM
CFLAGS+=-DOPT_CHDK_IN_EXMEM
endif
ifdef OPT_WARNINGS
ifeq ($(GCC_VERSION_MAJOR),3)
CFLAGS+=-Wwrite-strings -Wsign-compare -Wunused -Wno-unused-parameter
HOSTCFLAGS+=-Wwrite-strings -Wsign-compare -Wunused -Wno-unused-parameter
endif
ifeq ($(GCC_VERSION_MAJOR),4)
CFLAGS+=-Wextra -fdiagnostics-show-option -Wno-missing-field-initializers -Wunused -Wno-unused-parameter
#HOSTCFLAGS+=-Wextra -fdiagnostics-show-option -Wno-missing-field-initializers -Wunused -Wno-unused-parameter
endif
endif
##########################################################################
default: all
ifndef SKIPBUILDRULES
%.o: %.c
@echo $< \-\> $@
$(CC) $(CFLAGS) -nostdinc -c -o $@ $<
%.o: %.S
@echo $< \-\> $@
$(CC) $(CFLAGS) -nostdinc -c -o $@ $<
%.a:
@echo $^ \-\> $@
$(AR) rcs $@ $^
.dep/%.d: %.c .dep
$(CC) $(CFLAGS) -M $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
.dep/%.d: %.S .dep
$(CC) $(CFLAGS) -M $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
endif
all: all-recursive
clean: clean-recursive
distclean: distclean-recursive
.dep:
mkdir .dep
clean-recursive:
@for i in $(SUBDIRS); do \
echo \>\> Cleaning in $(FOLDER)$$i; \
$(MAKE) -C $$i FOLDER="$(FOLDER)$$i/" clean || exit 1; \
done
distclean-recursive:
@for i in $(SUBDIRS); do \
echo \>\> Distcleaning in $(FOLDER)$$i; \
$(MAKE) -C $$i FOLDER="$(FOLDER)$$i/" distclean || exit 1; \
done
all-recursive:
@for i in $(SUBDIRS); do \
echo \>\> Entering to $(FOLDER)$$i; \
$(MAKE) -C $$i FOLDER="$(FOLDER)$$i/" || exit 1; \
echo \<\< Leaving $(FOLDER)$$i; \
done
depend-recursive:
@for i in $(SUBDIRS); do \
echo \>\> Entering to $(FOLDER)$$i; \
$(MAKE) -C $$i FOLDER="$(FOLDER)$$i/" depend || exit 1; \
echo \<\< Leaving $(FOLDER)$$i; \
done
ifdef SILENT
.SILENT:
endif