tor-browser

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

ruleset.mk (5574B)


      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 #                                                                     #
      8 # Parameters to this makefile (set these in this file):               #
      9 #                                                                     #
     10 # a)                                                                  #
     11 #	TARGETS	-- the target to create                               #
     12 #			(defaults to $LIBRARY $PROGRAM)               #
     13 # b)                                                                  #
     14 #	DIRS	-- subdirectories for make to recurse on              #
     15 #			(the 'all' rule builds $TARGETS $DIRS)        #
     16 # c)                                                                  #
     17 #	CSRCS, CPPSRCS -- .c and .cpp files to compile                #
     18 #			(used to define $OBJS)                        #
     19 # d)                                                                  #
     20 #	PROGRAM	-- the target program name to create from $OBJS       #
     21 #			($OBJDIR automatically prepended to it)       #
     22 # e)                                                                  #
     23 #	LIBRARY	-- the target library name to create from $OBJS       #
     24 #			($OBJDIR automatically prepended to it)       #
     25 #                                                                     #
     26 #######################################################################
     27 
     28 #
     29 # CPU_TAG is now defined in the $(TARGET).mk files
     30 #
     31 
     32 ifndef COMPILER_TAG
     33    ifneq ($(DEFAULT_COMPILER), $(notdir $(firstword $(CC))))
     34 #
     35 # Temporary define for the Client; to be removed when binary release is used
     36 #
     37 ifdef MOZILLA_CLIENT
     38     COMPILER_TAG =
     39 else
     40     COMPILER_TAG = _$(notdir $(firstword $(CC)))
     41 endif
     42    else
     43 COMPILER_TAG =
     44    endif
     45 endif
     46 
     47 ifeq ($(MKPROG),)
     48    MKPROG = $(CC)
     49 endif
     50 
     51 #
     52 # This makefile contains rules for building the following kinds of
     53 # objects:
     54 # - (1) LIBRARY: a static (archival) library
     55 # - (2) SHARED_LIBRARY: a shared (dynamic link) library
     56 # - (3) IMPORT_LIBRARY: an import library, defined in $(OS_TARGET).mk
     57 # - (4) PROGRAM: an executable binary
     58 #
     59 # A library is build by specifying the LIBRARY_NAME variable.
     60 # If you want to build only a static library, set SHARED_LIBRARY = $(NULL)
     61 # If you want to build only a shared library, set LIBRARY = $(NULL)
     62 # You can specify the shared library major version via LIBRARY_VERSION.
     63 #
     64 # Normally you want to link to the shared library. In this case you must
     65 # provide an export script, like:
     66 #   MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def.
     67 # Unfortunatly this variable is needed by the ARCH setup, so you have to set
     68 # it explicitly in the manifest.mn.
     69 #
     70 # Per default, it's assumed the shared library provides resource specification
     71 # in the file RES. You can set it to $(NULL), if that is not true.
     72 #
     73 # If you have an unversioned SHARED_LIBRARY, you must explicitly change or
     74 # disable the static LIBRARY, as these normally clash on Windows.
     75 
     76 ifdef LIBRARY_NAME
     77    ifndef LIBRARY
     78 LIBRARY := $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
     79    endif
     80    ifndef SHARED_LIBRARY
     81 SHARED_LIBRARY := $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
     82    endif
     83 
     84    ifneq ($(SHARED_LIBRARY),)
     85 
     86    ifdef IMPORT_LIB_SUFFIX
     87    ifdef MAPFILE
     88    ifndef IMPORT_LIBRARY
     89 IMPORT_LIBRARY := $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
     90    endif
     91    endif
     92    endif
     93 
     94    ifndef MAPFILE_SOURCE
     95 MAPFILE_SOURCE := $(LIBRARY_NAME).def
     96    endif
     97 
     98    ifeq (,$(filter-out WIN%,$(OS_TARGET)))
     99    ifndef RES
    100 RES := $(OBJDIR)/$(LIBRARY_NAME).res
    101    endif
    102    ifndef RESNAME
    103 RESNAME := $(LIBRARY_NAME).rc
    104    endif
    105    endif
    106 
    107    endif
    108 endif
    109 
    110 #
    111 # Common rules used by lots of makefiles...
    112 #
    113 
    114 ifdef PROGRAM
    115    PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(PROG_SUFFIX))
    116 endif
    117 
    118 ifdef PROGRAMS
    119    PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(PROG_SUFFIX)))
    120 endif
    121 
    122 ifndef TARGETS
    123    TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
    124 endif
    125 
    126 # Make both .cpp and .cc work.
    127 CPPSRCS1 = $(CPPSRCS:.cpp=$(OBJ_SUFFIX))
    128 CPPSRCS2 = $(CPPSRCS1:.cc=$(OBJ_SUFFIX))
    129 
    130 ifndef OBJS
    131    SIMPLE_OBJS = \
    132 	$(CSRCS:.c=$(OBJ_SUFFIX)) \
    133 	$(CPPSRCS2) \
    134 	$(ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) \
    135 	$(BUILT_CSRCS:.c=$(OBJ_SUFFIX)) \
    136 	$(BUILT_CPPSRCS:.cpp=$(OBJ_SUFFIX)) \
    137 	$(BUILT_ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX))
    138    OBJS =	$(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS))
    139 endif
    140 
    141 ifndef BUILT_SRCS
    142    BUILT_SRCS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), \
    143 	 $(BUILT_CSRCS) $(BUILT_CPPSRCS) $(BUILT_ASFILES))
    144 endif
    145 
    146 ifndef MAKE_OBJDIR
    147 define MAKE_OBJDIR
    148 if test ! -d $(@D); then $(NSINSTALL) -D $(@D); fi
    149 endef
    150 endif
    151 
    152 ALL_TRASH =	$(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
    153 	so_locations $(BUILT_SRCS) $(NOSUCHFILE)
    154 
    155 ifdef NSS_BUILD_CONTINUE_ON_ERROR
    156 # Try to build everything. I.e., don't exit on errors.
    157    EXIT_ON_ERROR		= +e
    158    IGNORE_ERROR		= -
    159    CLICK_STOPWATCH		= date
    160 else
    161    EXIT_ON_ERROR		= -e
    162    IGNORE_ERROR		=
    163    CLICK_STOPWATCH		= true
    164 endif
    165 
    166 ifdef REQUIRES
    167    MODULE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/public/, $(REQUIRES))
    168    INCLUDES        += $(MODULE_INCLUDES)
    169    ifeq ($(MODULE), sectools)
    170 PRIVATE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/private/, $(REQUIRES))
    171 INCLUDES         += $(PRIVATE_INCLUDES)
    172    endif
    173 endif
    174 
    175 ifdef SYSTEM_INCL_DIR
    176    YOPT = -Y$(SYSTEM_INCL_DIR)
    177 endif
    178 
    179 MK_RULESET = included