-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
130 lines (104 loc) · 2.93 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.EXPORT_ALL_VARIABLES:
.DEFAULT_GOAL:=all
MAKEFLAGS += --no-print-directory
TOPDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
SYSROOTDIR := $(TOPDIR)/sysroot
TOOLSDIR := $(TOPDIR)/tools
BINDIR = /bin
LIBDIR = /usr/lib
INCDIR = /usr/include
ASMDIR = /usr/asm
AS = fasm
CC ?= gcc
RM = rm -f
MK_BUGREPORT := \"https://git.cute.engineering/d0p1/StupidOS/issues\"
MK_COMMIT := \"$(shell git rev-parse --short HEAD)\"
MK_PACKAGE := \"StupidOS\"
CFLAGS = -DMK_COMMIT="$(MK_COMMIT)" \
-DMK_BUGREPORT="$(MK_BUGREPORT)" \
-DMK_PACKAGE="$(MK_PACKAGE)" \
-I$(TOPDIR)include
LDFLAGS =
QEMU_COMMON = \
-rtc base=localtime \
-vga cirrus \
-serial stdio \
-monitor telnet::4545,server,nowait \
-net nic,model=ne2k_isa \
-machine isapc
SUBDIRS := external tools include boot kernel modules lib bin
TARGET = stupid.tar.gz floppy1440.img floppy2880.img
ifneq ($(OS),Windows_NT)
EXEXT =
TARGET += stupid.iso stupid.hdd
else
EXEXT = .exe
endif
.PHONY: all
all: $(TARGET)
GOAL:=install
clean: GOAL:=clean
.PHONY: $(SUBDIRS)
$(SUBDIRS):
@echo "📁 $@"
@DESTDIR=$(SYSROOTDIR) $(MAKE) -C $@ $(GOAL)
.PHONY: stupid.iso
stupid.iso: $(SUBDIRS)
$(TOPDIR)/tools/create-iso $@ sysroot
.PHONY: stupid.hdd
stupid.hdd: $(SUBDIRS)
dd if=/dev/zero of=$@ bs=1M count=0 seek=64
mformat -L 12 -i $@
mcopy -i $@ boot/loader/stpdldr.sys ::/STPDLDR.SYS
mcopy -i $@ kernel/vmstupid.sys ::/VMSTUPID.SYS
.PHONY: stupid.tar.gz
stupid.tar.gz: $(SUBDIRS)
tar -czvf $@ sysroot
.PHONY: floppy1440.img
floppy1440.img: $(SUBDIRS)
dd if=/dev/zero of=$@ bs=512 count=1440
mformat -C -f 1440 -i $@
dd if=boot/bootsect/boot_floppy1440.bin of=$@ conv=notrunc
mcopy -i $@ boot/loader/stpdldr.sys ::/STPDLDR.SYS
mcopy -i $@ kernel/vmstupid.sys ::/VMSTUPID.SYS
.PHONY: floppy2880.img
floppy2880.img: $(SUBDIRS)
dd if=/dev/zero of=$@ bs=512 count=2880
mformat -C -f 2880 -i $@
dd if=boot/bootsect/boot_floppy2880.bin of=$@ conv=notrunc
mcopy -i $@ boot/loader/stpdldr.sys ::/STPDLDR.SYS
mcopy -i $@ kernel/vmstupid.sys ::/VMSTUPID.SYS
OVMF32.fd:
wget 'https://retrage.github.io/edk2-nightly/bin/DEBUGIa32_OVMF.fd' -O $@
.PHONY: run
run: all
qemu-system-i386 \
$(QEMU_COMMON) \
-drive file=floppy1440.img,if=none,format=raw,id=boot \
-drive file=fat:rw:./sysroot,if=none,id=hdd \
-device floppy,drive=boot \
-global isa-fdc.bootindexA=0
.PHONY: run-iso
run-iso: all
qemu-system-i386 \
$(QEMU_COMMON) \
-cdrom stupid.iso
.PHONY: run-efi
run-efi: all OVMF32.fd
qemu-system-i386 \
-bios OVMF32.fd \
-drive file=fat:rw:./sysroot,if=none,id=hdd \
-device ide-hd,drive=hdd
.PHONY: bochs
bochs:
bochs -f .bochsrc
.PHONY: docs
docs:
@mkdir -p docs/html
wget -O docs/webring.json https://webring.devse.wiki/webring.json
python3 docs/devsewebring.py docs/webring.json docs/webring.txt
naturaldocs -p docs/config -img docs/img -xi sysroot -i . -ro -o HTML docs/html
cp docs/img/favicon.ico docs/html/
.PHONY: clean
clean: $(SUBDIRS)
$(RM) $(TARGET)