michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ####################################################################### michael@0: # Master "Core Components" macros for getting the OS architecture # michael@0: # defines these symbols: michael@0: # 64BIT_TAG michael@0: # OS_ARCH (from uname -r) michael@0: # OS_TEST (from uname -m) michael@0: # OS_RELEASE (from uname -v and/or -r) michael@0: # OS_TARGET User defined, or set to OS_ARCH michael@0: # CPU_ARCH (from unmame -m or -p, ONLY on WINNT) michael@0: # OS_CONFIG OS_TARGET + OS_RELEASE michael@0: # OBJDIR_TAG michael@0: # OBJDIR_NAME michael@0: ####################################################################### michael@0: michael@0: # michael@0: # Macros for getting the OS architecture michael@0: # michael@0: michael@0: ifeq ($(USE_64), 1) michael@0: 64BIT_TAG=_64 michael@0: else michael@0: 64BIT_TAG= michael@0: endif michael@0: michael@0: OS_ARCH := $(subst /,_,$(shell uname -s)) michael@0: michael@0: # michael@0: # Attempt to differentiate between sparc and x86 Solaris michael@0: # michael@0: michael@0: OS_TEST := $(shell uname -m) michael@0: ifeq ($(OS_TEST),i86pc) michael@0: OS_RELEASE := $(shell uname -r)_$(OS_TEST) michael@0: else michael@0: OS_RELEASE := $(shell uname -r) michael@0: endif michael@0: michael@0: # michael@0: # Force the IRIX64 machines to use IRIX. michael@0: # michael@0: michael@0: ifeq ($(OS_ARCH),IRIX64) michael@0: OS_ARCH = IRIX michael@0: endif michael@0: michael@0: # michael@0: # Force the older BSD/OS versions to use the new arch name. michael@0: # michael@0: michael@0: ifeq ($(OS_ARCH),BSD_386) michael@0: OS_ARCH = BSD_OS michael@0: endif michael@0: michael@0: # michael@0: # Catch Deterim if SVR4 is NCR or UNIXWARE michael@0: # michael@0: michael@0: ifeq ($(OS_ARCH),UNIX_SV) michael@0: ifneq ($(findstring NCR, $(shell grep NCR /etc/bcheckrc | head -1 )),) michael@0: OS_ARCH = NCR michael@0: else michael@0: # Make UnixWare something human readable michael@0: OS_ARCH = UNIXWARE michael@0: endif michael@0: michael@0: # Get the OS release number, not 4.2 michael@0: OS_RELEASE := $(shell uname -v) michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH),UNIX_System_V) michael@0: OS_ARCH = NEC michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH),AIX) michael@0: OS_RELEASE := $(shell uname -v).$(shell uname -r) michael@0: endif michael@0: michael@0: # michael@0: # Distinguish between OSF1 V4.0B and V4.0D michael@0: # michael@0: michael@0: ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0) michael@0: OS_VERSION := $(shell uname -v) michael@0: ifeq ($(OS_VERSION),564) michael@0: OS_RELEASE := V4.0B michael@0: endif michael@0: ifeq ($(OS_VERSION),878) michael@0: OS_RELEASE := V4.0D michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # SINIX changes name to ReliantUNIX with 5.43 michael@0: # michael@0: michael@0: ifeq ($(OS_ARCH),ReliantUNIX-N) michael@0: OS_ARCH = ReliantUNIX michael@0: OS_RELEASE = 5.4 michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH),SINIX-N) michael@0: OS_ARCH = ReliantUNIX michael@0: OS_RELEASE = 5.4 michael@0: endif michael@0: michael@0: # michael@0: # Handle FreeBSD 2.2-STABLE, Linux 2.0.30-osfmach3, and michael@0: # IRIX 6.5-ALPHA-1289139620. michael@0: # michael@0: michael@0: ifeq (,$(filter-out Linux FreeBSD IRIX,$(OS_ARCH))) michael@0: OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//') michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH),Linux) michael@0: OS_RELEASE := $(subst ., ,$(OS_RELEASE)) michael@0: ifneq ($(words $(OS_RELEASE)),1) michael@0: OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE)) michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # For OS/2 michael@0: # michael@0: ifeq ($(OS_ARCH),OS_2) michael@0: OS_ARCH = OS2 michael@0: OS_RELEASE := $(shell uname -v) michael@0: endif michael@0: michael@0: ####################################################################### michael@0: # Master "Core Components" macros for getting the OS target # michael@0: ####################################################################### michael@0: michael@0: # michael@0: # Note: OS_TARGET should be specified on the command line for gmake. michael@0: # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. michael@0: # The difference between the Win95 target and the WinNT target is that michael@0: # the WinNT target uses Windows NT specific features not available michael@0: # in Windows 95. The Win95 target will run on Windows NT, but (supposedly) michael@0: # at lesser performance (the Win95 target uses threads; the WinNT target michael@0: # uses fibers). michael@0: # michael@0: # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no michael@0: # cross-compilation, except on Windows, where it defaults to WIN95. michael@0: # michael@0: michael@0: # michael@0: # On WIN32, we also define the variable CPU_ARCH, if it isn't already. michael@0: # michael@0: ifndef CPU_ARCH michael@0: ifeq ($(OS_ARCH), WINNT) michael@0: CPU_ARCH := $(shell uname -p) michael@0: ifeq ($(CPU_ARCH),I386) michael@0: CPU_ARCH = x386 michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: # If uname -s returns "Windows_NT", we assume that we are using michael@0: # the uname.exe in MKS toolkit. michael@0: # michael@0: # The -r option of MKS uname only returns the major version number. michael@0: # So we need to use its -v option to get the minor version number. michael@0: # Moreover, it doesn't have the -p option, so we need to use uname -m. michael@0: # michael@0: ifeq ($(OS_ARCH), Windows_NT) michael@0: OS_ARCH = WINNT michael@0: OS_MINOR_RELEASE := $(shell uname -v) michael@0: # strip leading 0 michael@0: OS_MINOR_RELEASE := $(patsubst 0%,%,$(OS_MINOR_RELEASE)) michael@0: OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE) michael@0: ifndef CPU_ARCH michael@0: CPU_ARCH := $(shell uname -m) michael@0: # michael@0: # MKS's uname -m returns "586" on a Pentium machine. michael@0: # michael@0: ifneq (,$(findstring 86,$(CPU_ARCH))) michael@0: CPU_ARCH = x386 michael@0: endif michael@0: endif michael@0: endif michael@0: # michael@0: # If uname -s returns "CYGWIN_NT-*", we assume that we are using michael@0: # the uname.exe in the Cygwin tools. michael@0: # michael@0: ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH))) michael@0: OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH)) michael@0: OS_ARCH = WINNT michael@0: ifndef CPU_ARCH michael@0: ifeq (WOW64,$(findstring WOW64,$(OS_RELEASE))) michael@0: OS_RELEASE := $(patsubst %-WOW64,%,$(OS_RELEASE)) michael@0: endif michael@0: CPU_ARCH := $(shell uname -m) michael@0: # michael@0: # Cygwin's uname -m returns "i686" on a Pentium Pro machine. michael@0: # michael@0: ifneq (,$(findstring 86,$(CPU_ARCH))) michael@0: CPU_ARCH = x386 michael@0: endif michael@0: endif michael@0: endif michael@0: # michael@0: # If uname -s returns "MINGW32_NT-*", we assume that we are using michael@0: # the uname.exe in the MSYS toolkit. michael@0: # michael@0: ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH))) michael@0: OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH)) michael@0: OS_ARCH = WINNT michael@0: USE_MSYS = 1 michael@0: ifndef CPU_ARCH michael@0: CPU_ARCH := $(shell uname -m) michael@0: # michael@0: # MSYS's uname -m returns "i686" on a Pentium Pro machine. michael@0: # michael@0: ifneq (,$(findstring 86,$(CPU_ARCH))) michael@0: CPU_ARCH = x386 michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET),Android) michael@0: # michael@0: # this should be configurable from the user michael@0: # michael@0: OS_TEST := arm michael@0: OS_ARCH = Android michael@0: ifndef OS_TARGET_RELEASE michael@0: OS_TARGET_RELEASE := 8 michael@0: endif michael@0: endif michael@0: michael@0: ifndef OS_TARGET michael@0: ifeq ($(OS_ARCH), WINNT) michael@0: OS_TARGET = WIN95 michael@0: else michael@0: OS_TARGET = $(OS_ARCH) michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET), WIN95) michael@0: OS_RELEASE = 4.0 michael@0: endif michael@0: michael@0: ifdef OS_TARGET_RELEASE michael@0: OS_RELEASE = $(OS_TARGET_RELEASE) michael@0: endif michael@0: michael@0: # michael@0: # This variable is used to get OS_CONFIG.mk. michael@0: # michael@0: michael@0: OS_CONFIG = $(OS_TARGET)$(OS_RELEASE) michael@0: michael@0: # michael@0: # OBJDIR_TAG depends on the predefined variable BUILD_OPT, michael@0: # to distinguish between debug and release builds. michael@0: # michael@0: michael@0: ifdef BUILD_OPT michael@0: OBJDIR_TAG = $(64BIT_TAG)_OPT michael@0: else michael@0: ifdef BUILD_IDG michael@0: OBJDIR_TAG = $(64BIT_TAG)_IDG michael@0: else michael@0: OBJDIR_TAG = $(64BIT_TAG)_DBG michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # The following flags are defined in the individual $(OS_CONFIG).mk michael@0: # files. michael@0: # michael@0: # CPU_TAG is defined if the CPU is not the most common CPU. michael@0: # COMPILER_TAG is defined if the compiler is not the default compiler. michael@0: # IMPL_STRATEGY may be defined too. michael@0: # michael@0: michael@0: OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ michael@0: michael@0: ifeq (,$(filter-out WIN%,$(OS_TARGET))) michael@0: ifndef BUILD_OPT michael@0: # michael@0: # Define USE_DEBUG_RTL if you want to use the debug runtime library michael@0: # (RTL) in the debug build michael@0: # michael@0: ifdef USE_DEBUG_RTL michael@0: OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJD michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: MK_ARCH = included