summaryrefslogtreecommitdiff
path: root/Makefile
blob: ab689c0032029a16d25946337609336d2dd48497 (plain) (blame)
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
.PHONY: clean, mrproper, Init.rfs, floppy, commit

Projects = tools/makeinitrd kernel user/lib user/test
QemuCmd = qemu-system-i386

BasePath = $(shell pwd)
SrcPath = $(BasePath)/src

Cdrom = TCE.iso

all:
	@for p in $(Projects); do \
		echo ""; echo "----------------------"; \
		echo "=> Building $$p"; \
		BasePath=$(BasePath) SrcPath=$(SrcPath) make -C src/$$p || exit -1; \
	done

rebuild: mrproper all

clean:
	@for p in $(Projects); do \
		echo ""; echo "----------------------"; \
		echo "=> Cleaning $$p"; \
		BasePath=$(BasePath) SrcPath=$(SrcPath) make -C src/$$p clean -s; \
	done

mrproper:
	@for p in $(Projects); do \
		echo ""; echo "----------------------"; \
		echo "=> Cleaning $$p"; \
		BasePath=$(BasePath) SrcPath=$(SrcPath) make -C src/$$p mrproper -s; \
	done

commit: mrproper
	git add .
	git commit -a; exit 0
	git push origin

$(Cdrom): menu_cdrom.lst src/kernel/kernel.elf src/user/test/test.elf
	mkdir -p cdrom/boot/grub
	if [ ! -e cdrom/boot/grub/stage2_eltorito ]; then \
		echo "Please copy grub's stage2_eltorito to cdrom/boot/grub."; \
		exit -1; \
	fi
	src/tools/makeinitrd/makeinitrd cdrom/initrd	\
		src/user/test/test.elf:/bin/test 			\
		README:/readme
	cp menu_cdrom.lst cdrom/boot/grub/menu.lst
	cp src/kernel/kernel.elf cdrom
	cp src/user/test/test.elf cdrom
	genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \
		-boot-info-table -input-charset ascii -A TCE -o $(Cdrom) cdrom

bochs: all $(Cdrom)
	bochs -f bochs.cfg

qemu: all $(Cdrom)
	$(QemuCmd) -cdrom $(Cdrom) -m 32

qemu-gdb: all $(Cdrom)
	$(QemuCmd) -cdrom $(Cdrom) -m 32 -s -S & gdb src/kernel/kernel.elf -x gdb-cmd