From a02f5e86937820c1ab8f435b9a37ead4afdf6e16 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Feb 2022 10:06:39 +0100 Subject: build: fix make scripts --- Makefile | 70 ++++++++++++++++++---------------------------------------------- 1 file changed, 19 insertions(+), 51 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0b03594..3271857 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Arduino specs -ARDUINO_VERSION = 1.8.4 -ARDUINO_VERSION_SHORT = $(shell sed "s/\.//g" <<< $(ARDUINO_VERSION)) +ARDUINO_VERSION = 184 BOARD_TAG = leonardo ARCHITECTURE = avr ARDUINO_ARCH_FLAG = -DARDUINO_ARCH_AVR ARDMK_VENDOR = arduino +ARDUINO_PORT=/dev/ttyACM0 MONITOR_BAUDRATE = 9600 OPTIMIZATION_LEVEL=s DEBUG_FLAGS = -O0 -g @@ -13,64 +13,32 @@ MCU_FLAG_NAME = mmcu # Flags LOG_MONITOR = 0 +# Functions +rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) + +ARDUINO_VERSION_FULL = 1.8.4 + # Paths -MONITOR_LOG_FILE = monitor.log -ARDUINO_DIR = $(HOME).arduino15/packages/arduino +ARDUINO_DIR = $(HOME)/.arduino15/packages/arduino +BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION_FULL)/boards.txt +ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION_FULL)/cores/arduino +ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION_FULL)/libraries +ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION_FULL)/variants + +#ARDUINO_DIR = C:/Arduino ARDMK_DIR = make-scripts -AVRDUDE_CONF = /etc/avrdude.conf -ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION)/variants -BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION)/boards.txt -ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries -TOOLS_PATH = $(ARDUINO_DIR)/tools/avr-gcc/$(shell /bin/ls --color=never -1 $(ARDUINO_DIR)/tools/avr-gcc/ | sort -r | xargs | awk '{print $$1}')/bin -PROJ_LIBS_PATH = libraries -BOOTLOADER_PARENT = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION)/bootloaders -BUNDLED_AVR_TOOLS_DIR := $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr) -ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARCHITECTURE)/$(ARDUINO_VERSION)/libraries -PRE_BUILD_HOOK = pre-build-hook.sh +# AVRDUDE_CONF = /etc/avrdude.conf OBJDIR = build -LOCAL_SRCS ?= $(wildcard src/*.cpp) -LOCAL_OBJ_FILES = $(LOCAL_SRCS:.cpp=.cpp.o) -LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES)) -ARDUINO_HEADER=Arduino.h -TAGS_FILE = tags -ARD_RESET_ARDUINO_PATH = tools/reset_leonardo.py +#LOCAL_SRCS = $(wildcard src/*.cpp) +LOCAL_CPP_SRCS = $(call rwildcard,src/,*.cpp) +# LOCAL_OBJ_FILES = $(LOCAL_SRCS:.cpp=.cpp.o) # Libraries ARDUINO_LIBS = Wire -# Tools -TOOL_PREFIX = avr -CC_NAME := $(TOOL_PREFIX)-gcc -CXX_NAME := $(TOOL_PREFIX)-g++ -AS_NAME := $(TOOL_PREFIX)-as -OBJCOPY_NAME := $(TOOL_PREFIX)-objcopy -OBJDUMP_NAME := $(TOOL_PREFIX)-objdump -AR_NAME := $(TOOL_PREFIX)-ar -SIZE_NAME := $(TOOL_PREFIX)-size -NM_NAME := $(TOOL_PREFIX)-nm - -CC = $(TOOLS_PATH)/$(CC_NAME) -CXX = $(TOOLS_PATH)/$(CXX_NAME) -AS = $(TOOLS_PATH)/$(AS_NAME) -OBJCOPY = $(TOOLS_PATH)/$(OBJCOPY_NAME) -OBJDUMP = $(TOOLS_PATH)/$(OBJDUMP_NAME) -AR = $(TOOLS_PATH)/$(AR_NAME) -SIZE = $(TOOLS_PATH)/$(SIZE_NAME) -NM = $(TOOLS_PATH)/$(NM_NAME) - -REMOVE = rm -rf -MV = mv -f -CAT = cat -ECHO = printf -MKDIR = mkdir -p - -MONITOR_CMD = screen - -CTAGS_EXEC = ctags - # Target space := space += -TARGET = $(notdir $(subst $(space),_,$(CURDIR))) +TARGET = Gyronardo include $(ARDMK_DIR)/Arduino.mk -- cgit v1.2.3-18-g5258