-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
75 lines (52 loc) · 1.46 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
67
68
69
70
71
72
73
74
75
CLASS = 4301
BASE_DIR = /usr/local/$(CLASS)
LINK_DIRS = -L$(BASE_DIR)/lib/
INCLUDE_DIRS = -I$(BASE_DIR)/include/ -I.
LFLAGS = -lm
CFLAGS = -g -Wall -std=c++11
# Assembler is NASM
ASM = nasm
# Format of object file is linux
LINUX_FORMAT = elf32
# Flags used in assemblying phase
ASMFLAGS =
# Linker is ld
LINKER = ld
# Share libbrary option for linker
SHLIB = --dynamic-linker
.SECONDEXPANSION:
CC = g++
.SUFFIXES:.o .C .CPP .cpp .c++ .cc .cxx .cp .asm
.C.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.CPP.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.cpp.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.c++.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.cc.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.cxx.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.cp.o:
$(CC) $(CFLAGS) -c $< $(INCLUDE_DIRS)
.asm.o:
$(ASM) -f $(LINUX_FORMAT) $(ASMFLAGS) -o $*.o $< $(INCLUDE_DIRS)
targets1srcfile =
$(targets1srcfile): [email protected]
$(CC) -o $@ [email protected] $(LINK_DIRS) $(LFLAGS)
targets2srcfiles = stage2
$(targets2srcfiles): [email protected] [email protected]
$(CC) -o $@ [email protected] [email protected] $(LINK_DIRS) $(LFLAGS)
targets2srcfileswithlibrary =
$(targets2srcfileswithlibrary): [email protected] [email protected]
$(CC) -o $@ [email protected] [email protected] $(LINK_DIRS) \
-Wl,-whole-archive -l$@ -Wl,-no-whole-archive $(LFLAGS)
targetsAsmLanguage =
$(targetsAsmLanguage): [email protected]
$(LINKER) -m elf_i386 $(SHLIB) /lib/ld-linux.so.2 -o $@ [email protected] \
$(BASE_DIR)/src/Along32.o -lc
clean:
rm -f *.o core *~ $(targets1srcfile) $(targets2srcfiles)
rm -f $(targets2srcfileswithlibrary)