-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
214 lines (160 loc) · 4.58 KB
/
Makefile
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
NAME = D3
BUILD_DIR ?= ./BUILD-$(NAME)
TMP_DIR ?= ./TMP-$(NAME)
SRC_DIRS ?= ./src
DOCS_DIR ?= ./docs
FILES_DIR ?= ./dist
RELEASE_DIR ?= ./RELEASE-$(NAME)
INSTALL_BASE ?= /Volumes/devnext
INSTALL_DIR ?= $(INSTALL_BASE)/$(NAME)
Z88DK_CRT = 30
#DEBUGFLAGS := --list --c-code-in-asm
CC=zcc
CCFLAGS=+zxn -vn -O3 -startup=$(Z88DK_CRT) -clib=new -pragma-include:zpragma.inc
CZFLAGS=-Cz="--clean --fullsize --main-fence 0xC000"
LDFLAGS=-m -lm
INCFLAGS=
SH := /bin/sh
ECHO := @/bin/echo -n
CD := cd
RSYNC := rsync -parv
MKDIR := mkdir -p
RM := rm -rfv
LSH := ls -larth
CP := @cp -rv
MV := @mv -v
#FIGLET := echo
FIGLET := `which figlet`
CAT := @`which cat`
SED := @`which sed`
LS := ls -l@k
VERSION := `cat VERSION`
DATE := `which date`
default: q_less
all: ini every untar ch8show inkey less
clean:
$(RM) $(BUILD_DIR)
$(RM) $(TMP_DIR)
$(RM) $(NAME).map
$(RM) $(NAME)_*.bin
$(RM) cmake-build-debug
$(RM) *.map
$(RM) *_MAIN.bin
$(RM) *_CODE.bin
$(RM) *_UNASSIGNED.bin
$(RM) *_UNASSIGNED.bin
rel-clean: clean
$(RM) $(RELEASE_DIR)
deps: incs
$(ECHO) $(NAME) > NAME
dirs:
$(MKDIR) $(BUILD_DIR)
$(MKDIR) $(TMP_DIR)
$(MKDIR) $(RELEASE_DIR)
incs: dirs
$(ECHO) `git shortlog -s -n| grep Rimron| cut -b-7|sed -e 's/^[[:space:]]*//'` > $(TMP_DIR)/BUILD
$(ECHO) "#" > $(TMP_DIR)/BANNER
$(CAT) $(TMP_DIR)/BUILD >> $(TMP_DIR)/BANNER
$(ECHO) " RUNNING" >> $(TMP_DIR)/BANNER
$(CAT) $(TMP_DIR)/BANNER | $(FIGLET)
cat templates/build_top.h > src/common/build.h
$(ECHO) "// Autogenerated on " >> src/common/build.h
$(DATE) >> src/common/build.h
cat templates/build_build.h >> src/common/build.h
$(CAT) $(TMP_DIR)/BUILD >> src/common/build.h
echo "\"" >> src/common/build.h
cat templates/build_ver.h >> src/common/build.h
$(CAT) VERSION >> src/common/build.h
echo "\"" >> src/common/build.h
cat templates/build_bottom.h >> src/common/build.h
$(CAT) VERSION > $(TMP_DIR)/BANNER
$(ECHO) " done!" >> $(TMP_DIR)/BANNER
$(CAT) $(TMP_DIR)/BANNER | figlet
release: ini every untar ch8show inkey less
$(CP) $(BUILD_DIR)/INI.DOT $(RELEASE_DIR)/INI
$(CP) $(BUILD_DIR)/EVERY.DOT $(RELEASE_DIR)/EVERY
$(CP) $(BUILD_DIR)/UNTAR.DOT $(RELEASE_DIR)/UNTAR
$(CP) $(BUILD_DIR)/CH8SHOW.DOT $(RELEASE_DIR)/CH8SHOW
$(CP) $(BUILD_DIR)/INKEY.DOT $(RELEASE_DIR)/INKEY
$(CP) $(BUILD_DIR)/LESS.DOT $(RELEASE_DIR)/LESS
install: install_every install_ini install_untar install_ch8show install_inkey install_less
uninstall: uninstall_every uninstall_ini uninstall_untar uninstall_ch8show uninstall_inkey uninstall_less
#
# INI
#
ini: deps dirs
$(CC) $(CCFLAGS) $(LDFLAGS) @src/ini.lst -oINI -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) INI $(BUILD_DIR)/INI.DOT
install_ini:
$(CP) $(BUILD_DIR)/INI.DOT $(INSTALL_BASE)/dot/INI
q_ini: ini install_ini
uninstall_ini:
$(RM) $(INSTALL_BASE)/dot/INI
#
# EVERY
#
every: deps dirs
$(CC) $(CCFLAGS) $(LDFLAGS) @src/every.lst -oEVERY -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) EVERY $(BUILD_DIR)/EVERY.DOT
install_every:
$(CP) $(BUILD_DIR)/EVERY.DOT $(INSTALL_BASE)/dot/EVERY
q_every: every install_every
uninstall_every:
$(RM) $(INSTALL_BASE)/dot/EVERY
#
# UNTAR
#
untar: deps dirs
$(CC) $(CCFLAGS) $(LDFLAGS) @src/untar.lst -oUNTAR -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) UNTAR $(BUILD_DIR)/UNTAR.DOT
install_untar:
$(CP) $(BUILD_DIR)/UNTAR.DOT $(INSTALL_BASE)/dot/UNTAR
q_untar: untar install_untar
uninstall_untar:
$(RM) $(INSTALL_BASE)/dot/UNTAR
#
# CH8SHOW
#
ch8show: deps dirs
$(CC) $(CCFLAGS) $(LDFLAGS) @src/ch8show.lst -oCH8SHOW -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) CH8SHOW $(BUILD_DIR)/CH8SHOW.DOT
install_ch8show:
$(CP) $(BUILD_DIR)/CH8SHOW.DOT $(INSTALL_BASE)/dot/CH8SHOW
q_ch8show: ch8show install_ch8show
uninstall_ch8show:
$(RM) $(INSTALL_BASE)/dot/CH8SHOW
#
# INKEY
#
inkey: deps dirs
$(CC) $(CCFLAGS) $(LDFLAGS) @src/inkey.lst -oINKEY -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) INKEY $(BUILD_DIR)/INKEY.DOT
install_inkey:
$(CP) $(BUILD_DIR)/INKEY.DOT $(INSTALL_BASE)/dot/INKEY
q_inkey: inkey install_inkey
uninstall_inkey:
$(RM) $(INSTALL_BASE)/dot/INKEY
#
# LESS
#
less_l3: dirs
$(CC) $(CCFLAGS) $(INCFLAGS) $(BUILDFLAGS) -c \
--codesegBANK_41 --constsegBANK_41 \
--datasegBANK_41 --bsssegBANK_41 \
@src/common/LAYER3.lst -o./LESS_LAYER3.o
less_banks: dirs less_l3
less_assemble: dirs less_banks less_l3
$(CC) $(CCFLAGS) $(LDFLAGS) @src/less.lst -oLESS -create-app \
-subtype=dotn $(CZFLAGS)
$(MV) LESS $(BUILD_DIR)/LESS.DOT
less: deps dirs less_banks less_assemble
install_less:
$(CP) $(BUILD_DIR)/LESS.DOT $(INSTALL_BASE)/dot/LESS
q_less: dirs less_banks less_assemble install_less
uninstall_less:
$(RM) $(INSTALL_BASE)/dot/LESS