-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
64 lines (48 loc) · 1.7 KB
/
Makefile
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
.POSIX:
CC = clang
#CFLAGS = -Os -Wall
CFLAGS = -g -DDEBUG=1 -O0 -Wall
CPPFLAGS += -MMD -IMusashi -IMINIXCompat -DMUSASHI_CNF='"MINIXCompat_Musashi.h"'
LIBS ::= -lm
CC_FOR_BUILD ?= $(CC)
CFLAGS_FOR_BUILD ?= $(CFLAGS)
CPPFLAGS_FOR_BUILD ?= $(CPPFLAGS)
LDFLAGS_FOR_BUILD ?= $(LDFLAGS)
PREFIX ?= /usr/local
EXEC_PREFIX ?= $(PREFIX)
BINDIR ?= $(EXEC_PREFIX)/bin
DATAROOTDIR ?= $(PREFIX)/share
MANDIR ?= $(DATAROOTDIR)/man
.SUFFIXES:
.SUFFIXES: .c .o
MINIXCOMPAT_SRC != find MINIXCompat -name '*.c'
MINIXCOMPAT_OBJ ::= $(MINIXCOMPAT_SRC:.c=.o)
MINIXCOMPAT_BIN ::= MINIXCompat/MINIXCompat
MUSASHI_SRC ::= Musashi/m68kcpu.c Musashi/m68kdasm.c Musashi/softfloat/softfloat.c
MUSASHI_OBJ ::= $(MUSASHI_SRC:.c=.o)
all: $(MINIXCOMPAT_BIN)
.PHONY: all
$(MINIXCOMPAT_BIN): $(MINIXCOMPAT_OBJ) $(MUSASHI_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
MINIXCompat/MINIXCompat_EmulationOps.o: Musashi/m68kops.c
Musashi/m68kcpu.o: Musashi/m68kops.h
MUSASHI_GEN_SRC ::= Musashi/m68kops.h Musashi/m68kops.c
$(MUSASHI_GEN_SRC): Musashi/m68k_in.c Musashi/m68kmake
Musashi/m68kmake Musashi $<
Musashi/m68kmake: Musashi/m68kmake.c
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
clean:
rm -f $(MINIXCOMPAT_BIN) Musashi/m68kmake $(MUSASHI_GEN_SRC) $(MUSASHI_OBJ) $(MINIXCOMPAT_OBJ)
rm -f $(MINIXCOMPAT_SRC:.c=.d) $(MUSASHI_SRC:.c=.d) Musashi/m68kmake.d
distclean: clean
.PHONY: clean distclean
install: all
mkdir -p $(DESTDIR)$(BINDIR)
install $(MINIXCOMPAT_BIN) $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(MANDIR)/man1
cp MINIXCompat/MINIXCompat.1 $(DESTDIR)$(MANDIR)/man1
.PHONY: install
-include $(MINIXCOMPAT_SRC:.c=.d)
-include $(MUSASHI_SRC:.c=.d)