Updated Makefile: Use LDFLAGS instead of LINKOPTS Use $(DEBUG) var
authorNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 27 Sep 2016 22:14:44 +0000 (00:14 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Fri, 10 Feb 2023 18:02:59 +0000 (19:02 +0100)
Makefile

index e7a33ed..bf83415 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,11 +8,13 @@ ARCH = armv6-m
 
 CROSS_COMPILE ?= arm-none-eabi-
 CC = $(CROSS_COMPILE)gcc
+#DEBUG = -g
+LD_DEBUG = $(DEBUG)
 FOPTS = -fno-builtin -ffunction-sections -fdata-sections -ffreestanding
-CFLAGS = -Wall -g -O2 -mthumb -mcpu=$(CPU) $(FOPTS)
-LINKOPTS = -static -g -nostartfiles -nostdlib \
+CFLAGS = -Wall -O2 $(DEBUG) -mthumb -mcpu=$(CPU) $(FOPTS)
+LDFLAGS = -static $(LD_DEBUG) -nostartfiles -nostdlib -Tlpc_link_$(LPC).ld \
                   -Wl,--gc-sections -Wl,--build-id=none \
-                  -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map -Tlpc_link_$(LPC).ld
+                  -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map
 
 
 APPS = $(subst apps/,,$(wildcard apps/*/*))
@@ -40,7 +42,7 @@ NAME_DEPS = ${NAME_OBJS:%.o=$(OBJDIR)/%.d}
 .PRECIOUS: %.elf
 %.elf: $(OBJS) $(NAME_OBJS)
        @echo "Linking $(MODULE)/$(NAME) ..."
-       @$(CC) $(LINKOPTS) $(OBJS) $(NAME_OBJS) -o $@
+       @$(CC) $(LDFLAGS) $(OBJS) $(NAME_OBJS) -o $@
 
 %.bin: %.elf
        @echo "Creating image : \e[32m$@\e[39m"