1#! gmake 2# 3# This Source Code Form is subject to the terms of the Mozilla Public 4# License, v. 2.0. If a copy of the MPL was not distributed with this 5# file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7# Configuration information for building in the NSPR source module 8 9# Define an include-at-most-once-flag 10NSPR_CONFIG_MK = 1 11 12# 13# The variable definitions in this file are inputs to NSPR's 14# build system. This file, if present, is included at the 15# beginning of config.mk. 16# 17# For example: 18# 19# MOZ_OPTIMIZE=1 20# USE_PTHREADS=1 21# NS_USE_GCC= 22# 23ifndef topsrcdir 24topsrcdir=$(MOD_DEPTH) 25endif 26 27ifndef srcdir 28srcdir=. 29endif 30 31NFSPWD = $(MOD_DEPTH)/config/nfspwd 32 33CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\ 34 $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) 35CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\ 36 $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) 37# For purify 38NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ 39 $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) 40NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ 41 $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) 42 43LDFLAGS = $(OS_LDFLAGS) 44 45# Enable profile-guided optimization 46ifndef NO_PROFILE_GUIDED_OPTIMIZE 47ifdef MOZ_PROFILE_GENERATE 48CFLAGS += $(PROFILE_GEN_CFLAGS) 49LDFLAGS += $(PROFILE_GEN_LDFLAGS) 50DLLFLAGS += $(PROFILE_GEN_LDFLAGS) 51ifeq (WINNT,$(OS_ARCH)) 52AR_FLAGS += -LTCG 53endif 54endif # MOZ_PROFILE_GENERATE 55 56ifdef MOZ_PROFILE_USE 57CFLAGS += $(PROFILE_USE_CFLAGS) 58LDFLAGS += $(PROFILE_USE_LDFLAGS) 59DLLFLAGS += $(PROFILE_USE_LDFLAGS) 60ifeq (WINNT,$(OS_ARCH)) 61AR_FLAGS += -LTCG 62endif 63endif # MOZ_PROFILE_USE 64endif # NO_PROFILE_GUIDED_OPTIMIZE 65 66define MAKE_OBJDIR 67if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi 68endef 69 70LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) 71 72ifeq ($(OS_ARCH),Darwin) 73PWD := $(shell pwd) 74endif 75 76ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH))) 77INSTALL = $(NSINSTALL) 78else 79ifeq ($(NSDISTMODE),copy) 80# copy files, but preserve source mtime 81INSTALL = $(NSINSTALL) -t 82else 83ifeq ($(NSDISTMODE),absolute_symlink) 84# install using absolute symbolic links 85ifeq ($(OS_ARCH),Darwin) 86INSTALL = $(NSINSTALL) -L $(PWD) 87else 88INSTALL = $(NSINSTALL) -L `$(NFSPWD)` 89endif 90else 91# install using relative symbolic links 92INSTALL = $(NSINSTALL) -R 93endif 94endif 95endif # (WINNT || OS2) && !CROSS_COMPILE 96 97DEPENDENCIES = $(OBJDIR)/.md 98 99ifdef BUILD_DEBUG_GC 100DEFINES += -DDEBUG_GC 101endif 102 103GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) 104 105DIST_GARBAGE += Makefile 106 107#################################################################### 108# 109# The NSPR-specific configuration 110# 111#################################################################### 112 113DEFINES += -DFORCE_PR_LOG 114 115ifeq ($(_PR_NO_CLOCK_TIMER),1) 116DEFINES += -D_PR_NO_CLOCK_TIMER 117endif 118 119ifeq ($(USE_PTHREADS), 1) 120DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM 121endif 122 123ifeq ($(PTHREADS_USER), 1) 124DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM 125endif 126 127ifeq ($(USE_IPV6),1) 128DEFINES += -D_PR_INET6 129endif 130 131ifeq ($(MOZ_UNICODE),1) 132DEFINES += -DMOZ_UNICODE 133endif 134 135#################################################################### 136# 137# Configuration for the release process 138# 139#################################################################### 140 141MDIST = /m/dist 142ifeq ($(OS_ARCH),WINNT) 143MDIST = //helium/dist 144MDIST_DOS = $(subst /,\\,$(MDIST)) 145endif 146 147# RELEASE_DIR is ns/dist/<module name> 148 149RELEASE_DIR = $(MOD_DEPTH)/dist/release/$(MOD_NAME) 150 151RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include 152RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin 153RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib 154 155# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including 156# this file 157OBJ_SUFFIX := $(_OBJ_SUFFIX) 158 159# PGO builds with GCC build objects with instrumentation in a first pass, 160# then objects optimized, without instrumentation, in a second pass. If 161# we overwrite the ojects from the first pass with those from the second, 162# we end up not getting instrumentation data for better optimization on 163# incremental builds. As a consequence, we use a different object suffix 164# for the first pass. 165ifdef MOZ_PROFILE_GENERATE 166ifdef NS_USE_GCC 167OBJ_SUFFIX := i_o 168endif 169endif 170