forked from enjrolas/beta-cube-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
42 lines (32 loc) · 1.36 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
LIB_NAME = beta-cube-library
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
BUILD_DIR = $(SELF_DIR)bin/
FIRMWARE_DIR = /Users/japhy/Dropbox/sparkware/firmware/
SRC_DIR = firmware/
EXAMPLE_DIR = $(SRC_DIR)examples/
EXAMPLES = $(wildcard $(EXAMPLE_DIR)*.cpp)
EXAMPLE_BINS = $(addprefix $(BUILD_DIR),$(notdir $(patsubst %.cpp,%.bin,$(EXAMPLES))))
SOURCES = firmware/beta-cube-library.cpp \
firmware/neopixel.cpp \
firmware/SparkWebSocketServer.cpp \
firmware/Base64.cpp
export INCLUDE_DIRS = $$(LIB_CORE_LIBRARIES_PATH)$(LIB_NAME) $$(LIB_CORE_LIBRARIES_PATH)$(LIB_NAME)/$(LIB_NAME)
$(EXAMPLE_BINS): $(BUILD_DIR)%.bin : $(EXAMPLE_DIR)%.cpp $(SOURCES) | $(BUILD_DIR)
$(eval EXAMPLE_NAME=$(notdir $(basename $@)))
-rm -r $(FIRMWARE_DIR)applications/$(EXAMPLE_NAME)
mkdir -p $(FIRMWARE_DIR)applications/$(EXAMPLE_NAME)
cp -r $(EXAMPLE_DIR)$(EXAMPLE_NAME).cpp $(FIRMWARE_DIR)applications/$(EXAMPLE_NAME)
cp $(SRC_DIR)*.cpp $(FIRMWARE_DIR)applications/$(EXAMPLE_NAME)
-rm -r $(FIRMWARE_DIR)libraries/$(LIB_NAME)
mkdir -p $(FIRMWARE_DIR)libraries/$(LIB_NAME)
cp -r $(SRC_DIR) $(FIRMWARE_DIR)libraries/$(LIB_NAME)/$(LIB_NAME)
cd $(FIRMWARE_DIR)build && $(MAKE) APP=$(EXAMPLE_NAME)
cp $(FIRMWARE_DIR)build/applications/$(EXAMPLE_NAME)/$(EXAMPLE_NAME).bin $@
$(BUILD_DIR):
mkdir $(BUILD_DIR)
doc:
doxygen Doxyfile
clean:
-rm $(EXAMPLE_BINS)
rmdir $(BUILD_DIR)
.PHONY: doc