changeset 619:06d957e2cdce

Port Makefile to Solaris.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 02 Jun 2016 22:48:05 +0300
parents e6675a7afbf1
children 0ddf939eeae3
files Makefile dvcs/Makefile emacs/Makefile hg/Makefile misc/Makefile printarg/Makefile
diffstat 6 files changed, 146 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -20,9 +20,9 @@
   host_os = cygwin
 endif
 
-PROJS := emacs misc printarg dvcs hg pathsearch mc
+PROJS := emacs misc printarg dvcs hg # mc
 ifeq '$(host_os)' 'cygwin'
-  PROJS += win cygwin
+  PROJS += win cygwin pathsearch
 endif
 
 define do-job
--- a/dvcs/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/dvcs/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -19,13 +19,32 @@
   endif
 endif
 
-host_os = unix
-ifneq '' '$(COMSPEC)'
-  host_os = windows
+################################################################
+# Platform definition.
+
+uname-s := $(shell uname -s)
+
+build_os = unix
+ifeq 'SunOS' '$(uname-s)'
+  build_os = solaris
 endif
 
+################################################################
+# Build tools definition.
+
+INSTALL_PROGRAM := install -m 755
+ifeq 'solaris' '$(build_os)'
+  INSTALL_PROGRAM := ginstall -m 755
+endif
+
+################################################################
+# Installation directories.
+
 bindir = $(prefix)/bin
 
+################################################################
+# Build targets.
+
 .PHONY: all
 all:
 
@@ -41,7 +60,7 @@
 	[ -d $(bindir) ] || mkdir -p $(bindir)
 	\
 for f in $(BIN_FILES); do \
-  install -m 755 $$f $(bindir); \
+  $(INSTALL_PROGRAM) $$f $(bindir); \
 done
 
 INSTALLED_FILES := $(patsubst %,$(bindir)/%,$(BIN_FILES))
--- a/emacs/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/emacs/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -14,24 +14,42 @@
 ################################################################
 # Arch definitions.
 
-host_os = unix
-ifneq '' '$(COMSPEC)'
-  host_os = windows
+uname-s := $(shell uname -s)
+
+build_os = unix
+ifneq '' '$(filter MINGW%,$(uname-s))'
+  build_os = mingw
+endif
+ifneq '' '$(filter CYGWIN%,$(uname-s))'
+  build_os = cygwin
+endif
+ifeq 'SunOS' '$(uname-s)'
+  build_os = solaris
 endif
 
 install-win :=
-ifeq 'windows' '$(host_os)'
+ifneq '' '$(filter $(build_os),mingw cygwin)'
   install-win := install-win
 endif
 
 ################################################################
+# Build toolchain definition.
+
+INSTALL_PROGRAM := install -m 755
+INSTALL_DATA := install -m 644
+ifeq 'solaris' '$(build_os)'
+  INSTALL_PROGRAM := ginstall -m 755
+  INSTALL_DATA := ginstall -m 644
+endif
+
+################################################################
 # Path/file definitions.
 
 ifeq '' '$(prefix)'
   ifneq '' '$(HOME)'
     prefix = $(HOME)/usr
   else
-    $(error HOME env var and prefix var are not set!)
+    $(error 'HOME' and 'prefix' are not set!)
   endif
 endif
 
@@ -56,19 +74,19 @@
 
 .PHONY: install-unix
 install-unix: install-init
-	install -m 755 e $(bindir)
+	$(INSTALL_PROGRAM) e $(bindir)
 	ln -s -f $(bindir)/e $(bindir)/ew
 	ln -s -f $(bindir)/e $(bindir)/ec
 	ln -s -f $(bindir)/e $(bindir)/et
 	for file in $(MAN1_FILES); do \
-		install -m 644 $$file $(man1dir); \
+		$(INSTALL_DATA) $$file $(man1dir); \
 	done
 
 .PHONY: install-win
 install-win: install-init
 	\
 for f in $(BIN_FILES); do \
-  install -m 755 e.bat $(bindir)/$$f.bat; \
+  $(INSTALL_PROGRAM) e.bat $(bindir)/$$f.bat; \
 done
 
 .PHONY: install-init
--- a/hg/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/hg/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -11,6 +11,25 @@
 # Default target.
 .DEFAULT_GOAL = all
 
+################################################################
+# Platform definition.
+
+uname-s := $(shell uname -s)
+
+build_os = unix
+ifneq '' '$(filter MINGW%,$(uname-s))'
+  build_os = mingw
+endif
+ifneq '' '$(filter CYGWIN%,$(uname-s))'
+  build_os = cygwin
+endif
+ifeq 'SunOS' '$(uname-s)'
+  build_os = solaris
+endif
+
+################################################################
+# Path definitions.
+
 ifeq '' '$(prefix)'
   ifneq '' '$(HOME)'
     prefix = $(HOME)/usr
@@ -19,16 +38,24 @@
   endif
 endif
 
-host_os = unix
-ifneq '' '$(COMSPEC)'
-  host_os = windows
-endif
-
 bindir = $(prefix)/bin
 mandir = $(prefix)/share/man
 man1dir = $(mandir)/man1
 man5dir = $(mandir)/man5
 
+################################################################
+# Build toolchain definition.
+
+INSTALL_PROGRAM := install -m 755
+INSTALL_DATA := install -m 644
+ifeq 'solaris' '$(build_os)'
+  INSTALL_PROGRAM := ginstall -m 755
+  INSTALL_DATA := ginstall -m 644
+endif
+
+################################################################
+# Build targets.
+
 .PHONY: all
 all:
 
