forked from shift-crops/x86emu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (54 loc) · 1.19 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
65
66
TARGET := x86emu
SRCS := main.cpp
OBJS := $(SRCS:.cpp=.o)
DEPS := $(SRCS:.cpp=.d)
SUB_OBJS := emulator/emulator.a
SUB_OBJS += instruction/instruction.a
SUB_OBJS += hardware/hardware.a
SUB_OBJS += device/device.a
SUB_OBJS += util/util.a
CXXFLAGS := -Wall -MMD -std=c++11 -I./include $(DEBUG)
LDFLAGS := -lpthread
UNAME = ${shell uname}
ifeq ($(OS),Windows_NT)
LDFLAGS += -lglfw3 -lopengl32
else ifeq ($(UNAME),Linux)
LDFLAGS += -lglfw -lGL
else ifeq ($(UNAME),Darwin)
LDFLAGS += -lglfw -framework OpenGL
endif
$(TARGET): $(OBJS) $(SUB_OBJS)
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
-include $(DEPS)
$(SUB_OBJS): emu
.PHONY: emu
emu:
ifdef DEBUG
make -C hardware DEBUG=$(DEBUG)
make -C emulator DEBUG=$(DEBUG)
make -C instruction DEBUG=$(DEBUG)
make -C device DEBUG=$(DEBUG)
make -C util DEBUG=$(DEBUG)
else
make -C hardware
make -C emulator
make -C instruction
make -C device
make -C util
endif
.PHONY: os
os:
make -C bios
make -C sample
.PHONY: all
all: emu $(TARGET) os
.PHONY: clean
clean:
make clean -C hardware
make clean -C emulator
make clean -C instruction
make clean -C device
make clean -C util
make clean -C bios
make clean -C sample
$(RM) $(DEPS) $(OBJS) $(TARGET)