diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 15 | ||||
-rw-r--r-- | src/SConscript | 22 | ||||
-rw-r--r-- | src/mesa/Android.libmesa_git_sha1.mk | 4 |
3 files changed, 12 insertions, 29 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5ef2d4f55ea..1de4fca6a12 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,17 +19,10 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -.PHONY: git_sha1.h.tmp -git_sha1.h.tmp: - @$(PYTHON2) $(top_srcdir)/bin/git_sha1_gen.py > $@ - -git_sha1.h: git_sha1.h.tmp - @echo "updating git_sha1.h" - @if ! cmp -s git_sha1.h.tmp git_sha1.h; then \ - mv git_sha1.h.tmp git_sha1.h ;\ - else \ - rm git_sha1.h.tmp ;\ - fi +.PHONY: git_sha1.h +git_sha1.h: $(top_srcdir)/src/git_sha1.h.in + @echo "updating $@" + @$(PYTHON2) $(top_srcdir)/bin/git_sha1_gen.py --output $@ BUILT_SOURCES = git_sha1.h CLEANFILES = $(BUILT_SOURCES) diff --git a/src/SConscript b/src/SConscript index a277e8b7925..95ea061c4bb 100644 --- a/src/SConscript +++ b/src/SConscript @@ -24,22 +24,12 @@ def write_git_sha1_h_file(filename): to retrieve the git hashid and write the header file. An empty file will be created if anything goes wrong.""" - tempfile = "git_sha1.h.tmp" - with open(tempfile, "w") as f: - args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py' ] - try: - subprocess.Popen(args, stdout=f).wait() - except: - print("Warning: exception in write_git_sha1_h_file()") - return - - if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename): - # The filename does not exist or it's different from the new file, - # so replace old file with new. - if os.path.exists(filename): - os.remove(filename) - os.rename(tempfile, filename) - return + args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py', '--output', filename ] + try: + subprocess.call(args) + except: + print("Warning: exception in write_git_sha1_h_file()") + return # Create the git_sha1.h header file diff --git a/src/mesa/Android.libmesa_git_sha1.mk b/src/mesa/Android.libmesa_git_sha1.mk index ddb30c428af..d27923074dd 100644 --- a/src/mesa/Android.libmesa_git_sha1.mk +++ b/src/mesa/Android.libmesa_git_sha1.mk @@ -43,10 +43,10 @@ $(intermediates)/dummy.c: LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, git_sha1.h) -$(intermediates)/git_sha1.h: $(wildcard $(MESA_TOP)/.git/logs/HEAD) +$(intermediates)/git_sha1.h: $(MESA_TOP)/src/git_sha1.h.in $(wildcard $(MESA_TOP)/.git/logs/HEAD) @mkdir -p $(dir $@) @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git" - $(hide) $(MESA_PYTHON2) $(MESA_TOP)/bin/git_sha1_gen.py > $@ + $(hide) $(MESA_PYTHON2) $(MESA_TOP)/bin/git_sha1_gen.py --output $@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates) |