1#ident "@(#)mk-gmake.id	1.25 18/04/15 "
2###########################################################################
3# Written 1996-2018 by J. Schilling
4###########################################################################
5#
6# Name of make program (make/gmake/smake)
7#
8###########################################################################
9# Copyright (c) J. Schilling
10###########################################################################
11# The contents of this file are subject to the terms of the
12# Common Development and Distribution License, Version 1.0 only
13# (the "License").  You may not use this file except in compliance
14# with the License.
15#
16# See the file CDDL.Schily.txt in this distribution for details.
17# A copy of the CDDL is also available via the Internet at
18# http://www.opensource.org/licenses/cddl1.txt
19#
20# When distributing Covered Code, include this CDDL HEADER in each
21# file and include the License file CDDL.Schily.txt from this distribution.
22###########################################################################
23
24_GETENV=	$(_UNIQ)$(ARCH_DONE)
25__GETENV=	$(_GETENV:$(_UNIQ)=rules.oev)
26___GETENV=	$(__GETENV:$(_UNIQ)TRUE=rules.nul)
27GET_ENV=	$(___GETENV:$(_UNIQ)%=%)
28
29include		$(SRCROOT)/$(RULESDIR)/$(GET_ENV)
30
31_SETENV=	$(_UNIQ)$(SETENV)
32__SETENV=	$(_SETENV:$(_UNIQ)=rules.env)
33___SETENV=	$(__SETENV:$(_UNIQ)none=rules.nul)
34SET_ENV=	$(___SETENV:$(_UNIQ)%=%)
35
36include		$(SRCROOT)/$(RULESDIR)/$(SET_ENV)
37
38MAKEPROG=	gmake
39.SHELLFLAGS=	-ce	# switch gmake-3.82 ff. to POSIX behavior
40WAIT=			# gmake is unable to wait for parallel targets
41
42SPACE=		$(_UNIQ:$(_UNIQ)%= )
43PRE_NUMBER=	pre\#
44NUMBER_SIGN=	$(PRE_NUMBER:pre%=%)
45
46###########################################################################
47#
48# standard (automatic) machine identification
49#
50###########################################################################
51#
52# XP_ARCH = uname -p	= mach	  # Processor (sparc/mc68020)
53# XK_ARCH = uname -m	= arch -k # Kernel (sun3/sun4c/sun4m)
54# XM_ARCH = arch	~ arch -k # Machine (sun3/sun4)
55#
56###########################################################################
57#
58# Due to a bug in /usr/xpg*/bin/tr on Solaris, we cannot directly translit
59# many different chars to '-' using e.g. tr ', /\\()"' ',------'
60# This is why we first tranliterate everything to '/ and later to '-'
61#
62# Due to a bug in *BSDs sed, we cannot use sed 'y%ABC\\%abc-%'
63#
64###########################################################################
65
66ifndef		ARCH_DONE
67
68ifndef		GMAKE_NOWARN
69__gmake_warn:=	$(shell cat $(SRCROOT)/$(RULESDIR)/gmake.wrn 1>&2; sleep 2)
70endif
71
72_MACHCMD=	(mach || uname -p || true)	2> /dev/null
73_ARCHCMD=	(arch || /usr/ucb/arch || true)	2> /dev/null
74
75XP_ARCH:=	$(shell $(_MACHCMD) | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
76XK_ARCH:=	$(shell uname -m    | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
77XM_ARCH:=	$(shell $(_ARCHCMD) | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
78
79P_ARCH=		$(XP_ARCH)
80K_ARCH=		$(XK_ARCH)
81M_ARCH=		$(XM_ARCH)
82
83_XP_ARCH=	$(XP_ARCH:unknown=$(K_ARCH))
84
85_P_ARCH=	$(_UNIQ)$(_XP_ARCH)
86__P_ARCH=	$(_P_ARCH:$(_UNIQ)=$(K_ARCH))
87P_ARCH=		$(__P_ARCH:$(_UNIQ)%=%)
88
89_M_ARCH=	$(_UNIQ)$(XM_ARCH)
90__M_ARCH=	$(_M_ARCH:$(_UNIQ)=$(K_ARCH))
91M_ARCH=		$(__M_ARCH:$(_UNIQ)%=%)
92
93OSNAME:=	$(shell uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
94OSREL:=		$(shell uname -r | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
95OSVERSION:=	$(shell uname -v | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"' 'abcdefghijklmnopqrstuvwxyz,//////' | tr ',/' ',\-')
96
97ARCH_DONE=	TRUE
98
99export		XP_ARCH
100export		K_ARCH
101export		XM_ARCH
102export		P_ARCH
103export		M_ARCH
104export		OSNAME
105export		OSREL
106export		OSVERSION
107export		ARCH_DONE
108
109endif
110