Line | |
---|
1 | # Compile the library and call the Makefile of each sub-directory. # |
---|
2 | |
---|
3 | export # export all variable to sub-Makefile |
---|
4 | CC = mipsel-unknown-elf-gcc |
---|
5 | AS = mipsel-unknown-elf-as |
---|
6 | LD = mipsel-unknown-elf-ld |
---|
7 | DU = mipsel-unknown-elf-objdump |
---|
8 | |
---|
9 | CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 |
---|
10 | |
---|
11 | SOFT_PATH = $(shell cd ..; pwd)/ |
---|
12 | |
---|
13 | LIB_PATH = $(SOFT_PATH)libs |
---|
14 | SYS_PATH = $(SOFT_PATH)sys |
---|
15 | DUMP_PATH = $(SOFT_PATH) #where goes the generated *.bin |
---|
16 | BIN_PATH = $(SOFT_PATH) |
---|
17 | MAP_PATH = $(SOFT_PATH)xml |
---|
18 | BUILD_PATH = $(SOFT_PATH)/build/ |
---|
19 | |
---|
20 | INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) |
---|
21 | |
---|
22 | TRASH= /dev/null||true |
---|
23 | |
---|
24 | LIB_COMPILE+= stdio.o |
---|
25 | LIB_COMPILE+= mwmr.o |
---|
26 | LIB_COMPILE+= common.o |
---|
27 | |
---|
28 | DIRS=$(shell ls -d */ ) #list all directorys |
---|
29 | |
---|
30 | |
---|
31 | .PHONY: prepare |
---|
32 | |
---|
33 | all: prepare $(LIB_COMPILE) |
---|
34 | set -e; for d in $(DIRS); do $(MAKE) -C $$d ; echo "Compiling $$d"; done |
---|
35 | |
---|
36 | prepare: |
---|
37 | @mkdir $(BUILD_PATH) 2>$(TRASH) |
---|
38 | |
---|
39 | %.o : $(LIB_PATH)/%.c |
---|
40 | $(CC) $(CFLAGS) $(INCLUDE) -c -o $(BUILD_PATH)/$@ $< |
---|
41 | |
---|
42 | clean: |
---|
43 | rm -f *.o |
---|
44 | set -e; for d in $(DIRS); do $(MAKE) clean -C $$d ; done |
---|
45 | |
---|
Note: See
TracBrowser
for help on using the repository browser.