Added mm build subdir with mm.c Updated subdir.mak to build $(subdir)_all.o instead of $(subdir).o Updated main Makefile to pass SUBDIR in to subdirectory builds, add $(HOS_TOPLEVEL)/include to compiler include path, and made the linker write a map file Updated boot.asm to use the page_directory symbol from the .bss section defined in mm.o as its temporary stack area git-svn-id: svn://anubis/hos/trunk@22 5b3e749e-e535-0410-8002-a9bb6afbdfca
50 lines
1.1 KiB
Makefile
50 lines
1.1 KiB
Makefile
|
|
export PLATFORM := $(shell if [[ `uname` =~ "CYGWIN" ]]; then \
|
|
echo cygwin; \
|
|
else \
|
|
echo unix; \
|
|
fi)
|
|
|
|
ifeq ($(PLATFORM), cygwin)
|
|
export LD := i586-elf-ld
|
|
export CC := i586-elf-gcc
|
|
export CXX := i586-elf-g++
|
|
else
|
|
export LD := ld
|
|
export CC := gcc
|
|
export CXX := g++
|
|
endif
|
|
export NASM := nasm
|
|
|
|
WD := $(shell pwd)
|
|
export HOS_TOPLEVEL := $(WD)
|
|
LDSCRIPT := link.ld
|
|
KERNEL := hos
|
|
export CPPFLAGS := -I$(HOS_TOPLEVEL) -I$(HOS_TOPLEVEL)/include
|
|
export CFLAGS := -Wall -O2
|
|
export CXXFLAGS := -Wall -O2
|
|
export LDFLAGS := -T $(LDSCRIPT) -Map $(KERNEL).map
|
|
|
|
SUBDIRS := boot mm
|
|
SUBDIRS_clean := $(SUBDIRS:%=%.clean)
|
|
|
|
.PHONY: all
|
|
all: $(KERNEL).gz
|
|
|
|
$(KERNEL).gz: $(KERNEL)
|
|
gzip -c $< > $@
|
|
|
|
$(KERNEL): $(SUBDIRS)
|
|
$(LD) $(LDFLAGS) -o $@ $(foreach subdir,$(SUBDIRS),$(subdir)/$(subdir)_all.o)
|
|
|
|
.PHONY: $(SUBDIRS)
|
|
$(SUBDIRS):
|
|
$(MAKE) -C $@ SUBDIR=$@
|
|
|
|
.PHONY: clean
|
|
clean: $(SUBDIRS_clean)
|
|
-rm -f *~ $(KERNEL) $(KERNEL).gz
|
|
|
|
%.clean:
|
|
$(MAKE) -C $* clean clean=1
|