-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.palm
144 lines (111 loc) · 3.7 KB
/
Makefile.palm
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
# vi:syntax=make
ifneq ($(CALLER),MASTER)
include Makefile.inc
endif
ifneq ($(DEPTH),MONO)
$(error palm target must be built with MONO DEPTH)
endif
ifneq ($(RESOURCE),DEFAULT)
$(error palm target must be built with DEFAULT RESOURCE)
endif
# 1. Directories
OBJDIR_PALM := $(OBJDIR)/palm
DEPDIR_PALM := $(DEPDIR)/palm
GENDIR_PALM := $(GENDIR)/palm
# 2. Files
BIN_PALM := $(BINDIR)/$(DSEKAI).prc
# Break up translation units so they can be positioned to avoid the dreaded
# "relocation truncated to fit" errors by putting things that call each other
# close.
DSEKAI_C_FILES_PALM_ONLY_1 := \
src/main.c
DSEKAI_C_FILES_PALM_ONLY_2 := \
unilayer/src/input/palmi.c \
unilayer/src/memory/palmm.c \
unilayer/src/resource/palmr.c \
unilayer/src/save/palm.c \
unilayer/src/graphics/palmg.c
DSEKAI_O_FILES_PALM := \
$(addprefix $(OBJDIR_PALM)/,$(subst .c,.o,$(DSEKAI_C_FILES_PALM_ONLY_1))) \
$(addprefix $(OBJDIR_PALM)/,$(subst .c,.o,$(DSEKAI_C_FILES_ENGINES))) \
$(addprefix $(OBJDIR_PALM)/,$(subst .c,.o,$(DSEKAI_C_FILES_SUPPORT_1))) \
$(addprefix $(OBJDIR_PALM)/,$(subst .c,.o,$(DSEKAI_C_FILES_PALM_ONLY_2))) \
$(addprefix $(OBJDIR_PALM)/,$(subst .c,.o,$(DSEKAI_C_FILES_SUPPORT_2)))
RESEXT_H_PALM := $(GENDIR_PALM)/resext.h
MULIPALM_LD := $(GENDIR_PALM)/mulipalm.ld
MULIPALM_DEF := src/mulipalm.def
MULIPALM_O := $(OBJDIR_PALM)/mulipalm.o
# 3. Programs
CC_PALM := m68k-palmos-gcc
LD_PALM := m68k-palmos-gcc
AS_PALM := m68k-palmos-as
PILRC := pilrc
OBJRES := m68k-palmos-obj-res
BUILDPRC := build-prc
MULTIGEN := m68k-palmos-multigen
# 4. Arguments
DEFINES_PALM := \
$(DEFINES_DSEKAI) \
$(DEFINES_DEPTH) \
-DPLATFORM_PALM \
-DNO_ENGINE_POV \
-DNO_TITLE \
-DNO_ANIMATE \
-DNO_DRAW_ENGINE_BEHIND_MENU \
-DUSE_SOFTWARE_TEXT \
-DUSE_SOFTWARE_LINES \
-DNO_SCRIPT_COMPILER
INCLUDES_PALM := \
$(INCLUDES_UNILAYER) \
-I $(GENDIR_PALM) \
-I /opt/palmdev/sdk-3.5/include \
-I /opt/palmdev/sdk-3.5/include/Libraries/ \
-I /opt/palmdev/sdk-3.5/include/Dynamic/ \
-I /opt/palmdev/sdk-3.5/include/Core/ \
-I /opt/palmdev/sdk-3.5/include/Core/UI/ \
-I /opt/palmdev/sdk-3.5/include/Core/System/ \
-I /opt/palmdev/sdk-3.5/include/Core/Hardware/ \
-I /opt/palmdev/sdk-3.5/include/Core/International/
CFLAGS_PALM := -Os $(DEFINES_PALM) $(INCLUDES_PALM)
ifneq ($(BUILD),RELEASE)
CFLAGS_PALM += -g -DLOG_TO_FILE
endif
LDFLAGS_PALM := $(CFLAGS_PALM)
APPID := DSEK
# 5. Targets
platform := palm
platform_upper := PALM
res_gfx := $(DSEKAI_ASSETS_BITMAPS)
$(eval $(RESEXT_H_RULE))
pkg_bin := $(BIN_PALM)
pkg_strip := echo
pkg_name := $(DSEKAI)-$(platform)-$(GIT_HASH)
pkg_reqs :=
$(eval $(PKG_RULE))
$(OBJDIR_PALM)/$(DSEKAI): $(DSEKAI_O_FILES_PALM) $(MULIPALM_O) | $(MULIPALM_LD)
$(LD_PALM) $(LDFLAGS_PALM) -o $@ $^ $(MULIPALM_LD)
$(OBJDIR_PALM)/bin$(STAMPFILE): src/palms.rcp $(GENDIR_PALM)/palmd.rcp | \
$(OBJDIR_PALM)/$(STAMPFILE)
$(PILRC) $(INCLUDES_PALM) $< $(OBJDIR_PALM)
touch $@
$(MULIPALM_O): $(GENDIR_PALM)/mulipalm.s
$(MD) $(dir $@)
$(AS_PALM) -o $@ $<
$(GENDIR_PALM)/mulipalm.s $(MULIPALM_LD): $(MULIPALM_DEF) | \
$(GENDIR_PALM)
$(MULTIGEN) -b $(GENDIR_PALM)/mulipalm $<
ifeq ($(BUILD),RELEASE)
$(BIN_PALM): \
$(OBJDIR_PALM)/bin$(STAMPFILE) $(MULIPALM_DEF) $(OBJDIR_PALM)/$(DSEKAI) | \
$(BINDIR)/$(STAMPFILE)
m68k-palmos-strip $(OBJDIR_PALM)/$(DSEKAI)
$(BUILDPRC) -o $@ $(MULIPALM_DEF) $(OBJDIR_PALM)/$(DSEKAI) $(OBJDIR_PALM)/*.bin
else
$(BIN_PALM): \
$(OBJDIR_PALM)/bin$(STAMPFILE) $(MULIPALM_DEF) $(OBJDIR_PALM)/$(DSEKAI) | \
$(BINDIR)/$(STAMPFILE)
$(BUILDPRC) -o $@ $(MULIPALM_DEF) $(OBJDIR_PALM)/$(DSEKAI) $(OBJDIR_PALM)/*.bin
endif
$(OBJDIR_PALM)/%.o: %.c $(GENDIR_PALM)/palmd.rcp $(RESEXT_H_PALM)
$(MD) $(dir $@)
$(CC_PALM) $(CFLAGS_PALM) -c -o $@ $(<:%.o=%)