forked from kehribar/nrf24L01_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·86 lines (67 loc) · 3.06 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Makefile for the Cavrn AVR8 library #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Version: 1.2 #
# Max Mansfield on February 18, 2015 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
include settings.inc # settings of the build to be edited by the user
include cavrn_config.inc # build configuration options that the user doesnt need to touch
.PHONY: all dirs obj staticlib success version upload console clean
all: version dirs obj success
$(BUILD_DIR):
@mkdir -p $@
dirs: $(BUILD_DIR)
$(OBJ):
@echo
@echo [Creating Object File $(INFO) ] $@ [compiling]
@echo
$(CC) $(CFLAGS) -c "$(SOURCE_)$(shell echo '$(@:.o=.c)' | sed 's/$(BUILD_)//g')" -o $@
@echo
@echo [Object File Created] $@ [from] "$(SOURCE_)$(shell echo '$(@:.o=.c)' | sed 's/$(BUILD_)//g')" [complete]
@echo
obj: $(OBJ)
$(LIBNAME): $(OBJ) $(CSRC)
@echo
@echo
$(LD) $(LDFLAGS) $(BUILD_)/$(LIBNAME) $(OBJ)
@echo Created $(LIBNAME) static library
@echo
staticlib: $(LIBNAME)
exampledirs: dirs obj staticlib
$(shell test -d $(EXMPL_TEMPLT)/$(SRC_NAME) || mkdir -p $(EXMPL_TEMPLT)/$(SRC_NAME))
$(foreach mod,$(MODULES),$(foreach type,$(EXMPL_TYPES),$(shell test -d $(EXMPL_SOURCE)/$(mod)/$(type) || mkdir -p $(EXMPL_SOURCE)/$(mod)/$(type))))
$(foreach file,$(SRC),$(shell test -h $(EXMPL_TEMPLT)/$(SRC_NAME)/$(notdir $(file)) || ln -sf $(EXMPL_DEPTH)$(file) $(EXMPL_TEMPLT)/$(SRC_NAME)))
examples: exampledirs
$(foreach mod,$(MODULES),$(foreach type,$(EXMPL_TYPES),$(shell \
mkdir -p $(EXMPL_DIR)/$(mod)/$(type) && \
test -d $(EXMPL_TEMPLT)/ && \
test -d $(EXMPL_DIR)/$(mod)/$(type)/ && \
cp -r $(EXMPL_TEMPLT)/* $(EXMPL_DIR)/$(mod)/$(type) && \
test -e $(EXMPL_SOURCE)/$(mod)/$(type)/main.c && \
ln -sf ../../../$(BUILD_)/$(LIBNAME) $(EXMPL_DIR)/$(mod)/$(type)/ && \
ln -sf $(addprefix ../../$(EXMPL_SRC)/$(mod)/$(type)/,$(shell ls -x $(EXMPL_SOURCE)/$(mod)/$(type)/)) $(EXMPL_DIR)/$(mod)/$(type)/ \
)))
$(shell ln -sf $(EXMPL_DEPTH)$(SOURCE_)/$(SRC_NAME).h $(EXMPL_TEMPLT)/$(SRC_NAME)/)
@echo
@echo
@echo Example folders created. Feel free to mess with the code and run make in the directory to build your code
install: all
success: $(BUILD_DIR) $(OBJ) $(LIBNAME)
@echo
@echo
@echo
@echo Cavrn Build Success!
@echo Modules Built: $(MODULES)
@echo Built for the $(DEVICE) Microcontroller
version :
@$(CC) --version
clean:
@echo
$(shell rm -rf $(BUILD_)/ $(addprefix $(EXMPL_DIR)/,$(shell ls -x $(EXMPL_DIR))))
upload:
@echo
$(AVRDUDE)
console:
@echo
$(AVRDUDE)
screen $(PORT) $(BAUD)