Minimal changes to get m6502 to compile (won't work)
[Apout.git] / Makefile
1 # Makefile for Apout PDP-11 application emulator
2 #
3 # $Revision: 1.31 $
4 # $Date: 2008/05/19 13:42:39 $
5 #
6 # You will need gcc if you choose the optimised compile below
7 CC?=gcc
8
9 # Set this to either PDP11 or Z180 or M6502
10 CPU=M6502
11
12 # Set the CFLAGS, LDFLAGS for speed or debugging. If you don't want 2.11BSD
13 # emulation, then remove the -DEMU211 flag.
14 # Set up the LIBS if required for your system
15 #
16 # These flags for doing debugging
17 #APOUT_OPTIONS?= -DEMU211 -DEMUV1 -DNATIVES -DRUN_V1_RAW \
18         -DDEBUG -DZERO_MEMORY -DWRITEBASE
19 # These flags should be fine for most cases
20 APOUT_OPTIONS?= -DNATIVES -DDEBUG
21 ifeq ($(CPU),PDP11)
22 APOUT_OPTIONS+= -DEMU211 -DEMUV1
23 endif
24
25 # These flags for speed
26 #CFLAGS+= -DEMU211 -DNATIVES -DINLINE=inline -O2 -Winline -Wall \
27 #       -finline-functions -fomit-frame-pointer
28 #LDFLAGS?=
29
30 # Assemble CFLAGS
31 CFLAGS?= -O2 -I. -DINLINE=inline -DCPU_$(CPU) -finline-functions \
32 -fomit-frame-pointer
33 CFLAGS+=-Winline -Wunused-result # silence warnings
34 CFLAGS+= $(APOUT_OPTIONS)
35
36 # Any extra libraries required
37 LIBS= -lm
38
39 # Install destinations
40 PREFIX?=/usr/local
41 MANDIR=$(PREFIX)/man/man1
42 BINDIR=$(PREFIX)/bin
43
44 VERSION= apout2.3beta1
45 SRCS=   aout.c aout.h main.c \
46         v7trap.c bsdtrap.c defines.h v7trap.h \
47         bsdtrap.h bsd_ioctl.c bsd_signal.c magic.c v1trap.c v1trap.h
48 PDP11_SRCS= pdp11/cpu.c pdp11/branch.c pdp11/double.c pdp11/ea.c pdp11/itab.c \
49         pdp11/ke11a.c pdp11/single.c pdp11/fp.c pdp11/debug.c
50 Z180_SRCS= z180/cpu.c z180/cpu.h z180/debugger.h z180/emu.h z180/logmacro.h \
51         z180/z180.c z180/z180cb.inc z180/z180dasm.c z180/z180dasm.h \
52         z180/z180dd.inc z180/z180ed.inc z180/z180fd.inc z180/z180.h \
53         z180/z180op.inc z180/z180ops.inc z180/z180tbl.inc z180/z180xy.inc
54 M6502_SRCS= m6502/cpu.c m6502/cpu.h m6502/emu.h \
55         m6502/m6502.c m6502/m6502d.c m6502/m6502d.h m6502/m6502d.inc \
56         m6502/m6502.h m6502/m6502.inc m6502/m65c02.c m6502/m65c02d.c \
57         m6502/m65c02d.h m6502/m65c02d.inc m6502/m65c02.h m6502/m65c02.inc
58 OBJS=   aout.o bsd_ioctl.o bsd_signal.o bsdtrap.o \
59         magic.o main.o \
60         v7trap.o
61 ifeq ($(CPU),PDP11)
62 OBJS+=  v1trap.o pdp11/branch.o pdp11/cpu.o pdp11/debug.o \
63         pdp11/double.o pdp11/ea.o pdp11/fp.o pdp11/itab.o pdp11/ke11a.o \
64         pdp11/single.o
65 else ifeq ($(CPU),Z180)
66 OBJS+=  z180/cpu.o z180/z180.o z180/z180dasm.o
67 else ifeq ($(CPU),M6502)
68 OBJS+=  m6502/cpu.o m6502/m6502.o m6502/m6502d.o
69 endif
70
71 apout: $(OBJS)
72         $(CC) $(LDFLAGS) $(OBJS) -o apout $(LIBS)
73
74 install: apout apout.1
75         cp apout $(BINDIR)
76         chmod 755 $(BINDIR)/apout
77         cp apout.1 $(MANDIR)
78         chmod 644 $(MANDIR)/apout.1
79
80 clean:
81         rm -rf apout *core $(OBJS) *.dbg $(VERSION) $(VERSION).tar.gz apout.0
82
83 apout.0: apout.1
84         nroff -man apout.1 > apout.0
85
86 indent: $(SRCS) $(PDP11_SRCS)
87         astyle --style=kr $(SRCS) $(PDP11_SRCS)
88
89 disttar: clean apout.0
90         - mkdir $(VERSION)
91         cp $(SRCS) $(VERSION)
92         cp $(PDP11_SRCS) $(VERSION)/pdp11
93         cp $(Z180_SRCS) $(VERSION)/z180
94         chmod -R go+rX $(VERSION)
95         chmod -R u+w $(VERSION)
96         chown -R wkt $(VERSION)
97         tar vzcf $(VERSION).tar.gz $(VERSION)
98
99 # Dependencies for object files
100 aout.o: aout.c defines.h pdp11/cpu.h z180/cpu.h aout.h Makefile
101 pdp11/branch.o: pdp11/branch.c defines.h pdp11/cpu.h Makefile
102 bsd_ioctl.o: bsd_ioctl.c defines.h pdp11/cpu.h z180/cpu.h Makefile
103 bsd_signal.o: bsd_signal.c defines.h pdp11/cpu.h z180/cpu.h bsdtrap.h Makefile
104 bsdtrap.o: bsdtrap.c bsdtrap.h defines.h pdp11/cpu.h z180/cpu.h Makefile
105 pdp11/cpu.o: pdp11/cpu.c defines.h pdp11/cpu.h Makefile
106 pdp11/debug.o: pdp11/debug.c defines.h pdp11/cpu.h Makefile
107 pdp11/double.o: pdp11/double.c defines.h pdp11/cpu.h Makefile
108 pdp11/ea.o: pdp11/ea.c defines.h pdp11/cpu.h Makefile
109 pdp11/fp.o: pdp11/fp.c defines.h pdp11/cpu.h Makefile
110 pdp11/itab.o: pdp11/itab.c defines.h pdp11/cpu.h Makefile
111 pdp11/ke11a.o: pdp11/ke11a.c defines.h pdp11/cpu.h Makefile
112 magic.o: magic.c defines.h pdp11/cpu.h z180/cpu.h Makefile
113 main.o: main.c defines.h pdp11/cpu.h z180/cpu.h Makefile
114 pdp11/single.o: pdp11/single.c defines.h pdp11/cpu.h Makefile
115 v1trap.o: v1trap.c v1trap.h defines.h pdp11/cpu.h z180/cpu.h Makefile
116 v7trap.o: v7trap.c v7trap.h defines.h pdp11/cpu.h z180/cpu.h Makefile
117 z180/cpu.o: z180/cpu.c defines.h z180/cpu.h z180/z180.h z180/z180dasm.h \
118         Makefile
119 z180/z180.o: z180/z180.c z180/z180ops.inc z180/z180tbl.inc z180/z180cb.inc \
120         z180/z180xy.inc z180/z180dd.inc z180/z180fd.inc z180/z180ed.inc \
121         z180/z180op.inc z180/z180.h z180/debugger.h z180/emu.h \
122         z180/logmacro.h Makefile
123 z180/z180dasm.o: z180/z180dasm.c z180/z180dasm.h z180/debugger.h z180/emu.h \
124         z180/logmacro.h Makefile
125 m6502/cpu.o: m6502/cpu.c defines.h m6502/emu.h m6502/m6502.h
126 m6502/m6502.o: m6502/m6502.c m6502/emu.h m6502/debugger.h m6502/m6502.h \
127         m6502/m6502d.h m6502/m6502.inc
128 m6502/m6502d.o: m6502/m6502d.c m6502/emu.h m6502/m6502d.h m6502/m6502d.inc