From: Nathael Pajani Date: Mon, 28 Jul 2014 08:56:15 +0000 (+0200) Subject: Split build rule in two parts : linking and binary image creation. X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=d9759987862f5ff01de2b7f080fbb431039b621b;p=soft%2Flpc122x%2Fcore Split build rule in two parts : linking and binary image creation. --- 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 $@)