-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
121 lines (88 loc) · 3.28 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
################################################################################
# PROLOGUE #
################################################################################
.SUFFIXES:
# There is no default target.
all:
@ echo -n "Currently supported target architectures are: " 1>&2
@ echo "amd64, ia32pae, ia32" 1>&2
@ echo "Please choose one of them as a target!" 1>&2
@ return 42 # Yes, the answer to 'all', basically.
# Solution directories
PREFIX := ./build
# Common settings
include ./Beelzebub.mk
# Fake targets.
.PHONY: run qemu qemu-serial clean jegudiel image kernel apps libs sysheaders $(ARC) $(SETTINGS)
# Output file
KERNEL_DIR := ./$(KERNEL_NAME)
################################################################################
# TOOLCHAIN & SETTINGS #
################################################################################
# Toolchain
include ./Toolchain.mk
# This one is needed to determine Make flags.
################################################################################
# ARCHITECTURE-SPECIFIC SETTINGS #
################################################################################
##############
# 64-bit x86 #
ifeq ($(ARC),amd64)
image:: jegudiel
endif
################################################################################
# TARGETS #
################################################################################
# Do nothing for the architecture as a target.
$(ARC): image
@ true
####################################### CLEANING ##########
clean:: clean-libs clean-jegudiel \
clean-kernel clean-apps clean-image
@ rm -Rf $(PREFIX)
@ rm -f last_settings.txt
#clean-sysheaders:
# @ $(MAKE) -C sysheaders/ clean
clean-libs:
@ $(MAKE) -C libs/ clean
clean-jegudiel:
@ $(MAKE) -C jegudiel/ clean
clean-kernel:
@ $(MAKE) -C $(KERNEL_DIR)/ clean
clean-apps:
@ $(MAKE) -C apps/ clean
clean-image:
@ $(MAKE) -C image/ clean
####################################### TESTING & RUNNING ##########
run: $(ISO_PATH)
@ bochs -q
qemu: $(ISO_PATH)
@ qemu-system-x86_64 -cdrom $(ISO_PATH) -smp 4
qemu-serial: $(ISO_PATH)
@ qemu-system-x86_64 -cdrom $(ISO_PATH) -smp 4 -nographic
vmware:
# @ echo a | /cygdrive/c/Users/rada/Dropbox/Projects/Named\ Pipe\ Server/Named\ Pipe\ Server/bin/Release/Named\ Pipe\ Server
@ vmrun start $(VMX_PATH)
vmware2:
@ vmrun start $(VMX_PATH)
@ sleep 5
@ vmrun stop $(VMX_PATH)
####################################### COMPONENTS ##########
jegudiel: sysheaders
# @ echo "/MAK:" $@
@ $(MAKE) -C jegudiel/ $(ARC) $(SETTINGS) install $(MAKE_FLAGS)
image:: kernel apps libs sysheaders
# @ echo "/MAK:" $@
@ $(MAKE) -C image/ $(ARC) $(SETTINGS) iso $(MAKE_FLAGS)
kernel: libs sysheaders
# @ echo "/MAK:" $@
@ $(MAKE) -C $(KERNEL_DIR)/ $(ARC) $(SETTINGS) install $(MAKE_FLAGS)
apps: kernel libs sysheaders
# @ echo "/MAK:" $@
@ $(MAKE) -C apps/ $(ARC) $(SETTINGS) install $(MAKE_FLAGS)
libs: sysheaders
# @ echo "/MAK:" $@
@ $(MAKE) -C libs/ $(ARC) $(SETTINGS) install $(MAKE_FLAGS)
sysheaders:
# @ echo "/MAK:" $@
@ $(MAKE) -C sysheaders/ $(ARC) $(SETTINGS) install $(MAKE_FLAGS)