-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
62 lines (49 loc) · 1.72 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
# ========================================
# Simple boot32 barebones Makefile
# by Philip R. Simonson.
# ========================================
AS=nasm
AFLAGS=-f bin
# Custom commands
IMAGEFS=./imagefs/imagefs
PRSFS=./prsfs/prsfs
SRCDIR=.
PROJECT_DIR=$(shell pwd)
PROJECT_NAME=$(shell basename $(PROJECT_DIR))
PROJECT_VERSION=1.0
CDROM_IMG=$(SRCDIR)/boot32-barebones.iso
.PHONY: all run debug disk clean distclean dist
all:
cd $(SRCDIR)/boot && $(MAKE)
cd $(SRCDIR)/kernel && $(MAKE)
cd $(SRCDIR)/imagefs && $(MAKE)
cd $(SRCDIR)/prsfs && $(MAKE)
cd $(SRCDIR)/imgwrite && $(MAKE)
run: disk
qemu-system-i386 -fda $(SRCDIR)/floppy.img -boot a -soundhw pcspk
debug: disk
qemu-system-i386 -fda $(SRCDIR)/floppy.img -boot a -s &
gdb -ex "target remote localhost:1234" -ex "symbol-file $(SRCDIR)/kernel/kernel.elf"
disk: all
$(IMAGEFS) c $(SRCDIR)/floppy.img 2880
$(IMAGEFS) w $(SRCDIR)/floppy.img $(SRCDIR)/boot/stage1.bin
$(PRSFS) $(SRCDIR)/floppy.img $(SRCDIR)/boot/stage2.bin $(SRCDIR)/kernel/kernel.bin
cdrom: disk clean
cd .. && mkisofs -pad -b floppy.img -R -o ./$(PROJECT_NAME)/boot32-barebones.iso ./$(PROJECT_NAME)
clean:
rm -f $(TARGETS)
cd $(SRCDIR)/boot && $(MAKE) clean
cd $(SRCDIR)/kernel && $(MAKE) clean
cd $(SRCDIR)/imagefs && $(MAKE) clean
cd $(SRCDIR)/prsfs && $(MAKE) clean
cd $(SRCDIR)/imgwrite && $(MAKE) clean
distclean: clean
rm -f floppy.img $(CDROM_IMG) *.bak *.log
cd $(SRCDIR)/boot && $(MAKE) distclean
cd $(SRCDIR)/kernel && $(MAKE) distclean
cd $(SRCDIR)/imagefs && $(MAKE) distclean
cd $(SRCDIR)/prsfs && $(MAKE) distclean
cd $(SRCDIR)/imgwrite && $(MAKE) distclean
dist: distclean
cd .. && tar -cv --exclude=.git $(SRCDIR)/$(PROJECT_NAME) \
| xz -9 > $(PROJECT_NAME)-$(PROJECT_VERSION).tar.xz