tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

arch.mk (5895B)


      1 #
      2 # This Source Code Form is subject to the terms of the Mozilla Public
      3 # License, v. 2.0. If a copy of the MPL was not distributed with this
      4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      5 
      6 #######################################################################
      7 # Master "Core Components" macros for getting the OS architecture     #
      8 # defines these symbols:
      9 # OS_ARCH	(from uname -r)
     10 # OS_TEST	(from uname -m)
     11 # OS_RELEASE	(from uname -v and/or -r)
     12 # OS_TARGET	User defined, or set to OS_ARCH
     13 # CPU_ARCH  	(from uname -m or -p, ONLY on WINNT)
     14 # OS_CONFIG	OS_TARGET + OS_RELEASE
     15 # OBJDIR_TAG    (uses GCOV_TAG, 64BIT_TAG)
     16 # OBJDIR_NAME
     17 #######################################################################
     18 
     19 #
     20 # Macros for getting the OS architecture
     21 #
     22 
     23 OS_ARCH := $(subst /,_,$(shell uname -s))
     24 
     25 #
     26 # Attempt to differentiate between sparc and x86 Solaris
     27 #
     28 
     29 OS_TEST := $(shell uname -m)
     30 ifeq ($(OS_TEST),i86pc)
     31    OS_RELEASE := $(shell uname -r)_$(OS_TEST)
     32 else
     33    OS_RELEASE := $(shell uname -r)
     34 endif
     35 
     36 
     37 #
     38 # Force the older BSD/OS versions to use the new arch name.
     39 #
     40 
     41 ifeq ($(OS_ARCH),UNIX_System_V)
     42    OS_ARCH	= NEC
     43 endif
     44 
     45 ifeq ($(OS_ARCH),AIX)
     46    OS_RELEASE := $(shell uname -v).$(shell uname -r)
     47 endif
     48 
     49 #
     50 # Handle FreeBSD 2.2-STABLE, Linux 2.0.30-osfmach3, and
     51 #
     52 
     53 ifeq (,$(filter-out Linux FreeBSD ,$(OS_ARCH)))
     54    OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//')
     55 endif
     56 
     57 ifeq ($(OS_ARCH),Linux)
     58    OS_RELEASE := $(subst ., ,$(OS_RELEASE))
     59    ifneq ($(words $(OS_RELEASE)),1)
     60 OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE))
     61    endif
     62    KERNEL = Linux
     63    include $(CORE_DEPTH)/coreconf/Linux.mk
     64 endif
     65 
     66 # Since all uses of OS_ARCH that follow affect only userland, we can
     67 # merge other Glibc systems with Linux here.
     68 ifeq ($(OS_ARCH),GNU)
     69    OS_ARCH = Linux
     70    OS_RELEASE = 2.6
     71    KERNEL = GNU
     72 endif
     73 ifeq ($(OS_ARCH),GNU_kFreeBSD)
     74    OS_ARCH = Linux
     75    OS_RELEASE = 2.6
     76    KERNEL = FreeBSD
     77 endif
     78 
     79 #######################################################################
     80 # Master "Core Components" macros for getting the OS target           #
     81 #######################################################################
     82 
     83 #
     84 # Note: OS_TARGET should be specified on the command line for gmake.
     85 #
     86 # On WIN32, we also define the variable CPU_ARCH, if it isn't already.
     87 #
     88 ifndef CPU_ARCH
     89    ifeq ($(OS_ARCH), WINNT)
     90 CPU_ARCH := $(shell uname -p)
     91 ifeq ($(CPU_ARCH),I386)
     92     CPU_ARCH = x386
     93 endif
     94    endif
     95 endif
     96 
     97 # If uname -s returns "Windows_NT", we assume that we are using
     98 # the uname.exe in MKS toolkit.
     99 #
    100 # The -r option of MKS uname only returns the major version number.
    101 # So we need to use its -v option to get the minor version number.
    102 # Moreover, it doesn't have the -p option, so we need to use uname -m.
    103 #
    104 ifeq ($(OS_ARCH), Windows_NT)
    105    OS_ARCH = WINNT
    106    OS_MINOR_RELEASE := $(shell uname -v)
    107    # strip leading 0
    108    OS_MINOR_RELEASE := $(patsubst 0%,%,$(OS_MINOR_RELEASE))
    109    OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE)
    110    ifndef CPU_ARCH
    111 CPU_ARCH := $(shell uname -m)
    112 #
    113 # MKS's uname -m returns "586" on a Pentium machine.
    114 #
    115 ifneq (,$(findstring 86,$(CPU_ARCH)))
    116     CPU_ARCH = x386
    117 endif
    118    endif
    119 endif
    120 #
    121 # If uname -s returns "CYGWIN_NT-*", we assume that we are using
    122 # the uname.exe in the Cygwin tools.
    123 #
    124 ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH)))
    125    OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH))
    126    OS_ARCH = WINNT
    127    ifndef CPU_ARCH
    128    ifeq (WOW64,$(findstring WOW64,$(OS_RELEASE)))
    129        OS_RELEASE := $(patsubst %-WOW64,%,$(OS_RELEASE))
    130    endif    
    131 CPU_ARCH := $(shell uname -m)
    132 #
    133 # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
    134 #
    135 ifneq (,$(findstring 86,$(CPU_ARCH)))
    136     CPU_ARCH = x386
    137 endif
    138    endif
    139 endif
    140 #
    141 # If uname -s returns "MINGW*_NT-*", we assume that we are using
    142 # the uname.exe in the MSYS toolkit.
    143 #
    144 ifneq (,$(filter MSYS_NT-% MINGW32_NT-% MINGW64_NT-%,$(OS_ARCH)))
    145    OS_RELEASE := $(patsubst MSYS_NT-%,%,$(patsubst MINGW64_NT-%,%,$(patsubst MINGW32_NT-%,%,$(OS_ARCH))))
    146    OS_ARCH = WINNT
    147    USE_MSYS = 1
    148    ifndef CPU_ARCH
    149 CPU_ARCH := $(shell uname -m)
    150 #
    151 # MSYS's uname -m returns "i686" on a Pentium Pro machine.
    152 #
    153 ifneq (,$(filter i%86,$(CPU_ARCH)))
    154     CPU_ARCH = x386
    155 endif
    156    endif
    157 endif
    158 
    159 ifeq ($(OS_TARGET),Android)
    160 #
    161 # this should be  configurable from the user
    162 #
    163   OS_TEST := arm
    164   OS_ARCH = Android
    165   ifndef OS_TARGET_RELEASE
    166 OS_TARGET_RELEASE := 8
    167   endif
    168 endif
    169 
    170 ifndef OS_TARGET
    171    OS_TARGET = $(OS_ARCH)
    172 endif
    173 
    174 ifdef OS_TARGET_RELEASE
    175    OS_RELEASE = $(OS_TARGET_RELEASE)
    176 endif
    177 
    178 #
    179 # This variable is used to get OS_CONFIG.mk.
    180 #
    181 
    182 OS_CONFIG = $(OS_TARGET)$(OS_RELEASE)
    183 
    184 #
    185 # OBJDIR_TAG depends on the predefined variable BUILD_OPT,
    186 # to distinguish between debug and release builds.
    187 #
    188 
    189 ifeq ($(USE_GCOV), 1)
    190    GCOV_TAG = _GCOV
    191 else
    192    GCOV_TAG =
    193 endif
    194 ifeq ($(USE_64), 1)
    195    64BIT_TAG = _64
    196 else
    197    64BIT_TAG =
    198 endif
    199 OBJDIR_TAG_BASE=$(GCOV_TAG)$(64BIT_TAG)
    200 
    201 ifdef BUILD_OPT
    202    OBJDIR_TAG = $(OBJDIR_TAG_BASE)_OPT
    203 else
    204    ifdef BUILD_IDG
    205 OBJDIR_TAG = $(OBJDIR_TAG_BASE)_IDG
    206    else
    207 OBJDIR_TAG = $(OBJDIR_TAG_BASE)_DBG
    208    endif
    209 endif
    210 
    211 #
    212 # The following flags are defined in the individual $(OS_CONFIG).mk
    213 # files.
    214 #
    215 # CPU_TAG is defined if the CPU is not the most common CPU.
    216 # COMPILER_TAG is defined if the compiler is not the default compiler.
    217 # IMPL_STRATEGY may be defined too.
    218 #
    219 
    220 ifdef CROSS_COMPILE
    221    OBJDIR_NAME_COMPILER =
    222 else
    223    OBJDIR_NAME_COMPILER = $(COMPILER_TAG)
    224 endif
    225 OBJDIR_NAME_BASE = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(OBJDIR_NAME_COMPILER)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG)
    226 OBJDIR_NAME = $(OBJDIR_NAME_BASE).OBJ
    227 
    228 
    229 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
    230 ifndef BUILD_OPT
    231 #
    232 # Define USE_DEBUG_RTL if you want to use the debug runtime library
    233 # (RTL) in the debug build
    234 #
    235 ifdef USE_DEBUG_RTL
    236    OBJDIR_NAME = $(OBJDIR_NAME_BASE).OBJD
    237 endif
    238 endif
    239 endif
    240 
    241 MK_ARCH = included