]> cloudbase.mooo.com Git - kermit-80.git/blob - Makefile
Bugfix in outmdm (output buffer flush)
[kermit-80.git] / Makefile
1
2 # The system-independent files:
3
4 SRC_CPSKER = cpsker.asm cpsdef.asm cpsmit.asm cpscom.asm cpspk1.asm \
5 cpspk2.asm cpsrem.asm cpsser.asm cpstt.asm cpscpm.asm \
6 cpswld.asm cpscmd.asm cpsutl.asm cpsdat.asm cpxlnk.asm
7
8 # The system-dependent files:
9
10 SRC_SYSDEP = cpxtyp.asm cpxlnk.asm cpxcom.asm cpxswt.asm cpxvdu.asm
11
12 # One of:
13
14 SRC_SYSTEM = cpxsys.asm cpxtor.asm cpxnor.asm cpxmrl.asm cpxsb.asm \
15 cpxcif.asm cpxhea.asm cpxapp.asm cpxpcw.asm cpxbbi.asm cpxbee.asm \
16 cpxsyo.asm cpxtm4.asm cpxgni.asm cpxpro.asm cpxz80.asm cpxac.asm
17
18
19 OVLADR = 7000
20
21 # Create assembler listing by default
22 AS_FLAGS = /L
23
24 # CP/M emulator
25 #CPMEMU = aliados
26 CPMEMU = zxcc
27
28 ifeq "$(OS)" "Windows_NT"
29 PLATFORM=win32
30 else
31 PLATFORM=Linux
32 endif
33
34 #Location of M80/L80
35 ifeq ($(PLATFORM),Linux)
36 CPMBIN = /usr/local/lib/cpm/bin80
37 else
38 CPMBIN = C:/cpmbin
39 endif
40
41 AS = $(CPMEMU) $(CPMBIN)/m80.com
42 LINK = $(CPMEMU) $(CPMBIN)/l80.com
43
44 ECHO = /bin/echo -e
45 RM = rm -f
46
47 comma := ,
48 empty :=
49 space := $(empty) $(empty)
50 commasep = $(subst $(space),$(comma),$(strip $(1)))
51 ccpline = $(CPMEMU) $(1) -$(call commasep, $(2))
52
53 do_as = \
54 @COMMAND="$(AS) -=$<$(AS_FLAGS)"; \
55 OUTPUT=$$(mktemp); echo $${COMMAND}; \
56 $${COMMAND} | tee $${OUTPUT}; \
57 grep -q 'No Fatal error(s).$$' $${OUTPUT}; ERROR=$$? ; \
58 if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; $(RM) $@; fi ; \
59 $(RM) $${OUTPUT}; \
60 exit $${ERROR}
61
62
63 .SUFFIXES:
64 .PHONY: all
65
66
67 all: kerm411.com
68
69 kerm411.com: cpsker.hex cpxtyp.hex
70 $(CPMEMU) mload.com -$@=$(call commasep, $^)
71
72 cpsker.hex: LOADADR = 100
73 cpxtyp.hex: LOADADR = $(OVLADR)
74
75
76 cpxtyp.hex: $(SRC_SYSDEP) $(SRC_SYSTEM)
77 cpsker.hex: $(SRC_CPSKER)
78 #cpxtyp.prn: $(SRC_SYSDEP) $(SRC_SYSTEM)
79 #cpsker.prn: $(SRC_CPSKER)
80
81 kerm411.com: | mload.com
82
83 .SECONDARY: mload.com
84 .INTERMEDIATE: mload.rel tmp.asm
85 mload.rel: AS_FLAGS = / # No assembler listing
86 mload.rel: tmp.asm
87 tmp.asm: mload.asm
88 $(ECHO) 'aseg\r' >tmp.asm
89 cat mload.asm >>tmp.asm
90
91
92 %.rel: %.asm
93 $(do_as)
94
95
96 %.hex: %.rel
97 $(LINK) -/P:$(LOADADR),$(call commasep, $< $@)/N/X/E
98
99
100 %.com: %.rel
101 $(LINK) -/P:100,$(call commasep, $< $@)/N/E
102
103
104 .PHONY: clean
105
106 clean:
107 $(RM) *.hex *.prn