summaryrefslogblamecommitdiff
path: root/Makefile
blob: 1fa8b0538324956745d6ccfa40c4eedca044b112 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                 




                                                                   
                          
 


                         
               

    

                                                         
                                         
                                                                                        




                     


                                                         
                                                                                      


            


                                                         
                                                                                         




                             
                       
 
                                                                                                                                                                                                                    




                                                                                





                                                                    
                                                              
                                                                       
                                          
                                                         


                                                                 
                                                         
                                                 



                                                         
                              



                                                                                     

                          
                  
                                                      
 
                      
                                                                                                   
 
.PHONY: clean, mrproper, Init.rfs, floppy, commit

Projects = tools/makeinitrd kernel
Projects +=  user/lib/libc
Projects += user/app/init user/app/test user/app/prime user/app/led
Projects += user/app/kbasic
Projects += user/app/yosh
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 -s -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 -s -C src/$$p clean -s; \
	done

mrproper:
	@for p in $(Projects); do \
		echo ""; echo "----------------------"; \
		echo "=> Cleaning $$p"; \
		BasePath=$(BasePath) SrcPath=$(SrcPath) make -s -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/app/test/test.elf src/user/app/init/init.elf src/user/app/yosh/yosh.elf src/user/app/prime/prime.elf src/user/app/led/led.elf src/user/app/kbasic/kbasic.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
	cp menu_cdrom.lst cdrom/boot/grub/menu.lst
	cp src/kernel/kernel.elf cdrom; strip cdrom/kernel.elf
	cp src/user/app/init/init.elf cdrom; strip cdrom/init.elf
	cp src/user/app/test/test.elf cdrom; strip cdrom/test.elf
	cp src/user/app/yosh/yosh.elf cdrom; strip cdrom/yosh.elf
	cp src/user/app/prime/prime.elf cdrom; strip cdrom/prime.elf
	cp src/user/app/led/led.elf cdrom; strip cdrom/led.elf
	cp src/user/app/kbasic/kbasic.elf cdrom; strip cdrom/kbasic.elf
	cp src/user/app/kbasic/*.bas cdrom
	src/tools/makeinitrd/makeinitrd cdrom/initrd	\
		cdrom/test.elf:/bin/test 			\
		cdrom/yosh.elf:/bin/yosh 			\
		cdrom/prime.elf:/bin/prime 			\
		cdrom/led.elf:/bin/led 			\
		cdrom/kbasic.elf:/bin/kbasic	\
		cdrom/guess.bas:/bas/guess		\
		cdrom/tables.bas:/bas/tables	\
		cdrom/count.bas:/bas/count		\
		cdrom/prime.bas:/bas/prime		\
		README:/readme
	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 -serial stdio

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