-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (47 loc) · 1.1 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
TAR = x86
BIN = test03.bin
BINSRC = test03.c
OBJS = test/test.cpp main.cpp Emulator.cpp ModRM.o interrupt.cpp pc.o hinstruction16.cpp ghyper.cpp
OBJS += GUI.cpp eflags.cpp
OBJS += kazuminlib/kazuminlib.a
OBJS += device/Device.a
#OBJS += GL/lib/libglut.a
CFLAGS = -std=c++11 -g
LDFLAGS = -lglut -lGLU -lGL
LDFLAGS += -pthread
RUNFLAGS= $(BIN)
NASK = ~/tolset/z_tools/nask
CC = gcc
CXX = g++
%.o:%.cpp
$(CXX) -DPRINT -o $@ -c $< $(CFLAGS)
%.bin:%.nask
$(NASK) $< $@ $*.lst
default:
make $(BIN)
make -C kazuminlib
make -C device
make $(TAR)
run:$(TAR) $(BIN)
make
./$(TAR) $(RUNFLAGS)
clean:
make -C kazuminlib clean
make -C device clean
rm *.o
rm x86
full:
make clean
make
$(TAR):$(OBJS)
$(CXX) -o $@ $^ $(LDFLAGS) -lgtest
device/Device.a:
make -C device
$(BIN):$(BINSRC)
gcc -m32 -nostdlib -fno-asynchronous-unwind-tables -I~/tolset_p86/z_tools/i386-elf-gcc/include\
-g -fno-stack-protector -c $(BINSRC)
ld --entry=start --oformat=binary -Ttext 0x7c00 -o $@ $(BINSRC:.c=.o)
crt0.o:crt0.asm
nasm -f elf crt0.asm
test:$(OBJS)
$(CXX) -g -DDEBUG $(OBJS) $(LDFLAGS) -lgtest -lpthread -o t