1# Uncomment the one corresponding with your system
2
3#SYSTEM=DOS
4SYSTEM=UNIX
5
6Z80_PORTS="./.Z80_ports"
7
8DEFINES=-DFURTHER_HARDWARE -DPORT_BUFFER
9#DEFINES=-DFURTHER_HARDWARE -DPORT_BUFFER -DNO_EXTERN_PORTFILE_WRITE
10#DEFINES=-DFURTHER_HARDWARE -DZ80_CTC -DLOGIC_ANALYZER -DSSL_ZDS
11#DEFINES=-DFURTHER_HARDWARE -DOLD_STYLE -DNEEDED
12
13# set the appropriate install directories in your system
14
15MAN_DIR=/usr/local/man
16BIN_DIR=/usr/local/bin
17
18#--------- You shouldn't need to change anything under this line ---------------
19
20ZZ=Z80_PORTS="\"$(Z80_PORTS)\""
21ZZZ=Z80_PORTS="\\\"$(Z80_PORTS)\\\""
22HW=hardware/hard.a
23ifeq (UNIX, $(SYSTEM))
24 RM=rm -f
25 ASM=z80-asm
26 MONI=z80-mon
27else
28 RM=del
29 ASM=z80-asm.exe
30 MONI=z80-mon.exe
31endif
32
33CC?=	gcc
34CFLAGS+= -Wall -D$(ZZ) -D$(SYSTEM) $(DEFINES) -W -Wstrict-prototypes \
35       -Wno-parentheses -fomit-frame-pointer -falign-functions=0
36LDFLAGS=
37
38all:
39	cd hardware; $(MAKE) SYSTEM=$(SYSTEM) DEFINES="-D$(ZZZ) -D$(SYSTEM) $(DEFINES)" hard.a
40	$(MAKE) $(ASM)
41	$(MAKE) $(MONI)
42	cd hardware; $(MAKE) SYSTEM=$(SYSTEM) DEFINES="-D$(ZZZ) -D$(SYSTEM) $(DEFINES)"
43
44clean:
45	$(RM) *.o
46	$(RM) $(ASM)
47	$(RM) $(MONI)
48	$(RM) asm.a
49	$(RM) cpu.a
50	$(RM) .bus_proto
51	cd hardware; $(MAKE) SYSTEM=$(SYSTEM) clean
52
53install:
54	chmod a+rx $(ASM) $(MONI); cp -p $(ASM) $(MONI) $(BIN_DIR)
55	chmod a+r doc/man/z80-*.1; cp -p doc/man/z80-*.1 $(MAN_DIR)/man1
56	chmod a+r doc/man/z80-*.3; cp -p doc/man/z80-*.3 $(MAN_DIR)/man3
57	chmod a+r doc/man/z80-*.5; cp -p doc/man/z80-*.5 $(MAN_DIR)/man5
58
59z80-mon.o: z80-mon.c z80-cpu.h asm.h console.h console_token regs.h regs_token \
60           execute.h execute_token file.h memory.h interrupt.h help_layout \
61           mini-display.h decode.h keyboard.h ports.h hash.h z80-global \
62           hardware/includes
63
64z80-asm.o: z80-asm.c hash.h asm.h file.h asm_token
65
66z80-cpu.o: z80-global z80-cpu.c hardware/quartz.h z80-mon.h hardware/includes \
67           hardware/system_wired hardware/bus_masters
68
69decode.o: decode.c z80-cpu.h z80-mon.h decode-table.h execute.h execute_token \
70          regs_token memory.h z80-global hardware/daisy_chain.h
71
72instr.o: instr.c instr_token z80-cpu.h z80-global
73
74file.o: file.c file.h
75
76regs.o: regs.c regs_token z80-cpu.h z80-global
77
78compile.o: compile.c asm.h execute_token regs.h regs_token
79
80expression.o: expression.c asm.h asm_token
81
82hash.o: hash.c asm.h expression.h
83
84asm.o: asm.c asm_interface.h instr.h z80-cpu.h hash.h compile.h execute_token \
85       expression.h regs.h regs_token asm_token z80-global
86
87console.o: console.c console_token
88
89decode-table.o: decode-table.c z80-cpu.h execute.h execute_token regs.h \
90                regs_token z80-global
91
92execute.o: execute.c z80-cpu.h execute_token regs.h regs_token decode.h asm.h \
93           memory.h ports.h hash.h z80-global
94
95ports.o: ports.c z80-cpu.h mini-display.h asm_interface.h keyboard.h memory.h \
96         hardware/port_buffer.h z80-global
97
98memory.o: memory.c z80-cpu.h z80-mon.h z80-global
99
100interrupt.o: interrupt.c z80-cpu.h decode.h z80-mon.h z80-global \
101             hardware/daisy_chain.h
102
103dummy.o: dummy.c
104
105mini-display.o: mini-display.c console.h console_token
106
107keyboard.o: keyboard.c console.h
108
109asm.a: z80-cpu.o asm.o hash.o compile.o regs.o instr.o interrupt.o file.o \
110       expression.o mini-display.o keyboard.o
111	$(RM) asm.a
112	ar rcs asm.a z80-cpu.o asm.o hash.o compile.o regs.o instr.o interrupt.o \
113                 expression.o mini-display.o keyboard.o file.o
114
115cpu.a: execute.o decode-table.o decode.o memory.o ports.o
116	$(RM) cpu.a
117	ar rcs cpu.a execute.o decode-table.o decode.o memory.o ports.o
118
119
120$(ASM): z80-asm.o dummy.o asm.a $(HW)
121	$(CC) -lc -o $(ASM) z80-asm.o dummy.o asm.a $(HW)
122$(MONI): z80-mon.o cpu.a console.o asm.a $(HW)
123	$(CC) -lc -o $(MONI) z80-mon.o cpu.a console.o asm.a $(HW)
124