-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (59 loc) · 1.45 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
APPS = init sh
FS_ROOT = fs_root
BIN_PATH = $(FS_ROOT)/bin
WARNINGS = -Wall -Wextra -Werror
CFLAGS = -m32
CC = gcc
FS_SIZE = 4 # in MB
all: iso
iso: build_kernel build_libc fs
@echo '-> Creating ISO'
./create_iso.sh fs
@echo ''
run: iso
@echo '-> Starting BOCHS'
./run_bochs.sh || echo "\n" ; cat com1.out
create_bin_folder: build_apps
@echo '-> Copying applications to fs folder'
mkdir -p $(BIN_PATH)
for app in $(APPS); do cp apps/$$app $(BIN_PATH); done
@echo ''
fs: mkfs create_bin_folder
@echo '-> Creating filesystem'
./mkfs $(FS_ROOT) $(FS_SIZE) $@
@echo ''
mkfs_release: CFLAGS = $(CFLAGS) -O2
mkfs_release: mkfs
mkfs_debug: CFLAGS = $(CFLAGS) -g
mkfs_debug: mkfs
mkfs: mkfs.c
$(CC) $(WARNINGS) $(CFLAGS) mkfs.c -o mkfs
rdaefs_release: CFLAGS = $(CFLAGS) -O2
rdaefs_release: rdaefs
rdaefs_debug: CFLAGS = $(CFLAGS) -g
rdaefs_debug: rdaefs
rdaefs: rdaefs.c
$(CC) $(WARNINGS) $(CFLAGS) rdaefs.c -o rdaefs
build_apps:
@echo '-> Building applications'
@make --no-print-directory -C apps
@echo ''
build_kernel:
@echo '-> Building kernel'
@make --no-print-directory -C kernel
@echo ''
build_libc:
@echo '-> Building libc'
@make --no-print-directory -C libc
@echo ''
clean:
@echo '-> Cleaning kernel'
@make --no-print-directory -C kernel clean
@echo ''
@echo '-> Cleaning apps'
@make --no-print-directory -C apps clean
@echo ''
@echo '-> Cleaning libc'
@make --no-print-directory -C libc clean
@echo ''
rm -rf mkfs os.iso fs rdaefs