summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules9
-rw-r--r--common/version.c1
-rwxr-xr-xutil/getdate.sh12
-rwxr-xr-xutil/getversion.sh14
4 files changed, 9 insertions, 27 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 3c51caafd8..65500f317b 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -60,7 +60,6 @@ cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d -o $@ \
cmd_cxx_to_host = $(HOSTCXX) -std=c++0x $(COMMON_WARN) \
-I ./$($(notdir $@)_ROOT) -o $@ $(filter %.cc,$^) $($(notdir $@)_LIBS)
cmd_host_test = ./util/run_host_test $* $(silent)
-cmd_date = $(if $(USE_GIT_DATE),cat /dev/null,./util/getdate.sh) > $@
cmd_version = ./util/getversion.sh > $@
cmd_mv_from_tmp = mv $(out)/$*.bin.tmp $(out)/$*.bin
cmd_extractrw-y = dd if=$(out)/$(PROJECT).bin.tmp of=$(out)/$(PROJECT).RW.bin \
@@ -260,7 +259,7 @@ ifneq ($(old_version_hash),$(new_version_hash))
endif
# All of the objects have an order only dependency on the ec_version header.
-# This ensures that if ec_version.h needs to be build (because it was marked
+# This ensures that if ec_version.h needs to be built (because it was marked
# PHONY above) then it will be rebuilt before any objects. This is important
# because some source files will include ec_version.h and fail to compile if
# it doesn't already exist. This dependency shouldn't be a normal dependency
@@ -275,12 +274,6 @@ $(sharedlib-objs): | $(out)/ec_version.h
$(out)/ec_version.h:
$(call quiet,version,VERSION)
-$(out)/RO/common/version.o: $(out)/ec_date.h
-$(out)/RW/common/version.o: $(out)/ec_date.h
-
-$(out)/ec_date.h: $(filter-out $(out)/%/common/version.o,$(ro-objs) $(rw-objs))
- $(call quiet,date,DATE )
-
$(out)/gen_pub_key.h: $(PEM)
$(call quiet,pubkey,PUBKEY )
diff --git a/common/version.c b/common/version.c
index 331f155571..3757c9d5b4 100644
--- a/common/version.c
+++ b/common/version.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include "common.h"
-#include "ec_date.h"
#include "ec_version.h"
#include "version.h"
diff --git a/util/getdate.sh b/util/getdate.sh
deleted file mode 100755
index 8099b398e8..0000000000
--- a/util/getdate.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Generate build date information for the EC binary
-
-echo "/* This file is generated by util/getdate.sh */"
-
-echo "/* DATE is used to form build info string in common/version.c. */"
-echo "#define DATE \"$(date '+%F %T')\""
diff --git a/util/getversion.sh b/util/getversion.sh
index da31eb9428..8b32307a49 100755
--- a/util/getversion.sh
+++ b/util/getversion.sh
@@ -37,8 +37,6 @@ fi
ver="${BOARD}_${vbase}"
-gitdate=$(git log -1 --format='%ai' HEAD | cut -d ' ' -f '1 2')
-
echo "/* This file is generated by util/getversion.sh */"
echo "/* Version string for use by common/version.c */"
@@ -56,7 +54,11 @@ echo " * in common/version.c. */"
echo "#define VERSION \"${ver}\""
echo "#define BUILDER \"${USER}@`hostname`\""
-echo "/* Author date of last commit, in case compile-time is not used. */"
-echo "#ifndef DATE"
-echo "#define DATE \"${gitdate}\""
-echo "#endif"
+if [ -n "$dirty" ]; then
+ echo "/* Repo is dirty, using time of last compilation */"
+ echo "#define DATE \"$(date '+%F %T')\""
+else
+ echo "/* Repo is clean, use the author date of the last commit */"
+ gitdate=$(git log -1 --format='%ai' HEAD | cut -d ' ' -f '1 2')
+ echo "#define DATE \"${gitdate}\""
+fi