Makefile: Build file names with version suffix
This commit is contained in:
parent
3a339ee80b
commit
bf11a41c88
|
@ -1,9 +1,10 @@
|
||||||
##
|
##
|
||||||
## This file is part of the libopencm3 project.
|
## The original file was part of the libopencm3 project.
|
||||||
##
|
##
|
||||||
## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
|
## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
|
||||||
## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
||||||
## Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
|
## Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
|
||||||
|
## Copyright (C) 2021 Harald Welte <laforge@gnumonks.org>
|
||||||
##
|
##
|
||||||
## This library is free software: you can redistribute it and/or modify
|
## This library is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU Lesser General Public License as published by
|
## it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
@ -19,6 +20,8 @@
|
||||||
## along with this library. If not, see <http://www.gnu.org/licenses/>.
|
## along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
GIT_VERSION=$(shell git describe --tags --dirty)
|
||||||
|
|
||||||
# Be silent per default, but 'make V=1' will show all compiler calls.
|
# Be silent per default, but 'make V=1' will show all compiler calls.
|
||||||
ifneq ($(V),1)
|
ifneq ($(V),1)
|
||||||
Q := @
|
Q := @
|
||||||
|
@ -145,6 +148,9 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
|
BINARY_VER = $(BINARY)-$(GIT_VERSION)
|
||||||
|
|
||||||
|
|
||||||
all: elf
|
all: elf
|
||||||
|
|
||||||
elf: $(BINARY).elf
|
elf: $(BINARY).elf
|
||||||
|
@ -152,10 +158,10 @@ bin: $(BINARY).bin
|
||||||
hex: $(BINARY).hex
|
hex: $(BINARY).hex
|
||||||
srec: $(BINARY).srec
|
srec: $(BINARY).srec
|
||||||
list: $(BINARY).list
|
list: $(BINARY).list
|
||||||
GENERATED_BINARIES=$(BINARY).elf $(BINARY).bin $(BINARY).hex $(BINARY).srec $(BINARY).list $(BINARY).map
|
GENERATED_BINARIES=$(BINARY_VER).elf $(BINARY_VER).bin $(BINARY_VER).hex $(BINARY_VER).srec $(BINARY_VER).list $(BINARY_VER).map
|
||||||
|
|
||||||
images: $(BINARY).images
|
images: $(BINARY_VER).images
|
||||||
flash: $(BINARY).flash
|
flash: $(BINARY_VER).flash
|
||||||
|
|
||||||
# Either verify the user provided LDSCRIPT exists, or generate it.
|
# Either verify the user provided LDSCRIPT exists, or generate it.
|
||||||
ifeq ($(strip $(DEVICE)),)
|
ifeq ($(strip $(DEVICE)),)
|
||||||
|
@ -173,6 +179,20 @@ ifeq (,$(wildcard $@))
|
||||||
$(MAKE) -C $(OPENCM3_DIR)
|
$(MAKE) -C $(OPENCM3_DIR)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
.PHONY: $(BINARY).elf $(BINARY).bin $(BINARY).hex $(BINARY).srec $(BINARY).list $(BINARY).map
|
||||||
|
$(BINARY).elf: $(BINARY_VER).elf $(BINARY).map
|
||||||
|
ln -sf $< $@
|
||||||
|
$(BINARY).bin: $(BINARY_VER).bin
|
||||||
|
ln -sf $^ $@
|
||||||
|
$(BINARY).hex: $(BINARY_VER).hex
|
||||||
|
ln -sf $^ $@
|
||||||
|
$(BINARY).srec: $(BINARY_VER).srec
|
||||||
|
ln -sf $^ $@
|
||||||
|
$(BINARY).list: $(BINARY_VER).list
|
||||||
|
ln -sf $^ $@
|
||||||
|
$(BINARY).map: $(BINARY_VER).map
|
||||||
|
ln -sf $^ $@
|
||||||
|
|
||||||
# Define a helper macro for debugging make errors online
|
# Define a helper macro for debugging make errors online
|
||||||
# you can type "make print-OPENCM3_DIR" and it will show you
|
# you can type "make print-OPENCM3_DIR" and it will show you
|
||||||
# how that ended up being resolved by all of the included
|
# how that ended up being resolved by all of the included
|
||||||
|
@ -218,6 +238,8 @@ print-%:
|
||||||
clean:
|
clean:
|
||||||
@printf " CLEAN\n"
|
@printf " CLEAN\n"
|
||||||
$(Q)$(RM) $(GENERATED_BINARIES) generated.* $(OBJS) $(OBJS:%.o=%.d)
|
$(Q)$(RM) $(GENERATED_BINARIES) generated.* $(OBJS) $(OBJS:%.o=%.d)
|
||||||
|
$(Q)$(RM) $(BINARY)-*.{elf,bin,hex,srec,list,map}
|
||||||
|
$(Q)$(RM) $(BINARY).{elf,bin,hex,srec,list,map}
|
||||||
|
|
||||||
stylecheck: $(STYLECHECKFILES:=.stylecheck)
|
stylecheck: $(STYLECHECKFILES:=.stylecheck)
|
||||||
styleclean: $(STYLECHECKFILES:=.styleclean)
|
styleclean: $(STYLECHECKFILES:=.styleclean)
|
||||||
|
|
Loading…
Reference in New Issue