-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (46 loc) · 1.15 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
AS=$(CROSS)as
AR=$(CROSS)ar
LD=$(CROSS)ld
SRCDIR:=src
OBJDIR:=obj
BINDIR:=bin
LIBDIR:=lib
INCDIR:=inc
ASFLAGS+=-g --warn --fatal-warnings -I$(INCDIR)
LDFLAGS+=--fatal-warnings
BASE_OBJS=cpu dispatch gpu mmu stat terminal time timer
OBJS=$(BASE_OBJS)
ifdef NULL_GRAPHICS
OBJS+=display_null screen_null
else
OBJS+=fbdev framebuffer
endif
ifdef NULL_INPUT
OBJS+=input_null
else
OBJS+=evdev
endif
ifdef EMBED_BIOS
ASFLAGS+=--defsym EMBED_BIOS=1
endif
TEST_HARNESS:=$(BINDIR)/test_harness
TEST_TARGETS:=
all: $(LIBDIR)/emu.a $(BINDIR)/start
$(OBJDIR)/%.o: $(SRCDIR)/%.S | $(OBJDIR)
$(AS) $(ASFLAGS) -o$@ $^
$(LIBDIR)/emu.a: $(foreach V,$(OBJS),$(OBJDIR)/$(V).o) | $(LIBDIR)
$(AR) rcs $@ $^
$(BINDIR)/start: $(OBJDIR)/start.o $(LIBDIR)/emu.a | $(BINDIR)
$(LD) $(LDFLAGS) -o$@ $^
$(BINDIR)/test_harness: $(OBJDIR)/test_harness.o $(foreach V,$(BASE_OBJS),$(OBJDIR)/$(V).o) $(OBJDIR)/input_null.o $(OBJDIR)/bitmap.o $(OBJDIR)/framebuffer.o $(OBJDIR)/crc32.o | $(BINDIR)
$(LD) $(LDFLAGS) -o$@ $^
$(OBJDIR):
mkdir $(OBJDIR)
$(LIBDIR):
mkdir $(LIBDIR)
$(BINDIR):
mkdir $(BINDIR)
include test_targets.mak
test: $(TEST_TARGETS)
clean:
rm -rf $(OBJDIR) $(LIBDIR) $(BINDIR)