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
35 lines
768 B
Makefile
35 lines
768 B
Makefile
|
|
ASMOBJS := $(patsubst %.asm,%.o,$(wildcard *.asm))
|
|
COBJS := $(patsubst %.c,%.o,$(wildcard *.c))
|
|
CXXOBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
|
|
CDEPS := $(COBJS:.o=.dep)
|
|
CXXDEPS := $(CXXOBJS:.o=.dep)
|
|
OUTPUT_FILE := $(SUBDIR)_all.o
|
|
|
|
all: $(OUTPUT_FILE)
|
|
|
|
$(OUTPUT_FILE): $(ASMOBJS) $(COBJS) $(CXXOBJS)
|
|
$(LD) -r -o $@ $^
|
|
|
|
%.o: %.asm
|
|
$(NASM) -f elf -o $@ $<
|
|
|
|
%.o: %.c
|
|
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
|
|
|
|
%.o: %.cc
|
|
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
|
|
|
# Make dependency files
|
|
%.dep: %.c
|
|
@set -e; rm -f $@; \
|
|
$(CC) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
|
|
|
|
clean:
|
|
-rm -f *.o *.dep *~
|
|
|
|
# Include dependency files
|
|
ifndef clean
|
|
-include $(DEPS)
|
|
endif
|