3 SRC
:= bioskrnl
.180 boot
.180 stampf
.180 chario
.180 drvtbl
.180
4 SRC
+= move
.180 time
.180 mm
.180 misc
.180 utils
.180 fifo
.180
5 SRC
+= msgbuf
.180 conbuf
.180 ascii
.180
6 SRC
+= sdio
.180 cfio
.180
8 ALLSRC
:= $(SRC
) ldrbios
.180
10 INC
:= config.inc z180reg.inc z180.lib ioctl.inc
13 OBJ
:= $(SRC
:.180=.rel
)
14 ALLOBJ
:= $(ALLSRC
:.180=.rel
)
15 ALLLST
:= $(ALLSRC
:.180=.lst
)
18 $(foreach X
,$(subst =,:=,$(subst ",,$(filter VCS_%,\
19 $(shell autorevision -t sh -o $(CURDIR)/autorevision.cache)))),$(eval $X))
21 VERS := $(shell echo "$(VCS_TAG
)" | sed -e 's/hexrel-/0./g' -e 's/^v//g')
24 VERS := $(VERS).$(VCS_TICK)
26 ifneq ($(VCS_BRANCH),master)
27 VERS := $(VERS)-$(VCS_BRANCH)
29 ifeq ($(VCS_WC_MODIFIED),1)
34 SYSFILE = cpm3_$(VERS).sys
35 MAPFILE = bnkbios3_$(VERS).map
36 DIST_NAME = z180-stamp-cpm3_$(VERS).zip
37 DIST_NAME_BIN = z180-stamp-cpm3-bin_$(VERS).zip
38 PREFIX = z180-stamp-cpm3_$(VERS)
49 #Location of CP/M binaries
50 CPMBIN = /usr/local/lib/cpm/bin80
52 #AS = $(CPMEMU) $(CPMBIN)/m80.com
53 AS = $(CPMEMU) slr180.com
54 #LN = $(CPMEMU) slrnk+.com
55 #LN = $(CPMEMU) ccpline.com
74 .phony: sys bios map ldr
80 cpmldr.com: cpmldr.rel ldrbios.rel
86 version.inc: autorevision.cache
88 @printf "defvers macro
\r\n\
95 space:= $(empty) $(empty)
97 ccpline = $(CPMEMU) $(1) -$(subst $(space),$(comma),$(strip $(2)))
100 COMMAND="$(AS
) -$(basename $<)/$(AS_OPT
)"; \
101 OUTPUT=$$(mktemp); echo $${COMMAND}; \
102 $${COMMAND} > $${OUTPUT}; \
103 grep -q '^ 0 Error(s) Detected' $${OUTPUT}; ERROR=$$? ; \
104 if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm -f $@; fi ; \
109 COMMAND="$(call ccpline
, slrnk
+, $(basename $@
)/H
/M
/V \
110 /P
:$(LN_PROG
) /D
:$(LN_DATA
) $(basename $^
) /E
/Q
)";\
111 OUTPUT=$$(mktemp); echo $${COMMAND};\
112 $${COMMAND} > $${OUTPUT} || exit 1;\
115 grep -q ' Duplicate Symbol ' $${OUTPUT} && ERROR=2; \
116 grep -q '\- Previously Defined' $${OUTPUT} && ERROR=2; \
117 [ "$${ERROR}" = "0" ] && grep -q '^ ** ' $${OUTPUT} && ERROR=1 ; \
118 [ "$${ERROR}" != "0" ] && rm -f $@; \
122 #link80 bnkbios3[b,q]=bioskrnl,boot,chario,drvtbl,...
123 define cpm-bioslink =
124 COMMAND="$(call ccpline
, link80
, \
125 $(basename $@
)=$(basename $^
))[b
,q
]";\
126 OUTPUT=$$(mktemp); echo $${COMMAND};\
127 $${COMMAND} > $${OUTPUT} || exit 1;\
129 grep -Ev '^[@?$$._ 0-9A-Z]{7} [0-9A-F]{4}' $${OUTPUT};\
130 grep -Eq ':|UNRECOGNIZED' $${OUTPUT} && ERROR=2; \
131 [ "$${ERROR}" != "0" ] && rm -f $@; \
137 #Use: MAKESYM Filename[.ext][/PXXXX][/DXXXX][/CXXXX]
138 #egrep '^[[:xdigit:]]{4}[[:space:]]+[[:xdigit:]]{4}[[:space:]]+D.*init\.rel' hdrom.map
140 COMMAND="$(CPMEMU
) makesym
-$^
-/P
-D
"; \
141 OUTPUT=$$(mktemp); echo $${COMMAND}; \
142 $${COMMAND} > $${OUTPUT}; \
143 grep -q '^ 0 Error(s) Detected' $${OUTPUT}; ERROR=$$? ; \
144 if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm -f $@; fi ; \
148 PSEG = $(call SEGMENT-ADDR, 1)
149 DSEG = $(call SEGMENT-ADDR, 2)
151 #(call SEGMENT-ADDR,SEGNUM)
152 SEGMENT-ADDR = $(shell dd if=$(SYSFILE) bs=128 count=1 skip=1 2>/dev/null |\
153 awk -vn=$(strip $1) '/BNKBIOS3/ {if (++seg == n) print $$3}')
155 $(MAPFILE): $(SYSFILE)
156 ld80 -o /dev/null -ms $@ -P $(PSEG) -D $(DSEG) $(OBJ)
159 $(SYSFILE): bnkbios3.spr gencpm.dat
165 bnkbios3.spr : $(OBJ)
167 @#ld80 -o $@ -ms $(@:.hex=.map) -P $(LN_PROG) -D $(LN_DATA) $^
174 bin-dist: $(SYSFILE) $(MAPFILE) cpmldr.com
175 $(ZIP) -9 $(DIST_NAME_BIN) $(SYSFILE) $(MAPFILE) cpmldr.com
178 dist: $(SYSFILE) $(MAPFILE) cpmldr.com
179 $(GIT) archive --format=zip --prefix=$(PREFIX)/ -9 -o $(DIST_NAME) HEAD^{tree}
181 @$(CP) autorevision.cache version.inc $(PREFIX)
182 $(ZIP) -r -9 $(DIST_NAME) $(PREFIX) $(SYSFILE) $(MAPFILE) cpmldr.com
186 .phony: clean realclean
188 $(RM) $(ALLOBJ) $(ALLLST) *.sym
194 #==================================================================
197 @COMMAND="$(AS
) =$<"; \
198 OUTPUT=$$(mktemp); echo $${COMMAND}; \
199 $${COMMAND} > $${OUTPUT}; \
200 grep -q 'No Fatal error(s).$$' $${OUTPUT}; ERROR=$$? ; \
201 if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm $@; fi ; \
207 @COMMAND="$(AS
) ,$@
=$<"; \
208 OUTPUT=$$(mktemp); echo $${COMMAND}; \
209 $${COMMAND} > $${OUTPUT}; \
210 grep -q 'No Fatal error(s).$$' $${OUTPUT}; ERROR=$$? ; \
211 if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; fi ; \