@@ -38,17 +65,17 @@
 .PHONY: install
 install:
 	[ -d $(bindir) ] || mkdir -p $(bindir)
-	install -m 755 hgsyncee $(bindir)
-	install -m 755 hgsyncew $(bindir)
-ifeq 'windows' '$(host_os)'
-	install -m 755 hgsyncee $(bindir)/hgsyncee.sh
-	install -m 755 hgsyncew $(bindir)/hgsyncew.sh
+	$(INSTALL_PROGRAM) hgsyncee $(bindir)
+	$(INSTALL_PROGRAM) hgsyncew $(bindir)
+ifeq 'windows' '$(build_os)'
+	$(INSTALL_PROGRAM) hgsyncee $(bindir)/hgsyncee.sh
+	$(INSTALL_PROGRAM) hgsyncew $(bindir)/hgsyncew.sh
 endif
 	[ -d $(man1dir) ] || mkdir -p $(man1dir)
-	install -m 644 hgsyncee.1 $(man1dir)
-	install -m 644 hgsyncew.1 $(man1dir)
+	$(INSTALL_DATA) hgsyncee.1 $(man1dir)
+	$(INSTALL_DATA) hgsyncew.1 $(man1dir)
 	[ -d $(man5dir) ] || mkdir -p $(man5dir)
-	install -m 644 hgsyncrc.5 $(man5dir)
+	$(INSTALL_DATA) hgsyncrc.5 $(man5dir)
 
 INSTALLED_FILES = $(bindir)/hgsyncee $(bindir)/hgsyncew \
                 $(man1dir)/hgsyncee.1 $(man1dir)/hgsyncew.1 $(man5dir)/hgsyncrc.5
--- a/misc/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/misc/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -11,6 +11,25 @@
 # Default target.
 .DEFAULT_GOAL = all
 
+################################################################
+# Platform definition.
+
+uname-s := $(shell uname -s)
+
+build_os = unix
+ifneq '' '$(filter MINGW%,$(uname-s))'
+  build_os = mingw
+endif
+ifneq '' '$(filter CYGWIN%,$(uname-s))'
+  build_os = cygwin
+endif
+ifeq 'SunOS' '$(uname-s)'
+  build_os = solaris
+endif
+
+################################################################
+# Path definitions.
+
 ifeq '' '$(prefix)'
   ifneq '' '$(HOME)'
     prefix = $(HOME)/usr
@@ -21,8 +40,24 @@
 
 bindir = $(prefix)/bin
 
+################################################################
+# Build toolchain definitions.
+
+INSTALL_PROGRAM := install -m 755
+INSTALL_DATA := install -m 644
+ifeq 'solaris' '$(build_os)'
+  INSTALL_PROGRAM := ginstall -m 755
+  INSTALL_DATA := ginstall -m 644
+endif
+
+################################################################
+# Files definitions.
+
 FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-ascii.sh
 
+################################################################
+# Build targets.
+
 .PHONY: all
 all:
 
@@ -35,7 +70,7 @@
 	for file in $(FILES); do \
 		filenoext=$${file%.sh}; \
 		filenoext=$${filenoext%.py}; \
-		install -m 755 $$file $(bindir)/$$filenoext; \
+		$(INSTALL_PROGRAM) $$file $(bindir)/$$filenoext; \
 	done
 
 .PHONY: uninstall
--- a/printarg/Makefile	Sun May 22 15:30:19 2016 +0300
+++ b/printarg/Makefile	Thu Jun 02 22:48:05 2016 +0300
@@ -52,18 +52,19 @@
 ################################################################
 # Platform definition.
 
+uname-s := $(shell uname -s)
+
 build_os = unix
-ifneq '' '$(COMSPEC)'
-  build_os = windows
+ifneq '' '$(filter MINGW%,$(uname-s))'
+  build_os = mingw
+endif
+ifneq '' '$(filter CYGWIN%,$(uname-s))'
+  build_os = cygwin
+endif
+ifeq 'SunOS' '$(uname-s)'
+  build_os = solaris
 endif
 
-UNAME := $(shell uname -s)
-ifneq '' '$(filter MINGW%,$(UNAME))'
-  build_os_emu = mingw
-endif
-ifneq '' '$(filter CYGWIN%,$(UNAME))'
-  build_os_emu = cygwin
-endif
 ifeq '' '$(host)'
   host_os := $(build_os)
   host_vendor := $(build_vendor)
@@ -85,6 +86,13 @@
 ################################################################
 # Build toolchain definition.
 
+INSTALL_PROGRAM := install -m 755
+INSTALL_DATA := install -m 644
+ifeq 'solaris' '$(build_os)'
+  INSTALL_PROGRAM := ginstall -m 755
+  INSTALL_DATA := ginstall -m 644
+endif
+
 CC := gcc
 STRIP := strip
 ifneq '$(build)' '$(host)'
@@ -142,9 +150,9 @@
 .PHONY: install
 install: ${B}$(APP)
 	mkdir -p $(bindir)
-	install -m 755 ${B}$(APP) $(bindir)
+	$(INSTALL_PROGRAM) ${B}$(APP) $(bindir)
 	mkdir -p $(man1dir)
-	install -m 644 ${S}printarg.1 $(man1dir)
+	$(INSTALL_DATA) -m 644 ${S}printarg.1 $(man1dir)
 
 .PHONY: uninstall
 uninstall: