From 1065e04c4a2ddab1dfccd8edd7be67da06bceb9f Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Fri, 9 Dec 2022 08:49:52 -0600 Subject: [PATCH] Makefile --- Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f386d98 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +OBJECTS=blink.o +MAP=blink.map +MAKEFILE=Makefile + +ifeq ($(OS),Windows_NT) + ifeq ($(shell uname -o),Cygwin) + RM= rm -rf + else + RM= del /q + endif +else + RM= rm -rf +endif + +GCC_DIR = $(abspath $(dir $(lastword $(MAKEFILE)))/../../bin) +SUPPORT_FILE_DIRECTORY = $(abspath $(dir $(lastword $(MAKEFILE)))/../../include) + +# Please set your device here +DEVICE = MSP430F5529 +CC = $(GCC_DIR)/msp430-elf-gcc +GDB = $(GCC_DIR)/msp430-elf-gdb + +CFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -mmcu=$(DEVICE) -Og -Wall -g +LFLAGS = -L $(SUPPORT_FILE_DIRECTORY) -Wl,-Map,$(MAP),--gc-sections + +all: ${OBJECTS} + $(CC) $(CFLAGS) $(LFLAGS) $? -o $(DEVICE).out + +clean: + $(RM) $(OBJECTS) + $(RM) $(MAP) + $(RM) *.out + +debug: all + $(GDB) $(DEVICE).out