Prefer native Windows Emacs, so use it if available.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 22 Dec 2010 14:57:33 +0200
changeset 518 576a7e0fd9e0
parent 517 6889ad2dbd35
child 519 bdc19bd3820f
Prefer native Windows Emacs, so use it if available. This change fix 'install' target for Cygwin if native Windows Emacs not available.
Makefile
--- a/Makefile	Tue Dec 14 15:54:04 2010 +0200
+++ b/Makefile	Wed Dec 22 14:57:33 2010 +0200
@@ -2,6 +2,14 @@
 #
 # You can do anything with this file without any warranty.
 
+################################################################
+# Helper definition.
+
+which = $(firstword $(foreach item,$(subst :, ,$(PATH)),$(wildcard $(item)/$1)))
+
+################################################################
+# Platform/environment definition.
+
 ifeq '' '$(HOME)'
   $(error Home env var not set!)
 endif
@@ -11,13 +19,17 @@
   host_os = windows
 endif
 
-# Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
-# So we run native Emacs to compile sources.
 EMACS = emacs
+# I prefer native Windows Emacs, so use it if available.
 ifeq 'windows' '$(host_os)'
-  EMACS = runemacs
+  ifneq '' '$(call which,runemacs.exe)'
+    EMACS = runemacs
+  endif
 endif
 
+################################################################
+# Targets.
+
 FILES_MODE_EL := $(wildcard *-mode.el)
 
 .PHONY: all