]> git.saurik.com Git - wxWidgets.git/blame - build/palmos/makefile-engine.mk
No changes, just use wxGtkObject<> instead of g_object_unref().
[wxWidgets.git] / build / palmos / makefile-engine.mk
CommitLineData
ffecfa5a
JS
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
fdc24460 68FN_DEPEND=.dependencies
ffecfa5a
JS
69
70comma:= ,
71
72ifeq ($(TOOLS_DIR), )
73 TOOLS_DIR =
74endif
75
76# Locale (defaults to English)
77ifeq ($(LOCALE), )
78 LOCALE := enUS
79endif
80
81ifeq ($(CREATOR_ID), )
82 CREATOR_ID = STRT
83endif
84
85ifeq ($(DB_TYPE), )
86 DB_TYPE = appl
87endif
88
89ifeq ($(SLD_FILE), )
90 SLD_FILE = none
91endif
92
93ifeq ($(DEBUG_DEVICE_OUTPUT_DIR), )
94 DEBUG_DEVICE_OUTPUT_DIR = DebugDevice
95endif
96
97ifeq ($(RELEASE_DEVICE_OUTPUT_DIR), )
98 RELEASE_DEVICE_OUTPUT_DIR = ReleaseDevice
99endif
100
101ifeq ($(DEBUG_SIMULATOR_OUTPUT_DIR), )
102 DEBUG_SIMULATOR_OUTPUT_DIR = DebugSim
103endif
104
105ifeq ($(RELEASE_SIMULATOR_OUTPUT_DIR), )
106 RELEASE_SIMULATOR_OUTPUT_DIR = ReleaseSim
107endif
108
109ifeq ($(SDK_VERSION), )
110 SDK_VERSION = sdk-6
111endif
112
113ifeq ($(ENABLE_EXCEPTIONS), )
114 ENABLE_EXCEPTIONS=TRUE
115endif
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
125ifeq ($(DATABASE_NAME), )
126ifeq ($(ESCAPED_ARTIFACT_NAME), )
127 # Database name defaults if ARTIFACT_NAME is empty
128 DATABASE_NAME = StartApp
129else
130 DATABASE_NAME = $(ESCAPED_ARTIFACT_NAME)
131endif
132endif
133
134ifeq ($(PRC_NAME), )
135ifeq ($(ESCAPED_ARTIFACT_NAME), )
136 # PRC name defaults if ESCAPED_ARTIFACT_NAME is empty
137 PRC_NAME = Start.prc
138else
139 PRC_NAME = $(DATABASE_NAME).prc
140endif
141endif
142
143ifeq ($(LIB_NAME), )
144ifeq ($(ESCAPED_ARTIFACT_NAME), )
145 # LIB name defaults if ESCAPED_ARTIFACT_NAME is empty
146 LIB_NAME = Start.a
147else
148 LIB_NAME = $(DATABASE_NAME).a
149endif
150endif
151
152ifeq ($(SIM_LIB_NAME), )
153ifeq ($(ESCAPED_ARTIFACT_NAME), )
154 # SIM LIB name defaults if ESCAPED_ARTIFACT_NAME is empty
155 SIM_LIB_NAME = Start.lib
156else
157 SIM_LIB_NAME = $(DATABASE_NAME).lib
158endif
159endif
160
161###############################################################################
162# Compile and Link Settings
163
e2fc40b4 164ifeq ($(TARGET_FORMAT), )
ffecfa5a 165TARGET_FORMAT=PalmOS6
e2fc40b4 166endif
ffecfa5a
JS
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
fdc24460
VZ
173UNAME :=$(shell uname)
174ifeq ($(UNAME),Linux)
175# Linux Settings
5377e4e7 176PELF2BIN:=wine "$(TOOLS_DIR)/pelf2bin.exe"
fdc24460
VZ
177PSLIB:=wine "$(TOOLS_DIR)/pslib.exe"
178PRCMERGE :=wine "$(TOOLS_DIR)/PRCMerge.exe"
179PALMRC :=wine "$(TOOLS_DIR)/PalmRc.exe"
180CYGPATH_WA:=echo
181CYGPATH_MF:=echo
182CC = wine "$(TOOLS_DIR)pacc"
183CXX = wine "$(TOOLS_DIR)pacc"
184LD = wine "$(TOOLS_DIR)pacc"
185else
186# Cygwin Settings
187PELF2BIN:="$(TOOLS_DIR)/pelf2bin"
188PSLIB:="$(TOOLS_DIR)/pslib.exe"
189PRCMERGE :="$(TOOLS_DIR)/PRCMerge.exe"
190PALMRC :="$(TOOLS_DIR)/PalmRc.exe"
191CYGPATH_WA:=cygpath -w -a
192CYGPATH_MF:=cygpath -m -f
ffecfa5a 193CC = "$(TOOLS_DIR)pacc"
fdc24460
VZ
194CXX = "$(TOOLS_DIR)pacc"
195LD = "$(TOOLS_DIR)pacc"
196endif
197
ffecfa5a 198SIM_CC = gcc
fdc24460 199SIM_LD = gcc
ffecfa5a 200
fdc24460
VZ
201DEV_CFLAGS += -D__PALMOS_KERNEL__=1 -D__PALMOS__=0x06000000
202SIM_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
ffecfa5a
JS
203
204# Warning level for device target
205ifeq ($(WARNING_LEVEL), ALL)
fdc24460 206 DEV_CFLAGS += -W4
ffecfa5a
JS
207else
208ifeq ($(WARNING_LEVEL), SOME)
fdc24460 209 DEV_CFLAGS += -W2
ffecfa5a
JS
210else
211ifeq ($(WARNING_LEVEL), NONE)
fdc24460 212 DEV_CFLAGS += -W0
ffecfa5a
JS
213endif
214endif
215endif
216
217# Warning level for simulator target
218ifeq ($(SIM_WARNING_LEVEL), ALL)
219 SIM_CFLAGS += -Wall
220else
221ifeq ($(SIM_WARNING_LEVEL), NONE)
222 SIM_CFLAGS += -w
223endif
224endif
225
226# Warnings as errors for device builds
227ifeq ($(WARNING_AS_ERROR), TRUE)
fdc24460 228 DEV_CFLAGS += -Werror
ffecfa5a
JS
229endif
230
231# Warnings as errors for simulator builds
232ifeq ($(SIM_WARNING_AS_ERROR), TRUE)
233 SIM_CFLAGS += -Werror
234endif
235
236# Adding after other warnings flags so this is always in effect
237SIM_CFLAGS += -Wno-multichar
238
239# Verbose output for device build
240ifeq ($(VERBOSE), TRUE)
fdc24460 241 DEV_CFLAGS += -v
ffecfa5a
JS
242endif
243
244# Verbose output for simulator build
245ifeq ($(SIM_VERBOSE), TRUE)
246 SIM_CFLAGS += -v
247endif
248
249# Dislay logo
250ifeq ($(ARM_LOGO), TRUE)
fdc24460 251 DEV_CFLAGS += -logo
ffecfa5a 252else
fdc24460 253 DEV_CFLAGS += -nologo
ffecfa5a
JS
254endif
255
256# Exception handling support
257ifeq ($(ENABLE_EXCEPTIONS), TRUE)
fdc24460
VZ
258 DEV_CFLAGS += -ex
259 DEV_LDFLAGS += -ex
ffecfa5a
JS
260endif
261
262# Assertion handling support
263ifeq ($(ENABLE_ASSERTIONS), TRUE)
fdc24460 264 DEV_CFLAGS += -UNDEBUG
ffecfa5a 265else
fdc24460 266 DEV_CFLAGS += -DNDEBUG=1
ffecfa5a
JS
267endif
268
269# Additional linker flags
270ifdef ADDITIONAL_PALINK_FLAGS
fdc24460 271 DEV_LDFLAGS += $(ADDITIONAL_PALINK_FLAGS)
ffecfa5a
JS
272endif
273
274# Optimization settings
275ifeq ($(OPTIMIZE_LEVEL), INLINING)
276 OPTIMIZER_FLAG = -O5
277 SIM_OPTIMIZER_FLAG = -O3
278else
279ifeq ($(OPTIMIZE_LEVEL), INTERPROCEDURAL)
280 OPTIMIZER_FLAG = -O4
281 SIM_OPTIMIZER_FLAG = -O3
282else
283ifeq ($(OPTIMIZE_LEVEL), FULL)
284 OPTIMIZER_FLAG = -O3
285 SIM_OPTIMIZER_FLAG = -O3
286else
287ifeq ($(OPTIMIZE_LEVEL), INTRAPROCEDURAL)
288 OPTIMIZER_FLAG = -O2
289 SIM_OPTIMIZER_FLAG = -O3
290else
291ifeq ($(OPTIMIZE_LEVEL), SOME)
292 OPTIMIZER_FLAG = -O1
293 SIM_OPTIMIZER_FLAG = -O1
294else
295ifeq ($(OPTIMIZE_LEVEL), NONE)
296 OPTIMIZER_FLAG = -O0
297 SIM_OPTIMIZER_FLAG = -O0
298else
299# Default to 0 for debug, 3 for release
300ifeq ($(DEBUG_OR_RELEASE), Debug)
301 OPTIMIZER_FLAG = -O0
302 SIM_OPTIMIZER_FLAG = -O0
303else
304 OPTIMIZER_FLAG = -O3
305 SIM_OPTIMIZER_FLAG = -O3
306endif
307endif
308endif
309endif
310endif
311endif
312endif
313
314# Debug settings (can override optimize settings)
315ifeq ($(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
319else
320 BUILD_TYPE_FLAG = -DBUILD_TYPE=BUILD_TYPE_RELEASE
321 TRACE_OUTPUT_FLAG = -DTRACE_OUTPUT=TRACE_OUTPUT_OFF
322endif
323
324ifeq ($(DEBUG_OR_RELEASE), Debug)
325 OBJ_DIR = $(DEBUG_DEVICE_OUTPUT_DIR)
326 SIM_OBJ_DIR = $(DEBUG_SIMULATOR_OUTPUT_DIR)
327else
328 OBJ_DIR = $(RELEASE_DEVICE_OUTPUT_DIR)
329 SIM_OBJ_DIR = $(RELEASE_SIMULATOR_OUTPUT_DIR)
330endif
331
332
fdc24460 333DEV_CFLAGS += $(OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG)
ffecfa5a
JS
334SIM_CFLAGS += $(SIM_OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG)
335
336# Linker settings (must come after setting DEBUG_FLAG)
ffecfa5a 337
fdc24460 338DEV_LDFLAGS += $(DEBUG_FLAG) -nologo -Wl,-nolocals
ffecfa5a
JS
339SIM_LDFLAGS += $(DEBUG_FLAG) -mno-cygwin -mwindows $(SIM_OBJ_DIR)/gcc_link.def -shared -nostdlib -u___divdi3 -u___moddi3 -u___udivdi3 -u___umoddi3
340SIM_LIBS = -L "$(TOOLS_DIR)misclibs" -lpxstlport -lpxsupc++ -lpxgcc -lgcc
341ifeq ($(DEBUG_OR_RELEASE), Debug)
fdc24460 342 DEV_LDFLAGS += -Wl,-debug -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Debug/Default"
ffecfa5a
JS
343 SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Debug/PalmOS.lib"
344else
fdc24460 345 DEV_LDFLAGS += -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Release/Default"
ffecfa5a
JS
346 SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Release/PalmOS.lib"
347endif
348
349LDOBJS = PalmOS.a SystemGlue.a FloatMgr.sa
350
351ifeq ($(TARGET_PLATFORM), Device)
352 NATIVE_OBJ_DIR := $(OBJ_DIR)
353 RSC_OBJ_DIR := $(OBJ_DIR)
354else
355 NATIVE_OBJ_DIR := $(SIM_OBJ_DIR)
356 RSC_OBJ_DIR := $(SIM_OBJ_DIR)
357endif
358
359# Librarian settings
360AR="$(TOOLS_DIR)palib"
361SIM_AR=ar
362
363ARFLAGS= -c -a
364SIM_ARFLAGS=-rc
365
366LINKER_OUTPUT := $(OBJ_DIR)/$(DATABASE_NAME).axf
367SIM_LINKER_OUTPUT := $(SIM_OBJ_DIR)/$(DATABASE_NAME).dll
368
369TARGET := $(OBJ_DIR)/$(PRC_NAME)
370SIM_TARGET := $(SIM_OBJ_DIR)/$(PRC_NAME)
371
372STATIC_LIB_TARGET := $(OBJ_DIR)/$(LIB_NAME)
373SIM_STATIC_LIB_TARGET := $(SIM_OBJ_DIR)/$(SIM_LIB_NAME)
374
375###############################################################################
376# Resource flags (PalmRC)
377
378RFLAGS +=
379
380# Default text encoding is Latin
381ifeq ($(PRC_TEXT_ENCODING), )
382 PRC_TEXT_ENCODING = LATIN
383endif
384
385ifeq ($(PRC_TEXT_ENCODING), LATIN)
386 RFLAGS += -target 4.0
387else
388ifeq ($(PRC_TEXT_ENCODING), JAPANESE)
389 RFLAGS += -target 4.0J
390else
391ifeq ($(PRC_TEXT_ENCODING), SIMPLIFIED_CHINESE)
392 RFLAGS += -target 4.0CS
393endif
394endif
395endif
396
397ifeq ($(PRC_NO_LOCALE_CHECK), TRUE)
398 RFLAGS += -noLocaleCheck
399endif
400
401ifeq ($(PRC_STRICT_LOCALE), TRUE)
402 RFLAGS += -strictLocale
403endif
404
405ifeq ($(PRC_STRICT_ENCODING), TRUE)
406 RFLAGS += -strictTextEncoding
407endif
408
409ifdef PRC_OVERLAY_FILTER
410 RFLAGS += -overlayFilter $(PRC_OVERLAY_FILTER)
411endif
412
413ifeq ($(PRC_NO_WARN_SIZE), TRUE)
414 RFLAGS += -noWarnSize
415endif
416
417ifeq ($(PRC_QUIET), TRUE)
418 RFLAGS += -quiet
419endif
420
421ifeq ($(PRCMERGE_QUIET), TRUE)
422 PRCFLAGS += -quiet
423endif
424
425###############################################################################
426
427# function for converting sources to object file names in one of output directories
428define SOURCE_LIST_TO_OBJS
429 $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \
430 $(basename $(notdir $(file))))))
431endef
432
433# function for converting sources to object file names in $(SIM_OBJ_DIR)
434define SOURCE_LIST_TO_SIM_OBJS
435 $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \
436 $(basename $(notdir $(file))))))
437endef
438
439# function for converting resources into resource object files
440define RESOURCE_LIST_TO_OBJS
441 $(addprefix $(RSC_OBJ_DIR)/, $(addsuffix .trc, $(foreach file, $(RESOURCES), \
442 $(basename $(file)))))
443endef
fdc24460 444DEV_OBJS = $(SOURCE_LIST_TO_OBJS)
ffecfa5a
JS
445SIM_OBJS = $(SOURCE_LIST_TO_SIM_OBJS)
446SOURCE_PATHS += $(sort $(foreach file, $(SOURCES), $(dir $(file))))
447RESOURCE_OBJS = $(RESOURCE_LIST_TO_OBJS)
448RESOURCE_PATHS += $(sort $(foreach file, $(RESOURCES), $(dir $(file))))
449SLD_BASENAME := $(addsuffix _Startup, $(basename $(notdir $(SLD_FILE))))
450SLD_OBJ := $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME)))
451SLD_SIM_OBJ := $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME)))
452
453VPATH :=
454VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SOURCE_PATHS) $(RESOURCE_PATHS) )))
455
e2fc40b4 456# -I "$(SDK_LOCATION)include" -I "$(SDK_LOCATION)include/Core/System" #
ffecfa5a
JS
457SYSTEM_INCLUDES = $(SYSTEM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix"
458INCLUDES = $(LOCAL_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SYSTEM_INCLUDES) $(PRE_INCLUDE_PATHS)
fdc24460 459DEV_CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport"
ffecfa5a
JS
460
461SIM_SYSTEM_INCLUDES = $(SYSTEM_SIM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix"
462SIM_INCLUDES = $(LOCAL_SIM_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SIM_SYSTEM_INCLUDES) $(SIM_PRE_INCLUDE_PATHS)
463SIM_CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport"
464
465# Now add additional settings specified by user
fdc24460
VZ
466DEV_LDFLAGS += $(ADDITIONAL_LINK_LIBRARIES)
467DEV_LDFLAGS += $(foreach libpath, $(ADDITIONAL_LINK_LIBPATH), $(addprefix -libpath , $(libpath)))
468DEV_LDFLAGS += $(foreach option, $(ADDITIONAL_LINKER_FLAGS), $(addprefix -Wl$(comma), $(option)))
469DEV_CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define)))
470DEV_CFLAGS += $(foreach define, $(UNDEFINES), $(addprefix -U, $(define)))
471DEV_CFLAGS += $(ADDITIONAL_COMPILER_FLAGS)
472DEV_CFLAGS += $(INCLUDES)
ffecfa5a
JS
473
474SIM_LDFLAGS += $(ADDITIONAL_SIM_LINK_LIBRARIES)
475SIM_LDFLAGS += $(ADDITIONAL_SIM_LINKER_FLAGS)
476SIM_LDFLAGS += $(foreach libpath, $(ADDITIONAL_SIM_LINK_LIBPATH), $(addprefix -L, $(libpath)))
477SIM_CFLAGS += $(foreach define, $(SIM_DEFINES), $(addprefix -D, $(define)))
478SIM_CFLAGS += $(foreach define, $(SIM_UNDEFINES), $(addprefix -U, $(define)))
479SIM_CFLAGS += $(ADDITIONAL_SIM_COMPILER_FLAGS)
fdc24460 480SIM_CFLAGS += $(SIM_INCLUDES)
ffecfa5a
JS
481
482# Specifyc additional archival flags (for static libraries)
483ARFLAGS += $(ADDITIONAL_AR_FLAGS)
484SIM_ARFLAGS += $(ADDITIONAL_SIM_AR_FLAGS)
485
486RFLAGS += $(ADDITIONAL_PRC_FLAGS)
487PRCFLAGS += $(ADDITIONAL_PRCMERGE_FLAGS)
488
fdc24460
VZ
489DEV_CXXFLAGS = $(DEV_CPP_INCLUDES) $(DEV_CFLAGS)
490SIM_CXXFLAGS = $(SIM_CPP_INCLUDES) $(SIM_CFLAGS)
491
492ifeq ($(TARGET_PLATFORM), Device)
493OBJS=$(DEV_OBJS)
494CFLAGS=$(DEV_CFLAGS)
495CXXFLAGS=$(DEV_CXXFLAGS)
496LDFLAGS=$(DEV_LDFLAGS)
497else
498OBJS=$(SIM_OBJS)
499CFLAGS=$(SIM_CFLAGS)
500CXXFLAGS=$(SIM_CXXFLAGS)
501LDFLAGS=$(SIM_LDFLAGS)
502endif
503
ffecfa5a
JS
504###############################################################################
505# Flags for PRC creation
506
507PRCFLAGS += -dbFlagExtendedDB -dbFlagExecutable
508
509PRCFLAGS += -dbVersion $(DATABASE_VERSION) $(DATABASE_PROTECT) $(DATABASE_HIDDEN) $(DATABASE_BACKUP) $(DATABASE_RESET) $(DATABASE_BUNDLE)
510
511
512###############################################################################
513# Flags for pslib
514
515PSLIB_DEV_FLAGS =
516PSLIB_SIM_FLAGS = -outSimgcc
517ifeq ($(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
520endif
521
ffecfa5a
JS
522###############################################################################
523# Project make target determination
524
525ifeq ($(TARGET_PLATFORM), Device)
526
527ifeq ($(PROJECT_TYPE), )
528 PROJECT_TARGET = device
529endif
530
531ifeq ($(PROJECT_TYPE), appl)
532 PROJECT_TARGET = device
533endif
534ifeq ($(PROJECT_TYPE), slib)
535 PROJECT_TARGET = device_shared_lib
536endif
537ifeq ($(PROJECT_TYPE), lib)
538 PROJECT_TARGET = device_static_lib
539endif
540
541else
542
543ifeq ($(PROJECT_TYPE), )
544 PROJECT_TARGET = simulator
545endif
546
547ifeq ($(PROJECT_TYPE), appl)
548 PROJECT_TARGET = simulator
549endif
550ifeq ($(PROJECT_TYPE), slib)
551 PROJECT_TARGET = simulator_shared_lib
552endif
553ifeq ($(PROJECT_TYPE), lib)
554 PROJECT_TARGET = simulator_static_lib
555endif
556
557endif
558
559###############################################################################
560# Eclipse requires an all target to get the work done
561
fdc24460 562all: $(FN_DEPEND).1 $(PROJECT_TARGET)
ffecfa5a
JS
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
567device: $(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
572simulator: $(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
577device_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
582simulator_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
587device_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
592simulator_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
ffecfa5a
JS
601
602# Simulator C/C++ sources
fdc24460
VZ
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 $@
ffecfa5a
JS
617
618
619# XRD source processing
620$(RSC_OBJ_DIR)/%.trc : %.xrd makefile
5377e4e7 621 $(PALMRC) -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`$(CYGPATH_WA) ./$<`" -o $@
ffecfa5a 622$(RSC_OBJ_DIR)/%.trc : %.XRD makefile
5377e4e7 623 $(PALMRC) -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`$(CYGPATH_WA) ./$<`" -o $@
ffecfa5a
JS
624
625
626# Definition file source processing
627$(SLD_OBJ) : makefile
628 @echo "...Processing definition file for Device..."
fdc24460
VZ
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
ffecfa5a
JS
634$(SLD_SIM_OBJ) : makefile
635 @echo "...Processing definition file for Simulator..."
fdc24460
VZ
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
ffecfa5a
JS
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)"
fdc24460
VZ
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
ffecfa5a
JS
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
fdc24460 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
ffecfa5a
JS
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
675FORCE:
676
677# Eclipse requires a clean command
678clean :: FORCE
679 -rm -rf $(NATIVE_OBJ_DIR)/*
fdc24460 680 -rm -f $(OBJS)
ffecfa5a
JS
681
682printvars :: 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
734DEPFLAG = -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#
744SOURCE_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(OBJ_DIR)/\1%'
745SOURCE_SIM_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(SIM_OBJ_DIR)/\1%'
746
747# Command adds $(RSC_OBJ_DIR) and converts .xrd to .trc
748RESOURCE_TARGET_SEDSCRIPT = sed -e';s%^\(.*\).xrd%$$(RSC_OBJ_DIR)/\1.trc%'
749
750# Command to escape spaces in a path
751ESCAPE_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
755RESOURCE_PREREQ_SEDSCRIPT = tr '\r\n' ' '
756
757depend :: FORCE
fdc24460
VZ
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
ffecfa5a
JS
764 @for i in $(RESOURCES); do \
765 echo "$$i: \\" | $(RESOURCE_TARGET_SEDSCRIPT) >> .resdependencies; \
fdc24460
VZ
766 $(PALMRC) -p $(TARGET_FORMAT) $(RFLAGS) -locale $(LOCALE) -makedeps $$i.tmp "`$(CYGPATH_WA) ./$$i`"; \
767 $(CYGPATH_MF) $$i.tmp | $(ESCAPE_SPACES_SEDSCRIPT) >> $$i.deps; \
ffecfa5a
JS
768 rm -rf $$i.tmp; \
769 cat $$i.deps | $(RESOURCE_PREREQ_SEDSCRIPT) >> .resdependencies; \
770 echo "" >> .resdependencies; \
771 rm -rf $$i.deps; \
fdc24460 772 cat .resdependencies >> $(FN_DEPEND); \
ffecfa5a
JS
773 rm -rf .resdependencies; \
774 done
fdc24460
VZ
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
ffecfa5a 785
fdc24460
VZ
786$(FN_DEPEND): #makefile #$(SOURCES)
787 @rm -f $(FN_DEPEND).2
788 @$(MAKE) depend
789 @cp $(FN_DEPEND) $(FN_DEPEND).2
ffecfa5a
JS
790
791cleandepend :: FORCE
fdc24460
VZ
792 @rm -f $(FN_DEPEND) $(FN_DEPEND).1 $(FN_DEPEND).2 $(FN_DEPEND).tmp
793 @rm -f $(INCDIR_WXPALM)/wx/setup.h
794
795distclean: cleandepend clean
ffecfa5a 796
fdc24460 797-include $(FN_DEPEND).2