-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
77 lines (62 loc) · 1.56 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
IMGS = $(BOOT)/loader.img $(KERNEL)/kernel.img $(DRIVERS)/vram/fonts.bin
HOME_DIR = $(CURDIR)
USER_NAME = rkx
#---Build Command---
CC = gcc
CFLAGS = -fomit-frame-pointer -I$(HOME_DIR)/include -masm=intel -Wall
LFLAGS = -T kernel_ld -Map kernel.map -nostdlib -e kernel_main --oformaty binary
ASFLAGS = -msyntax=intel -march=i686 --32
NASM = nasm
LD = ld
DD = dd
MAKE = make
#-------------------
CP = cp
MV = mv
RM = rm
CD = cd
CAT = cat
SUDO = sudo
WHOAMI = whoami
GRUB_INSTALL = grub-install
#---Module path-------
COMPILE_PATH = /tmp/Abyon
BOOT = boot
KERNEL = kernel
ARCH = arch
DRIVERS = drivers
#---------------------
#---Virtual Loop Device---
SET_LPDEV = losetup
LPDEV = /dev/loop0
LPDEV_IMG = loop_device.img
MNT_PATH = /media/$(USER_NAME)
#-------------------------
$(BOOT)/loader.img : Makefile
($(CD) $(BOOT);$(MAKE))
$(KERNEL)/kernel.img : Makefile
($(CD) $(KERNEL);$(MAKE) img)
Abyon.img : $(IMGS) Makefile
$(CAT) $(IMGS) > AbyonPlain.img
$(DD) if=AbyonPlain.img of=Abyon.img conv=sync
img :
$(MAKE) Abyon.img
install :
./script/prepare.sh
($(CD) $(COMPILE_PATH);$(MAKE) img)
$(MV) $(COMPILE_PATH)/Abyon.img $(HOME_DIR)/Abyon.img
#$(RM) -r $(COMPILE_PATH)
init :
$(DD) if=/dev/zero of=$(LPDEV_IMG) bs=1k count=1440
$(SUDO) $(SET_LPDEV) $(LPDEV) $(LPDEV_IMG)
$(SUDO) mkdosfs $(LPDEV)
$(SUDO) mount -t vfat $(LPDEV) $(MNT_PATH)
del :
$(SUDO) umount $(LPDEV)
$(SUDO) $(SET_LPDEV) -d $(LPDEV)
clean :
$(SUDO) $(RM) *.img
($(CD) $(BOOT);$(MAKE) clean)
($(CD) $(KERNEL);$(MAKE) clean)
%.o : %.c Makefile
$(CC) -c -o $*.o $*.c -O2 -Wall