diff options
author | Evan Lloyd <evan.lloyd@arm.com> | 2015-12-03 12:58:52 +0000 |
---|---|---|
committer | Evan Lloyd <evan.lloyd@arm.com> | 2016-04-01 12:33:09 +0100 |
commit | 414ab8530dbd669e632dc09abb84eed88e8ebdb7 (patch) | |
tree | 15e41431e94bcdf0552a15b5e611284051e833ce | |
parent | 51b27702e48ba2ee806ba1ea0b007f11c499c3e2 (diff) |
Make:Improve version string generation portability
To get round problems encountered when building in a DOS build
environment the generation of the .o file containing build identifier
strings is modified.
The problems encounterred were:
1. DOS echo doesn't strip ' characters from the output text.
2. git is not available from CMD.EXE so the BUILD_STRING value needs
some other origin.
A BUILD_STRING value of "development build" is used for now.
MAKE_BUILD_STRINGS is used to customise build string generation in a DOS
environment. This variable is not defined in the UNIX build environment
make file helper, and so the existing build string generation behaviour
is retained in these build environments.
NOTE: This commit completes a cumulative series aimed at improving
build portability across development environments.
This enables the build to run on several new build environments,
if the relevant tools are available.
At this point the build is tested on Windows 7 Enterprise SP1,
using CMD.EXE, Cygwin and Msys (MinGW),as well as a native
Linux envionment". The Windows platform builds used
aarch64-none-elf-gcc.exe 4.9.1. CMD.EXE and Msys used Gnu
Make 3.81, cygwin used Gnu Make 4.1.
CAVEAT: The cert_create tool build is not tested on the Windows
platforms (openssl-for-windows has a GPL license).
Change-Id: Iaa4fc89dbe2a9ebae87e2600c9eef10a6af30251
-rw-r--r-- | docs/user-guide.md | 3 | ||||
-rw-r--r-- | make_helpers/build_macros.mk | 4 | ||||
-rw-r--r-- | make_helpers/windows.mk | 16 |
3 files changed, 23 insertions, 0 deletions
diff --git a/docs/user-guide.md b/docs/user-guide.md index 37e20346..8d7376d4 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -42,6 +42,9 @@ The software has been tested on Ubuntu 14.04 LTS (64-bit). Packages used for building the software were installed from that distribution unless otherwise specified. +The software has also been built on Windows 7 Enterprise SP1, using CMD.EXE, +Cygwin, and Msys (MinGW) shells, using version 4.9.1 of the GNU toolchain. + 3. Tools --------- diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index f82ba534..5171ff00 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -346,9 +346,13 @@ $(eval $(call MAKE_LD,$(LINKERFILE),$(BL_LINKERFILE))) $(ELF): $(OBJS) $(LINKERFILE) | bl$(1)_dirs @echo " LD $$@" +ifdef MAKE_BUILD_STRINGS + $(call MAKE_BUILD_STRINGS, $(BUILD_DIR)/build_message.o) +else @echo 'const char build_message[] = "Built : "$(BUILD_MESSAGE_TIMESTAMP); \ const char version_string[] = "${VERSION_STRING}";' | \ $$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o +endif $$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \ $(BUILD_DIR)/build_message.o $(OBJS) diff --git a/make_helpers/windows.mk b/make_helpers/windows.mk index 394df3a0..8ac82460 100644 --- a/make_helpers/windows.mk +++ b/make_helpers/windows.mk @@ -91,3 +91,19 @@ ${1} : ${2} endif +# Because git is not available from CMD.EXE, we need to avoid +# the BUILD_STRING generation which uses git. +# For now we use "development build". +# This can be overridden from the command line or environment. +BUILD_STRING ?= development build + +# The DOS echo shell command does not strip ' characters from the command +# parameters before printing. We therefore use an alternative method invoked +# by defining the MAKE_BUILD_STRINGS macro. +BUILT_TIME_DATE_STRING = const char build_message[] = "Built : "${BUILD_MESSAGE_TIMESTAMP}; +VERSION_STRING_MESSAGE = const char version_string[] = "${VERSION_STRING}"; +define MAKE_BUILD_STRINGS + @echo $$(BUILT_TIME_DATE_STRING) $$(VERSION_STRING_MESSAGE) | \ + $$(CC) $$(CFLAGS) -x c - -o $1 +endef + |