added Makefile commands to build a binary and an ELF kernel and do disassemble the ELF version

git-svn-id: svn://anubis/hos/trunk@53 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
josh 2009-07-14 13:50:29 +00:00
parent bf9c7d74eb
commit 118021a0f6

View File

@ -2,6 +2,7 @@
export LD := i586-elf-ld export LD := i586-elf-ld
export CC := i586-elf-gcc export CC := i586-elf-gcc
export CXX := i586-elf-g++ export CXX := i586-elf-g++
export OBJDUMP := i586-elf-objdump
export NASM := nasm export NASM := nasm
WD := $(shell pwd) WD := $(shell pwd)
@ -23,8 +24,13 @@ all: $(KERNEL).gz
$(KERNEL).gz: $(KERNEL) $(KERNEL).gz: $(KERNEL)
gzip -c $< > $@ gzip -c $< > $@
$(KERNEL): $(SUBDIRS) $(KERNEL): $(KERNEL).o
$(LD) $(LDFLAGS) -o $@ $(foreach subdir,$(SUBDIRS),$(subdir)/$(subdir)_all.o) $(LDLIBS) $(LD) $(LDFLAGS) -o $@ $<
$(LD) $(LDFLAGS) --oformat=elf32-i386 -o $@.elf $<
$(OBJDUMP) --disassemble --source $@.elf > $@.dump
$(KERNEL).o: $(SUBDIRS)
$(LD) -r -o $@ $(foreach subdir,$(SUBDIRS),$(subdir)/$(subdir)_all.o) $(LDLIBS)
.PHONY: $(SUBDIRS) .PHONY: $(SUBDIRS)
$(SUBDIRS): $(SUBDIRS):
@ -32,7 +38,7 @@ $(SUBDIRS):
.PHONY: clean .PHONY: clean
clean: $(SUBDIRS_clean) clean: $(SUBDIRS_clean)
-rm -f *~ $(KERNEL) $(KERNEL).gz -rm -f *~ $(KERNEL) $(KERNEL).{gz,o,elf,dump,map}
%.clean: %.clean:
$(MAKE) -C $* clean clean=1 $(MAKE) -C $* clean clean=1