-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (45 loc) · 1011 Bytes
/
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
TAR = x86
BIN = test03.bin
BINSRC = test03.c
OBJS = main.o Emulator.o Instruction16.o Instruction32.o ModRM.o interrupt.o pc.o
OBJS += GUI.o eflags.o
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) -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)
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