From d9759987862f5ff01de2b7f080fbb431039b621b Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Mon, 28 Jul 2014 10:56:15 +0200 Subject: [PATCH] Split build rule in two parts : linking and binary image creation. --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ad75333..872c5c6 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ LINKOPTS = -static -nostartfiles -Wl,--gc-sections -Wl,--build-id=none \ .PHONY: all -all: $(NAME) +all: $(NAME).bin prog: CFLAGS += -DEEPROM_WRITE prog: clean all @@ -26,13 +26,15 @@ OBJDIR = objs SRC = $(shell find . -name \*.c) OBJS = ${SRC:%.c=${OBJDIR}/%.o} +$(NAME).bin: $(NAME) + @echo "Creating image : $@" + @$(CROSS_COMPILE)objcopy -R .stack -R .bss -O binary $^ $@ + @ls -l $@ + @echo Done. + $(NAME): $(OBJS) @echo "Linking ..." @$(CC) $(CFLAGS) $(LINKOPTS) $(OBJS) -o $@ -I$(INCLUDES) - @echo "Creating image : $@.bin" - @$(CROSS_COMPILE)objcopy -R .stack -R .bss -O binary $@ $@.bin - @ls -l $@.bin - @echo Done. ${OBJDIR}/%.o: %.c @mkdir -p $(dir $@) -- 2.43.0