michael@0: #! gmake 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: # Configuration information for building in the NSPR source module michael@0: michael@0: # Define an include-at-most-once-flag michael@0: NSPR_CONFIG_MK = 1 michael@0: michael@0: # michael@0: # The variable definitions in this file are inputs to NSPR's michael@0: # build system. This file, if present, is included at the michael@0: # beginning of config.mk. michael@0: # michael@0: # For example: michael@0: # michael@0: # MOZ_OPTIMIZE=1 michael@0: # USE_PTHREADS=1 michael@0: # NS_USE_GCC= michael@0: # michael@0: ifndef topsrcdir michael@0: topsrcdir=$(MOD_DEPTH) michael@0: endif michael@0: michael@0: ifndef srcdir michael@0: srcdir=. michael@0: endif michael@0: michael@0: NFSPWD = $(MOD_DEPTH)/config/nfspwd michael@0: michael@0: CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\ michael@0: $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) michael@0: CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\ michael@0: $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) michael@0: # For purify michael@0: NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ michael@0: $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) michael@0: NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ michael@0: $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) michael@0: michael@0: LDFLAGS = $(OS_LDFLAGS) michael@0: michael@0: # Enable profile-guided optimization michael@0: ifndef NO_PROFILE_GUIDED_OPTIMIZE michael@0: ifdef MOZ_PROFILE_GENERATE michael@0: CFLAGS += $(PROFILE_GEN_CFLAGS) michael@0: LDFLAGS += $(PROFILE_GEN_LDFLAGS) michael@0: DLLFLAGS += $(PROFILE_GEN_LDFLAGS) michael@0: ifeq (WINNT,$(OS_ARCH)) michael@0: AR_FLAGS += -LTCG michael@0: endif michael@0: endif # MOZ_PROFILE_GENERATE michael@0: michael@0: ifdef MOZ_PROFILE_USE michael@0: CFLAGS += $(PROFILE_USE_CFLAGS) michael@0: LDFLAGS += $(PROFILE_USE_LDFLAGS) michael@0: DLLFLAGS += $(PROFILE_USE_LDFLAGS) michael@0: ifeq (WINNT,$(OS_ARCH)) michael@0: AR_FLAGS += -LTCG michael@0: endif michael@0: endif # MOZ_PROFILE_USE michael@0: endif # NO_PROFILE_GUIDED_OPTIMIZE michael@0: michael@0: define MAKE_OBJDIR michael@0: if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi michael@0: endef michael@0: michael@0: LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) michael@0: michael@0: ifeq ($(OS_ARCH),Darwin) michael@0: PWD := $(shell pwd) michael@0: endif michael@0: michael@0: ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH))) michael@0: INSTALL = $(NSINSTALL) michael@0: else michael@0: ifeq ($(NSDISTMODE),copy) michael@0: # copy files, but preserve source mtime michael@0: INSTALL = $(NSINSTALL) -t michael@0: else michael@0: ifeq ($(NSDISTMODE),absolute_symlink) michael@0: # install using absolute symbolic links michael@0: ifeq ($(OS_ARCH),Darwin) michael@0: INSTALL = $(NSINSTALL) -L $(PWD) michael@0: else michael@0: INSTALL = $(NSINSTALL) -L `$(NFSPWD)` michael@0: endif michael@0: else michael@0: # install using relative symbolic links michael@0: INSTALL = $(NSINSTALL) -R michael@0: endif michael@0: endif michael@0: endif # (WINNT || OS2) && !CROSS_COMPILE michael@0: michael@0: DEPENDENCIES = $(OBJDIR)/.md michael@0: michael@0: ifdef BUILD_DEBUG_GC michael@0: DEFINES += -DDEBUG_GC michael@0: endif michael@0: michael@0: GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) michael@0: michael@0: DIST_GARBAGE += Makefile michael@0: michael@0: #################################################################### michael@0: # michael@0: # The NSPR-specific configuration michael@0: # michael@0: #################################################################### michael@0: michael@0: DEFINES += -DFORCE_PR_LOG michael@0: michael@0: ifeq ($(_PR_NO_CLOCK_TIMER),1) michael@0: DEFINES += -D_PR_NO_CLOCK_TIMER michael@0: endif michael@0: michael@0: ifeq ($(USE_PTHREADS), 1) michael@0: DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM michael@0: endif michael@0: michael@0: ifeq ($(PTHREADS_USER), 1) michael@0: DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM michael@0: endif michael@0: michael@0: ifeq ($(USE_IPV6),1) michael@0: DEFINES += -D_PR_INET6 michael@0: endif michael@0: michael@0: ifeq ($(MOZ_UNICODE),1) michael@0: DEFINES += -DMOZ_UNICODE michael@0: endif michael@0: michael@0: #################################################################### michael@0: # michael@0: # Configuration for the release process michael@0: # michael@0: #################################################################### michael@0: michael@0: MDIST = /m/dist michael@0: ifeq ($(OS_ARCH),WINNT) michael@0: MDIST = //helium/dist michael@0: MDIST_DOS = $(subst /,\\,$(MDIST)) michael@0: endif michael@0: michael@0: # RELEASE_DIR is ns/dist/ michael@0: michael@0: RELEASE_DIR = $(MOD_DEPTH)/dist/release/$(MOD_NAME) michael@0: michael@0: RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include michael@0: RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin michael@0: RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib michael@0: michael@0: # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including michael@0: # this file michael@0: OBJ_SUFFIX := $(_OBJ_SUFFIX) michael@0: michael@0: # PGO builds with GCC build objects with instrumentation in a first pass, michael@0: # then objects optimized, without instrumentation, in a second pass. If michael@0: # we overwrite the ojects from the first pass with those from the second, michael@0: # we end up not getting instrumentation data for better optimization on michael@0: # incremental builds. As a consequence, we use a different object suffix michael@0: # for the first pass. michael@0: ifdef MOZ_PROFILE_GENERATE michael@0: ifdef NS_USE_GCC michael@0: OBJ_SUFFIX := i_o michael@0: endif michael@0: endif