-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
45 lines (35 loc) · 1.15 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
# Makefile
# Directories
IMAGEDIR := images/
SOURCEDIR := source/
FSTOOLSDIR := fstools/
# User files and args for mkfs
USERFILES := $(SOURCEDIR)programs/edit.bin
MKFSARGS := $(SOURCEDIR)boot/boot.bin $(SOURCEDIR)kernel.n16 $(USERFILES)
# Make source and create images
all: $(FSTOOLSDIR)mkfs
$(MAKE) $@ -C $(SOURCEDIR) --no-print-directory
mkdir -p $(IMAGEDIR)
$(FSTOOLSDIR)mkfs $(IMAGEDIR)os-fd.img 2880 $(MKFSARGS)
$(FSTOOLSDIR)mkfs $(IMAGEDIR)os-hd.img 28800 $(MKFSARGS)
# mkfs generates disk images
$(FSTOOLSDIR)mkfs: $(FSTOOLSDIR)mkfs.c $(SOURCEDIR)fs.h
gcc -Werror -Wall -I$(SOURCEDIR) -o $(FSTOOLSDIR)mkfs $(FSTOOLSDIR)mkfs.c
# Generate tags
ctags:
ctags -R
# run in emulators
# Specify QEMU path here
QEMU = qemu-system-i386
QEMUOPTS = -drive file=$(IMAGEDIR)os-fd.img,if=floppy,media=disk,format=raw \
-drive file=$(IMAGEDIR)os-hd.img,media=disk,format=raw \
-boot menu=on -serial mon:stdio -m 1
qemu: all
$(QEMU) $(QEMUOPTS)
# Clean
clean:
rm -f $(FSTOOLSDIR)mkfs
rm -f tags
rm -f $(IMAGEDIR)os-fd.img $(IMAGEDIR)os-hd.img
$(MAKE) $@ -C $(SOURCEDIR) --no-print-directory
.PHONY: all ctags qemu clean