1# Time-stamp: <07/08/16 09:13:19 ptr>
2#
3# Copyright (c) 1997-1999, 2002, 2003, 2005-2007
4# Petr Ovtchenkov
5#
6# Portion Copyright (c) 1999-2001
7# Parallel Graphics Ltd.
8#
9# Licensed under the Academic Free License version 3.0
10#
11
12ifndef BUILD_DATE
13
14ifndef TARGET_OS
15OSNAME := $(shell uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
16
17ifeq ($(OSNAME),darwin)
18OSREALNAME := $(shell sw_vers -productName | tr '[A-Z]' '[a-z]' | tr -d ', /\\()"')
19endif
20
21# RedHat use nonstandard options for uname at least in cygwin,
22# macro should be overwritten:
23ifeq (cygwin,$(findstring cygwin,$(OSNAME)))
24OSNAME    := cygming
25OSREALNAME := $(shell uname -o | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
26endif
27
28ifeq (mingw,$(findstring mingw,$(OSNAME)))
29OSNAME    := cygming
30OSREALNAME := mingw
31endif
32
33OSREL  := $(shell uname -r | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
34ifeq ($(OSNAME),darwin)
35OSREL  := $(shell sw_vers -productVersion | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
36endif
37M_ARCH := $(shell uname -m | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
38ifeq ($(M_ARCH),power-macintosh)
39M_ARCH := ppc
40endif
41ifeq ($(OSNAME),hp-ux)
42P_ARCH := unknown
43else
44P_ARCH := $(shell uname -p | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
45endif
46
47else
48OSNAME := $(shell echo ${TARGET_OS} | sed 's/^[a-z0-9_]\+-[a-z0-9]\+-\([a-z]\+\).*/\1/' | sed 's/^[a-z0-9_]\+-\([a-z]\+\).*/\1/' )
49OSREL  := $(shell echo ${TARGET_OS} | sed 's/^[[:alnum:]_]\+-[a-z0-9]\+-[a-z]\+\([a-zA-Z.0-9]*\).*/\1/' | sed 's/^[a-z0-9_]\+-[a-z]\+\([a-zA-Z.0-9]*\).*/\1/' )
50M_ARCH := $(shell echo ${TARGET_OS} | sed 's/^\([a-z0-9_]\+\)-.*/\1/' )
51P_ARCH := unknown
52# TARGET_OS
53endif
54
55NODENAME := $(shell uname -n | tr '[A-Z]' '[a-z]' )
56SYSVER := $(shell uname -v )
57USER := $(shell echo $$USER )
58
59ifeq ($(OSNAME),freebsd)
60OSREL_MAJOR := $(shell echo ${OSREL} | tr '.-' ' ' | awk '{print $$1;}')
61OSREL_MINOR := $(shell echo ${OSREL} | tr '.-' ' ' | awk '{print $$2;}')
62endif
63
64ifeq ($(OSNAME),darwin)
65OSREL_MAJOR := $(shell echo ${OSREL} | tr '.-' ' ' | awk '{print $$1;}')
66OSREL_MINOR := $(shell echo ${OSREL} | tr '.-' ' ' | awk '{print $$2;}')
67MACOSX_TEN_FIVE := $(shell if [ ${OSREL_MAJOR} -lt 10 ]; then echo false; else if [ ${OSREL_MAJOR} -gt 10 ] ; then echo true; else if [ ${OSREL_MINOR} -lt 5 ]; then echo false; else echo true; fi; fi; fi)
68endif
69
70# OS_VER := $(shell uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',_')
71
72BUILD_SYSTEM := $(shell echo `uname -n` `uname -s` `uname -r` `uname -v` `uname -m` $$USER)
73BUILD_DATE := $(shell date +'%Y/%m/%d %T %Z')
74
75BUILD_OSNAME := $(shell uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
76
77# RedHat use nonstandard options for uname at least in cygwin,
78# macro should be overwritten:
79ifeq (cygwin,$(findstring cygwin,$(BUILD_OSNAME)))
80BUILD_OSNAME    := cygming
81BUILD_OSREALNAME := $(shell uname -o | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
82endif
83
84ifeq (mingw,$(findstring mingw,$(BUILD_OSNAME)))
85BUILD_OSNAME    := cygming
86BUILD_OSREALNAME := mingw
87endif
88
89BUILD_OSREL  := $(shell uname -r | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
90BUILD_M_ARCH := $(shell uname -m | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
91ifeq ($(OSNAME),hp-ux)
92BUILD_P_ARCH := unknown
93else
94BUILD_P_ARCH := $(shell uname -p | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-')
95endif
96
97# end of BUILD_DATE not defined
98endif
99