-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
64 lines (45 loc) · 1.48 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
# Gaia Configuration
DEBUG = true
TARGET = gaia
SOURCE_PATH = src
SOURCE_LIBS = src/lib
SOURCES = $(SOURCE_PATH)/main.c
LIB_OBJS = $(SOURCE_PATH)/libgaia/libgaia.a $(SOURCE_PATH)/uranus/uranus.a
LIB_OBJS += $(SOURCE_PATH)/asm/gaia_asm.a $(SOURCE_PATH)/GaiaLib/GaiaLib.a
OBJS = $(SOURCES:.c=.o) $(SOURCES_LIBS:.c=.o)
CWARN = -Wall -Wstrict-prototypes -Wdeclaration-after-statement
#CWARN = -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Werror
CINCS = -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/asm/include
CINCS += -I$(SOURCE_PATH)/GaiaLib/include -I$(SOURCE_PATH)/libgaia/include
ifeq ($(DEBUG),true)
CDEBUGS += -g -D__DEBUG__=1
else
CDEBUGS += -Os
endif
CFLAGS = $(CWARN) $(CDEBUGS) $(CINCS) \
-fno-strict-aliasing \
-O2 -m32 -nostdinc -fno-builtin -nostdlib
.PHONY: all clean run run_tests tests
all : $(TARGET).out
clean :
# Libs
$(MAKE) $@ -C $(SOURCE_PATH)/asm
$(MAKE) $@ -C $(SOURCE_PATH)/GaiaLib
$(MAKE) $@ -C $(SOURCE_PATH)/libgaia
$(MAKE) $@ -C $(SOURCE_PATH)/uranus
# Kernel bin file
$(RM) $(TARGET).out $(OBJS)
run :
qemu --kernel $(TARGET).out
run_tests : tests
$(MAKE) $@ -C $(SOURCE_PATH)/libgaia
tests :
$(MAKE) $@ -C $(SOURCE_PATH)/libgaia
# Rules
$(TARGET).out : $(OBJS)
$(MAKE) -C $(SOURCE_PATH)/asm
$(MAKE) -C $(SOURCE_PATH)/GaiaLib
$(MAKE) -C $(SOURCE_PATH)/libgaia
$(MAKE) -C $(SOURCE_PATH)/uranus
$(CC) -o $@ $(OBJS) $(LIB_OBJS) -m32 -nostdinc -nostdlib -fno-builtin
# $(LD) -o $@ $(OBJS) $(LIB_OBJS) -Ttext 0x100000 -melf_i386