-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (29 loc) · 969 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# search path
VPATH := $(subst /, , $(shell ls -d */))
# Generic code
find_files = $(wildcard $(dir)/*.[c])
dirs := $(subst :, , $(VPATH))
SRC_OBJS_PRE := $(foreach dir,$(dirs),$(find_files))
SRC_OBJS := $(patsubst %.c, %.o, $(SRC_OBJS_PRE))
SRC_OBJS := $(patsubst %.S, %.o, $(SRC_OBJS))
SRC_OBJS_DEPEND := $(notdir $(SRC_OBJS))
find_elf = $(wildcard $(dir)/*.elf)
find_bin = $(wildcard $(dir)/*.bin)
find_map = $(wildcard $(dir)/*.map)
find_~ = $(wildcard $(dir)/*~)
find_obj = $(wildcard $(dir)/*.o)
ELFANDBIN := $(foreach dir,$(dirs),$(find_elf))
ELFANDBIN += $(foreach dir,$(dirs),$(find_bin))
ELFANDBIN += $(foreach dir,$(dirs),$(find_map))
ELFANDBIN += $(foreach dir,$(dirs),$(find_~))
ELFANDBIN += $(foreach dir,$(dirs),$(find_obj))
.PHONY: clean, cleanall
clean:
@echo Cleaning...
@echo Files:
rm -rf $(PROJ).elf $(PROJ).bin *.o *~ *.map \
$(BOOT_LAYOUT_OUT) $(SRC_OBJS) *.files *.out
cleanall:
make clean
make cleanall -C src
rm -f $(ELFANDBIN)