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