summaryrefslogtreecommitdiff
path: root/include.mk
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-07-01 00:38:25 +0200
committerChristian Pointner <equinox@spreadspace.org>2015-07-01 00:38:25 +0200
commitc1c5b5b8a904854153e62dad40ead8532bd6d391 (patch)
tree7337c1a2240b82da74578047e5f678fc54084180 /include.mk
parentstarted import of FastLED (diff)
added initial support for FastLED library
Diffstat (limited to 'include.mk')
-rw-r--r--include.mk54
1 files changed, 50 insertions, 4 deletions
diff --git a/include.mk b/include.mk
index 28eeaaa..3da4dd9 100644
--- a/include.mk
+++ b/include.mk
@@ -34,8 +34,11 @@ CXX_DEP := $(CXX_SRC:%.cpp=%.d)
OBJ_LIB := $(LIBS:%=lib-%.o)
SRC_LIB := $(LIBS:%=$(LIB_DIR)/%.c)
DEP_LIB := $(LIBS:%=lib-%.d)
+CXX_OBJ_LIB := $(CXX_LIBS:%=lib-%.o)
+CXX_SRC_LIB := $(CXX_LIBS:%=$(LIB_DIR)/%.cpp)
+CXX_DEP_LIB := $(CXX_LIBS:%=lib-%.d)
-.PHONY: prepare clean clean-external distclean clean-lufa program erase flash reset run
+.PHONY: prepare clean clean-external distclean clean-lufa clean-fastled program erase flash reset run
ELFFILE := $(NAME).elf
HEXFILE := $(NAME).hex
@@ -53,23 +56,55 @@ CFLAGS += -DBOARD=BOARD_$(LUFA_BOARD)
CFLAGS += $(LUFA_OPTS)
endif
+ifdef FASTLED_PATH
+CXXFLAGS += -I$(FASTLED_PATH)
+CXXFLAGS += -DARDUINO
+CXXFLAGS += $(FASTLED_OPTS)
+endif
+
prepare: $(EXTERNAL_LIBS:%=build-%)
clean-external: $(EXTERNAL_LIBS:%=clean-%)
export
+
build-lufa: liblufa.a
liblufa.a: Makefile
- @echo "building external LUFA lib ($(LUFA_PATH))"
+ @echo ""
+ @echo "****************************************************"
+ @echo "* building external LUFA lib ($(LUFA_PATH))"
+ @echo ""
make -f $(SPREADAVR_PATH)/lufa.mk liblufa.a
make -f $(SPREADAVR_PATH)/lufa.mk clean
clean-lufa:
+ @echo ""
+ @echo "****************************************************"
@echo "cleaning external LUFA lib ($(LUFA_PATH))"
+ @echo ""
make -f $(SPREADAVR_PATH)/lufa.mk clean
rm -f liblufa.a
+build-fastled: libfastled.a
+
+libfastled.a: Makefile
+ @echo ""
+ @echo "****************************************************"
+ @echo "building external FastLED lib ($(FASTLED_PATH))"
+ @echo ""
+ make -f $(SPREADAVR_PATH)/fastled.mk libfastled.a
+ make -f $(SPREADAVR_PATH)/fastled.mk clean
+
+clean-fastled:
+ @echo ""
+ @echo "****************************************************"
+ @echo "cleaning external FastLED lib ($(FASTLED_PATH))"
+ @echo ""
+ make -f $(SPREADAVR_PATH)/fastled.mk clean
+ rm -f libfastled.a
+
+
## project-specific objects
%.d: %.c Makefile
@set -e; rm -f $@; \
@@ -89,10 +124,18 @@ lib-%.d: $(LIB_DIR)/%.c Makefile
sed 's,\($*\)\.o[ :]*,lib-\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$; echo '(re)building $@'
+lib-%.d: $(LIB_DIR)/%.cpp Makefile
+ @set -e; rm -f $@; \
+ $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,lib-\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$; echo '(re)building $@'
+
+
ifneq ($(MAKECMDGOALS),distclean)
-include $(DEP)
-include $(CXX_DEP)
-include $(DEP_LIB)
+-include $(CXX_DEP_LIB)
endif
%.o: %.c Makefile
@@ -104,8 +147,11 @@ endif
lib-%.o: $(LIB_DIR)/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
-$(ELFFILE): $(OBJ) $(CXX_OBJ) $(OBJ_LIB) $(EXTERNAL_LIBS:%=lib%.a)
- $(CC) $(LDFLAGS) $(OBJ) $(CXX_OBJ) $(OBJ_LIB) $(EXTERNAL_LIBS:%=-l%) -o $@
+lib-%.o: $(LIB_DIR)/%.cpp Makefile
+ $(CXX) $(CFLAGS) -c $< -o $@
+
+$(ELFFILE): $(OBJ) $(CXX_OBJ) $(OBJ_LIB) $(CXX_OBJ_LIB) $(EXTERNAL_LIBS:%=lib%.a)
+ $(CC) $(LDFLAGS) $(OBJ) $(CXX_OBJ) $(OBJ_LIB) $(CXX_OBJ_LIB) $(EXTERNAL_LIBS:%=-l%) -o $@
$(SIZE) $@
@echo ""