diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dd92a393..21e6a7026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Changed `mkversion.sh` - now regenerates version_pm3.c (and consequently the binaries) only when needed (@doegox) - Updated ATR list (@iceman1001) - Changed `mem load -m` - now correctly erase all allocated flash memory (@iceman1001) - Fixed emulator quick dump to handle MFC Ev1 extra sectors (@iceman100) diff --git a/Makefile b/Makefile index 1643881f8..436201bdd 100644 --- a/Makefile +++ b/Makefile @@ -370,10 +370,10 @@ release: # - Tagging temporarily... @git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION) # - Changing default version information based on new tag - @$(SH) tools/mkversion.sh > common/default_version_pm3.c.tmp && $(MV) common/default_version_pm3.c.tmp common/default_version_pm3.c + @$(SH) tools/mkversion.sh common/default_version_pm3.c # - Removing mkversion calls @sed -i 's#^.*\.\./tools/mkversion.sh.*|| #\t$$(Q)#' client/Makefile bootrom/Makefile armsrc/Makefile - @sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt + @sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt client/experimental_lib/CMakeLists.txt # - Deleting tag... @git tag -d $(VERSION) # - Amending commit... diff --git a/armsrc/Makefile b/armsrc/Makefile index c481a6f22..fe34c8a8f 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -181,10 +181,10 @@ showinfo: .DELETE_ON_ERROR: -# version_pm3.c should be remade on every time fullimage.stage1.elf should be remade +# version_pm3.c should be checked on every time fullimage.stage1.elf should be remade version_pm3.c: default_version_pm3.c $(OBJDIR)/fpga_version_info.o $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ) .FORCE - $(info [-] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(CP) $< $@ + $(info [-] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ fpga_version_info.c: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR) $(info [-] GEN $@) diff --git a/bootrom/Makefile b/bootrom/Makefile index cad3e17d1..b6825530d 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -53,10 +53,10 @@ INSTALLFW = $(OBJDIR)/bootrom.elf OBJS = $(OBJDIR)/bootrom.s19 -# version_pm3.c should be remade on every compilation +# version_pm3.c should be checked on every compilation version_pm3.c: default_version_pm3.c .FORCE - $(info [=] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@ + $(info [=] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ all: showinfo $(OBJS) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index be4e00a93..cbbedef73 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -397,7 +397,7 @@ set (TARGET_SOURCES add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c - COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c + COMMAND sh ${PM3_ROOT}/tools/mkversion.sh ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c DEPENDS ${PM3_ROOT}/common/default_version_pm3.c ) diff --git a/client/Makefile b/client/Makefile index e86d8d10e..0444b5932 100644 --- a/client/Makefile +++ b/client/Makefile @@ -918,10 +918,10 @@ src/pm3_pywrap.c: pm3.i .PHONY: all clean install uninstall tarbin .FORCE -# version_pm3.c should be remade on every compilation +# version_pm3.c should be checked on every compilation src/version_pm3.c: default_version_pm3.c .FORCE - $(info [=] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(CP) $< $@ + $(info [=] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ # easy printing of MAKE VARIABLES print-%: ; @echo $* = $($*) diff --git a/client/experimental_lib/CMakeLists.txt b/client/experimental_lib/CMakeLists.txt index cec361446..73ec65aad 100644 --- a/client/experimental_lib/CMakeLists.txt +++ b/client/experimental_lib/CMakeLists.txt @@ -397,7 +397,7 @@ set (TARGET_SOURCES add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c - COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c + COMMAND sh ${PM3_ROOT}/tools/mkversion.sh ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c DEPENDS ${PM3_ROOT}/common/default_version_pm3.c ) diff --git a/tools/mkversion.sh b/tools/mkversion.sh index f741f2980..dd95e0441 100755 --- a/tools/mkversion.sh +++ b/tools/mkversion.sh @@ -1,5 +1,13 @@ #!/usr/bin/env sh +if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "" ]; then + echo "To report a short string about the current version:" + echo " $0 --short" + echo "To regenerate version_pm3.c if needed:" + echo " $0 [--force] [--undecided] path/to/version_pm3.c" + exit 0 +fi + # Output a version_pm3.c file that includes information about the current build # From mkversion.pl # pure sh POSIX as now even on Windows we use WSL or ProxSpace with sh available @@ -13,6 +21,27 @@ if [ "$1" = "--short" ]; then SHORT=true shift fi +FORCE=false +if [ "$1" = "--force" ]; then + FORCE=true + shift +fi +UNDECIDED=false +if [ "$1" = "--undecided" ]; then + UNDECIDED=true + shift +fi +VERSIONSRC="$1" + +if ! $SHORT && [ "$VERSIONSRC" = "" ]; then + echo "Error: $0 is missing its destination filename" + exit 1 +fi + +if $SHORT && [ "$VERSIONSRC" != "" ]; then + echo "Error: can't output a short string and generate file at the same time" + exit 1 +fi # if you are making your own fork, change this line to reflect your fork-name fullgitinfo="Iceman" @@ -27,7 +56,7 @@ if [ "$commandGIT" != "" ]; then # now avoiding the "fatal: No names found, cannot describe anything." error by fallbacking to abbrev hash in such case gitversion=$(git describe --dirty --always) gitbranch=$(git rev-parse --abbrev-ref HEAD) - if [ "$1" != "--undecided" ]; then + if $UNDECIDED; then if [ "$gitversion" != "${gitversion%-dirty}" ]; then clean=0 else @@ -68,7 +97,21 @@ sha=$( if [ "$sha" = "" ]; then sha="no sha256" fi -cat < "${VERSIONSRC}.tmp" <