-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
42 lines (34 loc) · 1.16 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
###########################
# Makefile for Kernel Tox #
###########################
# Programs, flags, etc.
ASM = nasm
DASM = ndisasm
CC = gcc
LD = ld
ASMBFLAGS = -I boot/include/
ASMKFLAGS = -I include/ -f elf
# disable builtin fuctions & stack protector
CFLAGS = -I include/ -c -Wall -f no-builtin -f no-stack-protector
# This program
TOXSBOOT = boot/boot.bin boot/loader.bin kernel/kernel.bin
.PHONY : everything image clean buildimg
# Default starting position
everything : $(TOXSBOOT)
image : everything buildimg
clean :
rm -f $(TOXSBOOT)
# tox.img needs to be exist.
buildimg :
dd if=boot/boot.bin of=tox.img bs=512 count=1 conv=notrunc
sudo mount -o loop tox.img /mnt/floppy/
sudo cp -vf boot/loader.bin /mnt/floppy/
sudo cp -vf kernel/kernel.bin /mnt/floppy/
sudo umount /mnt/floppy/
# OBJS; $@: target; $<: first prerequisite's name
boot/boot.bin : boot/boot.asm boot/include/fat12hdr.inc boot/include/load.inc
$(ASM) $(ASMBFLAGS) -o $@ $<
boot/loader.bin : boot/loader.asm boot/include/fat12hdr.inc boot/include/load.inc boot/include/pm.inc
$(ASM) $(ASMBFLAGS) -o $@ $<
kernel/kernel.bin : kernel/kernel.asm
$(ASM) $(ASMBFLAGS) -o $@ $<