-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 947 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
CXX := ~/opt/cross/bin/i686-elf-g++
CXXFLAGS := -T linker.ld -ffreestanding -O2 -nostdlib -Llibc/out
SRC_DIR := src
OUT_DIR := out
SRC_EXT := cpp
OUT_EXT := o
OS_NAME := NightOS
OS_BIN := $(OS_NAME).bin
all:
$(MAKE) bootloader
$(MAKE) libc
$(MAKE) kernel
link:
$(CXX) $(CXXFLAGS) \
$(wildcard bootloader/$(OUT_DIR)/*.$(OUT_EXT)) \
$(wildcard kernel/$(OUT_DIR)/*.$(OUT_EXT)) \
-o $(OUT_DIR)/$(OS_BIN) \
-l:nightlibc.a
bootloader:
$(MAKE) -C $@
libc:
$(MAKE) -C $@
kernel:
$(MAKE) -C $@
print:
@echo "CXX: $(CXX)"
@echo "CXXFLAGS: $(CXXFLAGS)"
@echo "SRC_DIR: $(SRC_DIR)"
@echo "OUT_DIR: $(OUT_DIR)"
@echo "SRC_EXT: $(SRC_EXT)"
@echo "OUT_EXT: $(OUT_EXT)"
@echo "OS_NAME: $(OS_NAME)"
@echo "OS_BIN: $(OS_BIN)"
@echo "BOOT_FILES: $(BOOT_FILES)"
@echo "KERNEL_FILES: $(KERNEL_FILES)"
clean:
$(MAKE) -C bootloader clean
$(MAKE) -C libc clean
$(MAKE) -C kernel clean
.PHONY: all clean bootloader kernel libc print