# Compile the library and call the Makefile of each sub-directory. # export # export all variable to sub-Makefile CC = mipsel-unknown-elf-gcc AS = mipsel-unknown-elf-as LD = mipsel-unknown-elf-ld DU = mipsel-unknown-elf-objdump CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 SOFT_PATH = $(shell cd ..; pwd)/ LIB_PATH = $(SOFT_PATH)libs SYS_PATH = $(SOFT_PATH)sys DUMP_PATH = $(SOFT_PATH) #where goes the generated *.bin MAP_PATH = $(SOFT_PATH)xml BUILD_PATH = $(SOFT_PATH)/build/ BIN_PATH = $(SOFT_PATH)/build/ INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) TRASH= /dev/null||true LIB_COMPILE+= stdio.o LIB_COMPILE+= mwmr.o LIB_COMPILE+= common.o DIRS=$(shell ls -d */ ) #list all directorys .PHONY: prepare all: prepare $(LIB_COMPILE) set -e; for d in $(DIRS); do $(MAKE) -C $$d ; echo "Compiling $$d"; done prepare: @mkdir $(BUILD_PATH) 2>$(TRASH) %.o : $(LIB_PATH)/%.c $(CC) $(CFLAGS) $(INCLUDE) -c -o $(BUILD_PATH)/$@ $< clean: rm -f *.o set -e; for d in $(DIRS); do $(MAKE) clean -C $$d ; done