aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: da924f71a7f8f3099a502f87822bdf1901e10abc (plain)
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
#
# Makefile for the ABC80 emulator
#

top_srcdir      = @top_srcdir@
srcdir          = @srcdir@
VPATH           = @srcdir@
prefix          = @prefix@
exec_prefix     = @exec_prefix@
bindir          = @bindir@
mandir          = @mandir@
datarootdir     = @datarootdir@

CC		= @CC@
CPPFLAGS	= @CPPFLAGS@ @DEFS@ -I.
CFLAGS		= $(CPPFLAGS) @CFLAGS@
LDFLAGS		= $(CFLAGS) @LDFLAGS@
LIBS		= @LIBS@

MKDIR		= mkdir
PERL		= perl
RM_F		= rm -f

# For Windows/MinGW use obj and .exe
O		= @OBJEXT@
X		= @EXEEXT@

.SUFFIXES:
.SUFFIXES: .c .h .$(O) .bin $(X) .i .s .asm

.SECONDARY:
.DELETE_ON_ERROR:

GENC = $(patsubst %.rom,%.c,$(wildcard roms/*.rom))
SRCS = abc80.c clock.c sdlscrn.c fgcolor.c screenshot.c \
	z80.c z80irq.c abcmem.c abcio.c debug.c \
	abcfont.c disk.c rtc.c simprint.c print.c fileop.c z80dis.c \
	nstime.c hostfile.c console.c cas.c abcfile.c filelist.c \
	trace.c sysload.c \
	clib/asprintf.c $(GENC)
HDRS = clock.h screen.h z80.h z80irq.h patchlevel.h screenshot.h abcio.h \
       abcprintd.h rom.h nstime.h hostfile.h trace.h \
       compiler.h console.h clib/inttypes.h config/config.h

OBJS = $(patsubst %.c,%.$(O),$(SRCS))

TARGETS = @TARGETS@

all: $(TARGETS)

install: all
	$(MKDIR) -p $(INSTALLROOT)$(bindir)
	$(INSTALL_PROGRAM) $(TARGETS) $(INSTALLROOT)$(bindir)
	$(MKDIR) -p $(INSTALLROOT)$(mandir)/man1
	$(INSTALL_DATA) abc80.man $(INSTALLROOT)$(mandir)/man1/abc80.1

abc80$(X): $(OBJS)
	$(CC) $(LDFLAGS) -o abc80$(X) $(OBJS) $(LIBS)

abc80win$(X): winwrap.c
	$(CC) $(LDFLAGS) -mwindows -municode -D_UNICODE -o abc80win$(X) $^

%.c: %.rom bin2c.pl
	$(PERL) bin2c.pl $< > $@ || ( rm -f $@ ; false )

%.$(O): %.c $(HDRS)
	$(CC) $(CFLAGS) -c -o $@ $<

%.i: %.c $(HDRS)
	$(CC) $(CFLAGS) -E -o $@ $<

%.s: %.c $(HDRS)
	$(CC) $(CFLAGS) -S -o $@ $<

# Note: it is OK for the cpp invocation to fail, which is a good thing
# because it uses nonstandard constructs.
baudtospeed.c: termios.c baudtospeed.sh
	( $(CC) $(CFLAGS) -Wp,-dM -E termios.c || true ) \
		| sh baudtospeed.sh > "$@"

.PHONY: roms
roms:
	$(MAKE) -C roms

.PHONY: asmsrc
asmsrc:
	$(MAKE) -C asmsrc

clean:
	$(RM_F) $(TARGETS) *.$(O) *~ core *.lst *.i *.s
	$(RM_F) roms/*.$(O) roms/*.c

spotless: clean
	$(RM_F)  *~ .\#* \#* *.bak
	$(RM_F) configure config.status config.log Makefile config/config.h
	$(RM_F) autoconf/aclocal.m4 autom4te.cache