]> git.saurik.com Git - wxWidgets.git/blob - build/palmos/makefile-engine.mk
Do not run focus detection when handling events from editor control (mostly because...
[wxWidgets.git] / build / palmos / makefile-engine.mk
1 ## Palm OS Protein Generic Makefile Engine for Eclipse v1.0.0
2 #
3 # Last edit: 7/22/04
4 #
5 # This makefile engine is capable of compiling Protein
6 # applications for Palm OS.
7 #
8 # This makefile engine assumes that the following variables are
9 # set outside of this makefile by a referencing master makefile
10 # (see a master makefile generated by a Palm OS Developer
11 # Suite wizard for detailed explanation of each variable):
12 #
13 # SOURCES
14 # RESOURCES
15 # DATABASE_RESET
16 # DATABASE_BACKUP
17 # DATABASE_HIDDEN
18 # DATABASE_PROTECT
19 # DATABASE_BUNDLE
20 # DATABASE_VERSION
21 # DATABASE_NAME
22 # PROJECT_TYPE
23 # DEBUG_OR_RELEASE
24 # OPTIMIZE_LEVEL
25 # WARNING_LEVEL
26 # ENABLE_EXCEPTIONS
27 # ENABLE_ASSERTIONS
28 # ADDITIONAL_LINK_LIBRARIES
29 # ADDITIONAL_SIM_LINK_LIBRARIES
30 # LOCAL_INCLUDE_PATHS
31 # LOCAL_SIM_INCLUDE_PATHS
32 # SYSTEM_INCLUDE_PATHS
33 # SYSTEM_SIM_INCLUDE_PATHS
34 # DEFINES
35 # SIM_DEFINES
36 # ADDITIONAL_COMPILER_FLAGS
37 # ADDITIONAL_SIM_COMPILER_FLAGS
38 # ADDITIONAL_LINKER_FLAGS
39 # ADDITIONAL_SIM_LINKER_FLAGS
40 # ADDITIONAL_AR_FLAGS
41 # ADDITIONAL_SIM_AR_FLAGS
42 # TEXTENCODING
43 # LOCALE_CHECKING
44 # STRICT_ENCODING
45 # SDK_LOCATION
46 # TARGET_PLATFORM
47 #
48 # Additionally, the user of this makefile engine may obtain the
49 # dynamic values for:
50 # SDK_LOCATION
51 # SDK_VERSION
52 # TOOLS_DIR
53 # by doing an optional include of a makefile segment that is
54 # generated during the Palm OS Developer Suite standard make build.
55 # The makefile line to accomplish this is:
56 # -include auto-generated.mk
57 # All master makefiles generated by Palm OS Developer Suite
58 # wizards include this line already to pick up and use these
59 # dynamic definitions.
60 #
61 # All variable values may be overridden by editing the make command
62 # for the project (Project->Properties->C/C++ Make Project->Make Builder,
63 # Build Command field).
64 #
65
66 ###############################################################################
67 # Defaults
68 FN_DEPEND=.dependencies
69
70 comma:= ,
71
72 ifeq ($(TOOLS_DIR), )
73 TOOLS_DIR =
74 endif
75
76 # Locale (defaults to English)
77 ifeq ($(LOCALE), )
78 LOCALE := enUS
79 endif
80
81 ifeq ($(CREATOR_ID), )
82 CREATOR_ID = STRT
83 endif
84
85 ifeq ($(DB_TYPE), )
86 DB_TYPE = appl
87 endif
88
89 ifeq ($(SLD_FILE), )
90 SLD_FILE = none
91 endif
92
93 ifeq ($(DEBUG_DEVICE_OUTPUT_DIR), )
94 DEBUG_DEVICE_OUTPUT_DIR = DebugDevice
95 endif
96
97 ifeq ($(RELEASE_DEVICE_OUTPUT_DIR), )
98 RELEASE_DEVICE_OUTPUT_DIR = ReleaseDevice
99 endif
100
101 ifeq ($(DEBUG_SIMULATOR_OUTPUT_DIR), )
102 DEBUG_SIMULATOR_OUTPUT_DIR = DebugSim
103 endif
104
105 ifeq ($(RELEASE_SIMULATOR_OUTPUT_DIR), )
106 RELEASE_SIMULATOR_OUTPUT_DIR = ReleaseSim
107 endif
108
109 ifeq ($(SDK_VERSION), )
110 SDK_VERSION = sdk-6
111 endif
112
113 ifeq ($(ENABLE_EXCEPTIONS), )
114 ENABLE_EXCEPTIONS=TRUE
115 endif
116
117 ###############################################################################
118 # App/PRC/Database Names
119 #
120 # The difference between App Name and Database name is that App Name may
121 # contain spaces while the database name is the App name with spaces removed.
122 # (Coded in such a way that if the user already explicitly defined these
123 # variables previously, we'll go with those).
124
125 ifeq ($(DATABASE_NAME), )
126 ifeq ($(ESCAPED_ARTIFACT_NAME), )
127 # Database name defaults if ARTIFACT_NAME is empty
128 DATABASE_NAME = StartApp
129 else
130 DATABASE_NAME = $(ESCAPED_ARTIFACT_NAME)
131 endif
132 endif
133
134 ifeq ($(PRC_NAME), )
135 ifeq ($(ESCAPED_ARTIFACT_NAME), )
136 # PRC name defaults if ESCAPED_ARTIFACT_NAME is empty
137 PRC_NAME = Start.prc
138 else
139 PRC_NAME = $(DATABASE_NAME).prc
140 endif
141 endif
142
143 ifeq ($(LIB_NAME), )
144 ifeq ($(ESCAPED_ARTIFACT_NAME), )
145 # LIB name defaults if ESCAPED_ARTIFACT_NAME is empty
146 LIB_NAME = Start.a
147 else
148 LIB_NAME = $(DATABASE_NAME).a
149 endif
150 endif
151
152 ifeq ($(SIM_LIB_NAME), )
153 ifeq ($(ESCAPED_ARTIFACT_NAME), )
154 # SIM LIB name defaults if ESCAPED_ARTIFACT_NAME is empty
155 SIM_LIB_NAME = Start.lib
156 else
157 SIM_LIB_NAME = $(DATABASE_NAME).lib
158 endif
159 endif
160
161 ###############################################################################
162 # Compile and Link Settings
163
164 ifeq ($(TARGET_FORMAT), )
165 TARGET_FORMAT=PalmOS6
166 endif
167
168 # Compiler settings... compiler + optimizations + debug
169 # This is a makefile for Palm OS 6 so the compilers used are as follows:
170 # Device target compiler is pacc
171 # Simulator target compiler is gcc
172
173 UNAME :=$(shell uname)
174 ifeq ($(UNAME),Linux)
175 # Linux Settings
176 PELF2BIN:=wine "$(TOOLS_DIR)/pelf2bin.exe"
177 PSLIB:=wine "$(TOOLS_DIR)/pslib.exe"
178 PRCMERGE :=wine "$(TOOLS_DIR)/PRCMerge.exe"
179 PALMRC :=wine "$(TOOLS_DIR)/PalmRc.exe"
180 CYGPATH_WA:=echo
181 CYGPATH_MF:=echo
182 CC = wine "$(TOOLS_DIR)pacc"
183 CXX = wine "$(TOOLS_DIR)pacc"
184 LD = wine "$(TOOLS_DIR)pacc"
185 else
186 # Cygwin Settings
187 PELF2BIN:="$(TOOLS_DIR)/pelf2bin"
188 PSLIB:="$(TOOLS_DIR)/pslib.exe"
189 PRCMERGE :="$(TOOLS_DIR)/PRCMerge.exe"
190 PALMRC :="$(TOOLS_DIR)/PalmRc.exe"
191 CYGPATH_WA:=cygpath -w -a
192 CYGPATH_MF:=cygpath -m -f
193 CC = "$(TOOLS_DIR)pacc"
194 CXX = "$(TOOLS_DIR)pacc"
195 LD = "$(TOOLS_DIR)pacc"
196 endif
197
198 SIM_CC = gcc
199 SIM_LD = gcc
200
201 DEV_CFLAGS += -D__PALMOS_KERNEL__=1 -D__PALMOS__=0x06000000
202 SIM_CFLAGS += -fexceptions -D__PALMOS_KERNEL__=1 -D__PALMOS__=0x06000000 -D_SUPPORTS_NAMESPACE=0 -D_SUPPORTS_RTTI=1 -DTARGET_PLATFORM=TARGET_PLATFORM_PALMSIM_WIN32 -DTARGET_HOST=TARGET_HOST_PALMOS #-mno-cygwin -mwindows
203
204 # Warning level for device target
205 ifeq ($(WARNING_LEVEL), ALL)
206 DEV_CFLAGS += -W4
207 else
208 ifeq ($(WARNING_LEVEL), SOME)
209 DEV_CFLAGS += -W2
210 else
211 ifeq ($(WARNING_LEVEL), NONE)
212 DEV_CFLAGS += -W0
213 endif
214 endif
215 endif
216
217 # Warning level for simulator target
218 ifeq ($(SIM_WARNING_LEVEL), ALL)
219 SIM_CFLAGS += -Wall
220 else
221 ifeq ($(SIM_WARNING_LEVEL), NONE)
222 SIM_CFLAGS += -w
223 endif
224 endif
225
226 # Warnings as errors for device builds
227 ifeq ($(WARNING_AS_ERROR), TRUE)
228 DEV_CFLAGS += -Werror
229 endif
230
231 # Warnings as errors for simulator builds
232 ifeq ($(SIM_WARNING_AS_ERROR), TRUE)
233 SIM_CFLAGS += -Werror
234 endif
235
236 # Adding after other warnings flags so this is always in effect
237 SIM_CFLAGS += -Wno-multichar
238
239 # Verbose output for device build
240 ifeq ($(VERBOSE), TRUE)
241 DEV_CFLAGS += -v
242 endif
243
244 # Verbose output for simulator build
245 ifeq ($(SIM_VERBOSE), TRUE)
246 SIM_CFLAGS += -v
247 endif
248
249 # Dislay logo
250 ifeq ($(ARM_LOGO), TRUE)
251 DEV_CFLAGS += -logo
252 else
253 DEV_CFLAGS += -nologo
254 endif
255
256 # Exception handling support
257 ifeq ($(ENABLE_EXCEPTIONS), TRUE)
258 DEV_CFLAGS += -ex
259 DEV_LDFLAGS += -ex
260 endif
261
262 # Assertion handling support
263 ifeq ($(ENABLE_ASSERTIONS), TRUE)
264 DEV_CFLAGS += -UNDEBUG
265 else
266 DEV_CFLAGS += -DNDEBUG=1
267 endif
268
269 # Additional linker flags
270 ifdef ADDITIONAL_PALINK_FLAGS
271 DEV_LDFLAGS += $(ADDITIONAL_PALINK_FLAGS)
272 endif
273
274 # Optimization settings
275 ifeq ($(OPTIMIZE_LEVEL), INLINING)
276 OPTIMIZER_FLAG = -O5
277 SIM_OPTIMIZER_FLAG = -O3
278 else
279 ifeq ($(OPTIMIZE_LEVEL), INTERPROCEDURAL)
280 OPTIMIZER_FLAG = -O4
281 SIM_OPTIMIZER_FLAG = -O3
282 else
283 ifeq ($(OPTIMIZE_LEVEL), FULL)
284 OPTIMIZER_FLAG = -O3
285 SIM_OPTIMIZER_FLAG = -O3
286 else
287 ifeq ($(OPTIMIZE_LEVEL), INTRAPROCEDURAL)
288 OPTIMIZER_FLAG = -O2
289 SIM_OPTIMIZER_FLAG = -O3
290 else
291 ifeq ($(OPTIMIZE_LEVEL), SOME)
292 OPTIMIZER_FLAG = -O1
293 SIM_OPTIMIZER_FLAG = -O1
294 else
295 ifeq ($(OPTIMIZE_LEVEL), NONE)
296 OPTIMIZER_FLAG = -O0
297 SIM_OPTIMIZER_FLAG = -O0
298 else
299 # Default to 0 for debug, 3 for release
300 ifeq ($(DEBUG_OR_RELEASE), Debug)
301 OPTIMIZER_FLAG = -O0
302 SIM_OPTIMIZER_FLAG = -O0
303 else
304 OPTIMIZER_FLAG = -O3
305 SIM_OPTIMIZER_FLAG = -O3
306 endif
307 endif
308 endif
309 endif
310 endif
311 endif
312 endif
313
314 # Debug settings (can override optimize settings)
315 ifeq ($(DEBUG_OR_RELEASE), Debug)
316 DEBUG_FLAG += -g
317 BUILD_TYPE_FLAG = -DBUILD_TYPE=BUILD_TYPE_DEBUG
318 TRACE_OUTPUT_FLAG = -DTRACE_OUTPUT=TRACE_OUTPUT_ON
319 else
320 BUILD_TYPE_FLAG = -DBUILD_TYPE=BUILD_TYPE_RELEASE
321 TRACE_OUTPUT_FLAG = -DTRACE_OUTPUT=TRACE_OUTPUT_OFF
322 endif
323
324 ifeq ($(DEBUG_OR_RELEASE), Debug)
325 OBJ_DIR = $(DEBUG_DEVICE_OUTPUT_DIR)
326 SIM_OBJ_DIR = $(DEBUG_SIMULATOR_OUTPUT_DIR)
327 else
328 OBJ_DIR = $(RELEASE_DEVICE_OUTPUT_DIR)
329 SIM_OBJ_DIR = $(RELEASE_SIMULATOR_OUTPUT_DIR)
330 endif
331
332
333 DEV_CFLAGS += $(OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG)
334 SIM_CFLAGS += $(SIM_OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG)
335
336 # Linker settings (must come after setting DEBUG_FLAG)
337
338 DEV_LDFLAGS += $(DEBUG_FLAG) -nologo -Wl,-nolocals
339 SIM_LDFLAGS += $(DEBUG_FLAG) -mno-cygwin -mwindows $(SIM_OBJ_DIR)/gcc_link.def -shared -nostdlib -u___divdi3 -u___moddi3 -u___udivdi3 -u___umoddi3
340 SIM_LIBS = -L "$(TOOLS_DIR)misclibs" -lpxstlport -lpxsupc++ -lpxgcc -lgcc
341 ifeq ($(DEBUG_OR_RELEASE), Debug)
342 DEV_LDFLAGS += -Wl,-debug -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Debug/Default"
343 SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Debug/PalmOS.lib"
344 else
345 DEV_LDFLAGS += -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Release/Default"
346 SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Release/PalmOS.lib"
347 endif
348
349 LDOBJS = PalmOS.a SystemGlue.a FloatMgr.sa
350
351 ifeq ($(TARGET_PLATFORM), Device)
352 NATIVE_OBJ_DIR := $(OBJ_DIR)
353 RSC_OBJ_DIR := $(OBJ_DIR)
354 else
355 NATIVE_OBJ_DIR := $(SIM_OBJ_DIR)
356 RSC_OBJ_DIR := $(SIM_OBJ_DIR)
357 endif
358
359 # Librarian settings
360 AR="$(TOOLS_DIR)palib"
361 SIM_AR=ar
362
363 ARFLAGS= -c -a
364 SIM_ARFLAGS=-rc
365
366 LINKER_OUTPUT := $(OBJ_DIR)/$(DATABASE_NAME).axf
367 SIM_LINKER_OUTPUT := $(SIM_OBJ_DIR)/$(DATABASE_NAME).dll
368
369 TARGET := $(OBJ_DIR)/$(PRC_NAME)
370 SIM_TARGET := $(SIM_OBJ_DIR)/$(PRC_NAME)
371
372 STATIC_LIB_TARGET := $(OBJ_DIR)/$(LIB_NAME)
373 SIM_STATIC_LIB_TARGET := $(SIM_OBJ_DIR)/$(SIM_LIB_NAME)
374
375 ###############################################################################
376 # Resource flags (PalmRC)
377
378 RFLAGS +=
379
380 # Default text encoding is Latin
381 ifeq ($(PRC_TEXT_ENCODING), )
382 PRC_TEXT_ENCODING = LATIN
383 endif
384
385 ifeq ($(PRC_TEXT_ENCODING), LATIN)
386 RFLAGS += -target 4.0
387 else
388 ifeq ($(PRC_TEXT_ENCODING), JAPANESE)
389 RFLAGS += -target 4.0J
390 else
391 ifeq ($(PRC_TEXT_ENCODING), SIMPLIFIED_CHINESE)
392 RFLAGS += -target 4.0CS
393 endif
394 endif
395 endif
396
397 ifeq ($(PRC_NO_LOCALE_CHECK), TRUE)
398 RFLAGS += -noLocaleCheck
399 endif
400
401 ifeq ($(PRC_STRICT_LOCALE), TRUE)
402 RFLAGS += -strictLocale
403 endif
404
405 ifeq ($(PRC_STRICT_ENCODING), TRUE)
406 RFLAGS += -strictTextEncoding
407 endif
408
409 ifdef PRC_OVERLAY_FILTER
410 RFLAGS += -overlayFilter $(PRC_OVERLAY_FILTER)
411 endif
412
413 ifeq ($(PRC_NO_WARN_SIZE), TRUE)
414 RFLAGS += -noWarnSize
415 endif
416
417 ifeq ($(PRC_QUIET), TRUE)
418 RFLAGS += -quiet
419 endif
420
421 ifeq ($(PRCMERGE_QUIET), TRUE)
422 PRCFLAGS += -quiet
423 endif
424
425 ###############################################################################
426
427 # function for converting sources to object file names in one of output directories
428 define SOURCE_LIST_TO_OBJS
429 $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \
430 $(basename $(notdir $(file))))))
431 endef
432
433 # function for converting sources to object file names in $(SIM_OBJ_DIR)
434 define SOURCE_LIST_TO_SIM_OBJS
435 $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \
436 $(basename $(notdir $(file))))))
437 endef
438
439 # function for converting resources into resource object files
440 define RESOURCE_LIST_TO_OBJS
441 $(addprefix $(RSC_OBJ_DIR)/, $(addsuffix .trc, $(foreach file, $(RESOURCES), \
442 $(basename $(file)))))
443 endef
444 DEV_OBJS = $(SOURCE_LIST_TO_OBJS)
445 SIM_OBJS = $(SOURCE_LIST_TO_SIM_OBJS)
446 SOURCE_PATHS += $(sort $(foreach file, $(SOURCES), $(dir $(file))))
447 RESOURCE_OBJS = $(RESOURCE_LIST_TO_OBJS)
448 RESOURCE_PATHS += $(sort $(foreach file, $(RESOURCES), $(dir $(file))))
449 SLD_BASENAME := $(addsuffix _Startup, $(basename $(notdir $(SLD_FILE))))
450 SLD_OBJ := $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME)))
451 SLD_SIM_OBJ := $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME)))
452
453 VPATH :=
454 VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SOURCE_PATHS) $(RESOURCE_PATHS) )))
455
456 # -I "$(SDK_LOCATION)include" -I "$(SDK_LOCATION)include/Core/System" #
457 SYSTEM_INCLUDES = $(SYSTEM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix"
458 INCLUDES = $(LOCAL_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SYSTEM_INCLUDES) $(PRE_INCLUDE_PATHS)
459 DEV_CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport"
460
461 SIM_SYSTEM_INCLUDES = $(SYSTEM_SIM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix"
462 SIM_INCLUDES = $(LOCAL_SIM_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SIM_SYSTEM_INCLUDES) $(SIM_PRE_INCLUDE_PATHS)
463 SIM_CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport"
464
465 # Now add additional settings specified by user
466 DEV_LDFLAGS += $(ADDITIONAL_LINK_LIBRARIES)
467 DEV_LDFLAGS += $(foreach libpath, $(ADDITIONAL_LINK_LIBPATH), $(addprefix -libpath , $(libpath)))
468 DEV_LDFLAGS += $(foreach option, $(ADDITIONAL_LINKER_FLAGS), $(addprefix -Wl$(comma), $(option)))
469 DEV_CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define)))
470 DEV_CFLAGS += $(foreach define, $(UNDEFINES), $(addprefix -U, $(define)))
471 DEV_CFLAGS += $(ADDITIONAL_COMPILER_FLAGS)
472 DEV_CFLAGS += $(INCLUDES)
473
474 SIM_LDFLAGS += $(ADDITIONAL_SIM_LINK_LIBRARIES)
475 SIM_LDFLAGS += $(ADDITIONAL_SIM_LINKER_FLAGS)
476 SIM_LDFLAGS += $(foreach libpath, $(ADDITIONAL_SIM_LINK_LIBPATH), $(addprefix -L, $(libpath)))
477 SIM_CFLAGS += $(foreach define, $(SIM_DEFINES), $(addprefix -D, $(define)))
478 SIM_CFLAGS += $(foreach define, $(SIM_UNDEFINES), $(addprefix -U, $(define)))
479 SIM_CFLAGS += $(ADDITIONAL_SIM_COMPILER_FLAGS)
480 SIM_CFLAGS += $(SIM_INCLUDES)
481
482 # Specifyc additional archival flags (for static libraries)
483 ARFLAGS += $(ADDITIONAL_AR_FLAGS)
484 SIM_ARFLAGS += $(ADDITIONAL_SIM_AR_FLAGS)
485
486 RFLAGS += $(ADDITIONAL_PRC_FLAGS)
487 PRCFLAGS += $(ADDITIONAL_PRCMERGE_FLAGS)
488
489 DEV_CXXFLAGS = $(DEV_CPP_INCLUDES) $(DEV_CFLAGS)
490 SIM_CXXFLAGS = $(SIM_CPP_INCLUDES) $(SIM_CFLAGS)
491
492 ifeq ($(TARGET_PLATFORM), Device)
493 OBJS=$(DEV_OBJS)
494 CFLAGS=$(DEV_CFLAGS)
495 CXXFLAGS=$(DEV_CXXFLAGS)
496 LDFLAGS=$(DEV_LDFLAGS)
497 else
498 OBJS=$(SIM_OBJS)
499 CFLAGS=$(SIM_CFLAGS)
500 CXXFLAGS=$(SIM_CXXFLAGS)
501 LDFLAGS=$(SIM_LDFLAGS)
502 endif
503
504 ###############################################################################
505 # Flags for PRC creation
506
507 PRCFLAGS += -dbFlagExtendedDB -dbFlagExecutable
508
509 PRCFLAGS += -dbVersion $(DATABASE_VERSION) $(DATABASE_PROTECT) $(DATABASE_HIDDEN) $(DATABASE_BACKUP) $(DATABASE_RESET) $(DATABASE_BUNDLE)
510
511
512 ###############################################################################
513 # Flags for pslib
514
515 PSLIB_DEV_FLAGS =
516 PSLIB_SIM_FLAGS = -outSimgcc
517 ifeq ($(PROJECT_TYPE), slib)
518 PSLIB_DEV_FLAGS += -outEntryNums $(OBJ_DIR)/$(DATABASE_NAME)_Client.h -outObjStubs $(OBJ_DIR)/$(DATABASE_NAME)_Client.sa
519 PSLIB_SIM_FLAGS += -outEntryNums $(SIM_OBJ_DIR)/$(DATABASE_NAME)_Client.h -outSimStubs $(SIM_OBJ_DIR)/$(DATABASE_NAME)_Client.slib
520 endif
521
522 ###############################################################################
523 # Project make target determination
524
525 ifeq ($(TARGET_PLATFORM), Device)
526
527 ifeq ($(PROJECT_TYPE), )
528 PROJECT_TARGET = device
529 endif
530
531 ifeq ($(PROJECT_TYPE), appl)
532 PROJECT_TARGET = device
533 endif
534 ifeq ($(PROJECT_TYPE), slib)
535 PROJECT_TARGET = device_shared_lib
536 endif
537 ifeq ($(PROJECT_TYPE), lib)
538 PROJECT_TARGET = device_static_lib
539 endif
540
541 else
542
543 ifeq ($(PROJECT_TYPE), )
544 PROJECT_TARGET = simulator
545 endif
546
547 ifeq ($(PROJECT_TYPE), appl)
548 PROJECT_TARGET = simulator
549 endif
550 ifeq ($(PROJECT_TYPE), slib)
551 PROJECT_TARGET = simulator_shared_lib
552 endif
553 ifeq ($(PROJECT_TYPE), lib)
554 PROJECT_TARGET = simulator_static_lib
555 endif
556
557 endif
558
559 ###############################################################################
560 # Eclipse requires an all target to get the work done
561
562 all: $(FN_DEPEND).1 $(PROJECT_TARGET)
563
564 # This rule is only valid for projects created as application projects.
565 # Don't invoke this make target directly; instead change the value of
566 # TARGET_PLATFORM to Device in the main makefile
567 device: $(OBJ_DIR) $(TARGET)
568
569 # This rule is only valid for projects created as application projects.
570 # Don't invoke this make target directly; instead change the value of
571 # TARGET_PLATFORM to Simulator in the main makefile
572 simulator: $(SIM_OBJ_DIR) $(SIM_TARGET)
573
574 # This rule is only valid for projects created as shared library projects.
575 # Don't invoke this make target directly; instead change the value of
576 # TARGET_PLATFORM to Device in the main makefile
577 device_shared_lib: $(OBJ_DIR) $(TARGET)
578
579 # This rule is only valid for projects created as shared library projects.
580 # Don't invoke this make target directly; instead change the value of
581 # TARGET_PLATFORM to Simulator in the main makefile
582 simulator_shared_lib: $(SIM_OBJ_DIR) $(SIM_TARGET)
583
584 # This rule is only valid for projects created as static library projects.
585 # Don't invoke this make target directly; instead change the value of
586 # TARGET_PLATFORM to Device in the main makefile
587 device_static_lib: $(OBJ_DIR) $(STATIC_LIB_TARGET)
588
589 # This rule is only valid for projects created as static library projects.
590 # Don't invoke this make target directly; instead change the value of
591 # TARGET_PLATFORM to Simulator in the main makefile
592 simulator_static_lib: $(SIM_OBJ_DIR) $(SIM_STATIC_LIB_TARGET)
593
594
595 # rule to create the object file directories if needed
596 $(OBJ_DIR):
597 @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
598
599 $(SIM_OBJ_DIR):
600 @[ -d $(SIM_OBJ_DIR) ] || mkdir $(SIM_OBJ_DIR) > /dev/null 2>&1
601
602 # Simulator C/C++ sources
603 $(SIM_OBJ_DIR)/%.o : %.c #makefile
604 $(SIM_CC) -c $< -std=c99 $(SIM_CFLAGS) -o $@
605 $(SIM_OBJ_DIR)/%.o : %.cpp #makefile
606 $(SIM_CC) -c $< -frtti $(SIM_CXXFLAGS) -o $@
607 $(SIM_OBJ_DIR)/%.o : %.cp #makefile
608 $(SIM_CC) -c $< -frtti $(SIM_CXXFLAGS) -o $@
609 $(SIM_OBJ_DIR)/%.o : %.cc #makefile
610 $(SIM_CC) -c $< -frtti $(SIM_CXXFLAGS) -o $@
611 $(SIM_OBJ_DIR)/%.o : %.C #makefile
612 $(SIM_CC) -c $< -std=c99 $(SIM_CFLAGS) -o $@
613 $(SIM_OBJ_DIR)/%.o : %.CC #makefile
614 $(SIM_CC) -c $< -frtti $(SIM_CXXFLAGS) -o $@
615 $(SIM_OBJ_DIR)/%.o : %.CPP #makefile
616 $(SIM_CC) -c $< -frtti $(SIM_CXXFLAGS) -o $@
617
618
619 # XRD source processing
620 $(RSC_OBJ_DIR)/%.trc : %.xrd makefile
621 $(PALMRC) -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`$(CYGPATH_WA) ./$<`" -o $@
622 $(RSC_OBJ_DIR)/%.trc : %.XRD makefile
623 $(PALMRC) -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`$(CYGPATH_WA) ./$<`" -o $@
624
625
626 # Definition file source processing
627 $(SLD_OBJ) : makefile
628 @echo "...Processing definition file for Device..."
629 $(PSLIB) -inDef "$(SLD_FILE)" $(PSLIB_DEV_FLAGS) -outObjStartup $@ -type '$(DB_TYPE)' -creator '$(CREATOR_ID)' -execName $(DATABASE_NAME)
630 # $(INSTALL_DIR) $(INCDIR_WXPALM)/wx/
631 # $(INSTALL_DATA) $(TOPDIR)/include/wx/palmos/setup0.h $(INCDIR_WXPALM)/wx/setup.h
632
633
634 $(SLD_SIM_OBJ) : makefile
635 @echo "...Processing definition file for Simulator..."
636 $(PSLIB) -inDef "$(SLD_FILE)" $(PSLIB_SIM_FLAGS) -outSimStartup $@ -outSimRsrc $(SIM_OBJ_DIR)/acod0000.bin -outSimDefs $(SIM_OBJ_DIR)/gcc_link.def -type '$(DB_TYPE)' -creator '$(CREATOR_ID)' -execName $(DATABASE_NAME)
637 # $(INSTALL_DIR) $(INCDIR_WXPALM)/wx/
638 # $(INSTALL_DATA) $(TOPDIR)/include/wx/palmos/setup0.h $(INCDIR_WXPALM)/wx/setup.h
639
640
641 # Linking step
642 $(LINKER_OUTPUT) : $(OBJS)
643 @echo "...Linking for Device Target..."
644 $(LD) -o $(LINKER_OUTPUT) $(OBJS) $(SLD_OBJ) $(LDOBJS) $(LDFLAGS)
645
646 $(SIM_LINKER_OUTPUT) : $(SIM_OBJS)
647 @echo "...Linking for Simulator Target..."
648 $(SIM_LD) --entry 0 -o $(SIM_LINKER_OUTPUT) $(SIM_OBJS) $(SLD_SIM_OBJ) $(SIM_LDFLAGS) $(SIM_LIBS)
649
650
651 # Final target creation
652 $(TARGET): $(SLD_OBJ) $(LINKER_OUTPUT) $(RESOURCE_OBJS)
653 @echo "...Creating PRC for Device: $(TARGET)"
654 $(PELF2BIN) -format 6 -directory $(OBJ_DIR) -code acod -data adat -rsrc 0x0000 $(LINKER_OUTPUT)
655 $(PRCMERGE) -dbType '$(DB_TYPE)' -dbCreator '$(CREATOR_ID)' -dbName $(DATABASE_NAME) $(PRCFLAGS) -o $(TARGET) $(RESOURCE_OBJS) $(OBJ_DIR)/adat0000.bin $(OBJ_DIR)/acod0000.bin
656 @echo ...Done with Device build...
657 @echo
658
659 $(SIM_TARGET): $(SLD_SIM_OBJ) $(SIM_LINKER_OUTPUT) $(RESOURCE_OBJS)
660 @echo "...Creating PRC for Simulator: $(SIM_TARGET)"
661 cp -f "$(SDK_LOCATION)misctools/Resources/amdd_fake" $(SIM_OBJ_DIR)/adat0000.bin
662 $(PRCMERGE) -dbType '$(DB_TYPE)' -dbCreator '$(CREATOR_ID)' -dbName $(DATABASE_NAME) $(PRCFLAGS) -o $(SIM_TARGET) $(RESOURCE_OBJS) $(SIM_OBJ_DIR)/adat0000.bin $(SIM_OBJ_DIR)/acod0000.bin
663 @echo ...Done with Simulator build...
664 @echo
665
666 $(STATIC_LIB_TARGET) : $(OBJS)
667 @echo "...Linking Static Library for Device Target..."
668 $(AR) $(ARFLAGS) $(STATIC_LIB_TARGET) $(OBJS)
669
670 $(SIM_STATIC_LIB_TARGET) : $(SIM_OBJS)
671 @echo "...Linking Static Library for Simulator Target..."
672 $(SIM_AR) $(SIM_ARFLAGS) $(SIM_STATIC_LIB_TARGET) $(SIM_OBJS)
673
674
675 FORCE:
676
677 # Eclipse requires a clean command
678 clean :: FORCE
679 -rm -rf $(NATIVE_OBJ_DIR)/*
680 -rm -f $(OBJS)
681
682 printvars :: FORCE
683 @echo "SDK_LOCATION"
684 @echo $(SDK_LOCATION)
685 @echo "CFLAGS"
686 @echo $(CFLAGS)
687 @echo "SIM_CFLAGS"
688 @echo $(SIM_CFLAGS)
689 @echo "LDFLAGS"
690 @echo $(LDFLAGS)
691 @echo "SIM_LDFLAGS"
692 @echo $(SIM_LDFLAGS)
693 @echo "OBJS"
694 @echo $(OBJS)
695 @echo "SIM_OBJS"
696 @echo $(SIM_OBJS)
697 @echo "SLD_OBJ"
698 @echo $(SLD_OBJ)
699 @echo "SLD_SIM_OBJ"
700 @echo $(SLD_SIM_OBJ)
701 @echo "TARGET"
702 @echo $(TARGET)
703 @echo "SIM_TARGET"
704 @echo $(SIM_TARGET)
705 @echo "SOURCE_PATHS"
706 @echo $(SOURCE_PATHS)
707 @echo "RESOURCE_OBJS"
708 @echo $(RESOURCE_OBJS)
709 @echo "RESOURCE_PATHS"
710 @echo $(RESOURCE_PATHS)
711 @echo "OBJ_DIR"
712 @echo $(OBJ_DIR)
713 @echo "SIM_OBJ_DIR"
714 @echo $(SIM_OBJ_DIR)
715 @echo "RSC_OBJ_DIR"
716 @echo $(RSC_OBJ_DIR)
717 @echo "LINKER_OUTPUT"
718 @echo $(LINKER_OUTPUT)
719 @echo "SIM_LINKER_OUTPUT"
720 @echo $(SIM_LINKER_OUTPUT)
721 @echo "SIM_GCC_SLIBS"
722 @echo $(SIM_GCC_SLIBS)
723 @echo "SIM_GCC_SLIB_PATHS"
724 @echo $(SIM_GCC_SLIB_PATHS)
725 @echo "VPATH"
726 @echo $(VPATH)
727
728
729 #
730 # dependency generation
731 # Generate dependencies with depend target "make depend"
732 #
733
734 DEPFLAG = -MM
735
736 #
737 # Adds $(SIM_OBJ_DIR) to target .o file
738 # ...Search for string starting at the beginning of the line [^]
739 # ...that contain anything followed by .o [.*\.o]
740 # ...and remember that string [\(...\)]
741 # ...replace that string with $(SIM_OBJ_DIR)/<tagged string> [$$(SIM_OBJ_DIR)/\1]
742 # ($ is doubled so that make doesn't interpret the variable syntax)
743 #
744 SOURCE_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(OBJ_DIR)/\1%'
745 SOURCE_SIM_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(SIM_OBJ_DIR)/\1%'
746
747 # Command adds $(RSC_OBJ_DIR) and converts .xrd to .trc
748 RESOURCE_TARGET_SEDSCRIPT = sed -e';s%^\(.*\).xrd%$$(RSC_OBJ_DIR)/\1.trc%'
749
750 # Command to escape spaces in a path
751 ESCAPE_SPACES_SEDSCRIPT = sed 's/ /\\\ /g'
752
753 # Take out all newlines (and/or returns) and replace with spaces
754 # ...putting all dependencies on the same line
755 RESOURCE_PREREQ_SEDSCRIPT = tr '\r\n' ' '
756
757 depend :: FORCE
758 @echo "" > $(FN_DEPEND)
759 # @echo "$(SIM_CC) $(SIM_CXXFLAGS) $(DEPFLAG) $(SOURCES) to $(FN_DEPEND).tmp"
760 @$(SIM_CC) $(SIM_CXXFLAGS) $(DEPFLAG) $(SOURCES) > $(FN_DEPEND).tmp
761 @cat $(FN_DEPEND).tmp | $(SOURCE_SEDSCRIPT) >> $(FN_DEPEND)
762 @cat $(FN_DEPEND).tmp | $(SOURCE_SIM_SEDSCRIPT) >> $(FN_DEPEND)
763 -rm -f $(FN_DEPEND).tmp
764 @for i in $(RESOURCES); do \
765 echo "$$i: \\" | $(RESOURCE_TARGET_SEDSCRIPT) >> .resdependencies; \
766 $(PALMRC) -p $(TARGET_FORMAT) $(RFLAGS) -locale $(LOCALE) -makedeps $$i.tmp "`$(CYGPATH_WA) ./$$i`"; \
767 $(CYGPATH_MF) $$i.tmp | $(ESCAPE_SPACES_SEDSCRIPT) >> $$i.deps; \
768 rm -rf $$i.tmp; \
769 cat $$i.deps | $(RESOURCE_PREREQ_SEDSCRIPT) >> .resdependencies; \
770 echo "" >> .resdependencies; \
771 rm -rf $$i.deps; \
772 cat .resdependencies >> $(FN_DEPEND); \
773 rm -rf .resdependencies; \
774 done
775 @for i in $(SOURCES); do \
776 echo "`basename $$i`.o: $$i" | $(SOURCE_SEDSCRIPT) | sed "s/\.cpp\.o/.o/" | sed "s/\.c\.o/.o/" >> $(FN_DEPEND); \
777 echo " \$$(CC) -c \$$< \$$(CXXFLAGS) -o \$$@" >> $(FN_DEPEND); \
778 echo "`basename $$i`.o: $$i" | $(SOURCE_SIM_SEDSCRIPT) | sed "s/\.cpp\.o/.o/" | sed "s/\.c\.o/.o/" >> $(FN_DEPEND); \
779 echo " \$$(SIM_CC) -c \$$< \$$(CXXFLAGS) -o \$$@" >> $(FN_DEPEND); \
780 done
781
782 $(FN_DEPEND).1: $(FN_DEPEND)
783 @touch $(FN_DEPEND).1
784 @$(MAKE) all
785
786 $(FN_DEPEND): #makefile #$(SOURCES)
787 @rm -f $(FN_DEPEND).2
788 @$(MAKE) depend
789 @cp $(FN_DEPEND) $(FN_DEPEND).2
790
791 cleandepend :: FORCE
792 @rm -f $(FN_DEPEND) $(FN_DEPEND).1 $(FN_DEPEND).2 $(FN_DEPEND).tmp
793 @rm -f $(INCDIR_WXPALM)/wx/setup.h
794
795 distclean: cleandepend clean
796
797 -include $(FN_DEPEND).2