|
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 |
|
10 NSPR_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 # |
|
23 ifndef topsrcdir |
|
24 topsrcdir=$(MOD_DEPTH) |
|
25 endif |
|
26 |
|
27 ifndef srcdir |
|
28 srcdir=. |
|
29 endif |
|
30 |
|
31 NFSPWD = $(MOD_DEPTH)/config/nfspwd |
|
32 |
|
33 CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\ |
|
34 $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) |
|
35 CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\ |
|
36 $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) |
|
37 # For purify |
|
38 NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ |
|
39 $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) |
|
40 NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ |
|
41 $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) |
|
42 |
|
43 LDFLAGS = $(OS_LDFLAGS) |
|
44 |
|
45 # Enable profile-guided optimization |
|
46 ifndef NO_PROFILE_GUIDED_OPTIMIZE |
|
47 ifdef MOZ_PROFILE_GENERATE |
|
48 CFLAGS += $(PROFILE_GEN_CFLAGS) |
|
49 LDFLAGS += $(PROFILE_GEN_LDFLAGS) |
|
50 DLLFLAGS += $(PROFILE_GEN_LDFLAGS) |
|
51 ifeq (WINNT,$(OS_ARCH)) |
|
52 AR_FLAGS += -LTCG |
|
53 endif |
|
54 endif # MOZ_PROFILE_GENERATE |
|
55 |
|
56 ifdef MOZ_PROFILE_USE |
|
57 CFLAGS += $(PROFILE_USE_CFLAGS) |
|
58 LDFLAGS += $(PROFILE_USE_LDFLAGS) |
|
59 DLLFLAGS += $(PROFILE_USE_LDFLAGS) |
|
60 ifeq (WINNT,$(OS_ARCH)) |
|
61 AR_FLAGS += -LTCG |
|
62 endif |
|
63 endif # MOZ_PROFILE_USE |
|
64 endif # NO_PROFILE_GUIDED_OPTIMIZE |
|
65 |
|
66 define MAKE_OBJDIR |
|
67 if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi |
|
68 endef |
|
69 |
|
70 LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) |
|
71 |
|
72 ifeq ($(OS_ARCH),Darwin) |
|
73 PWD := $(shell pwd) |
|
74 endif |
|
75 |
|
76 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH))) |
|
77 INSTALL = $(NSINSTALL) |
|
78 else |
|
79 ifeq ($(NSDISTMODE),copy) |
|
80 # copy files, but preserve source mtime |
|
81 INSTALL = $(NSINSTALL) -t |
|
82 else |
|
83 ifeq ($(NSDISTMODE),absolute_symlink) |
|
84 # install using absolute symbolic links |
|
85 ifeq ($(OS_ARCH),Darwin) |
|
86 INSTALL = $(NSINSTALL) -L $(PWD) |
|
87 else |
|
88 INSTALL = $(NSINSTALL) -L `$(NFSPWD)` |
|
89 endif |
|
90 else |
|
91 # install using relative symbolic links |
|
92 INSTALL = $(NSINSTALL) -R |
|
93 endif |
|
94 endif |
|
95 endif # (WINNT || OS2) && !CROSS_COMPILE |
|
96 |
|
97 DEPENDENCIES = $(OBJDIR)/.md |
|
98 |
|
99 ifdef BUILD_DEBUG_GC |
|
100 DEFINES += -DDEBUG_GC |
|
101 endif |
|
102 |
|
103 GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) |
|
104 |
|
105 DIST_GARBAGE += Makefile |
|
106 |
|
107 #################################################################### |
|
108 # |
|
109 # The NSPR-specific configuration |
|
110 # |
|
111 #################################################################### |
|
112 |
|
113 DEFINES += -DFORCE_PR_LOG |
|
114 |
|
115 ifeq ($(_PR_NO_CLOCK_TIMER),1) |
|
116 DEFINES += -D_PR_NO_CLOCK_TIMER |
|
117 endif |
|
118 |
|
119 ifeq ($(USE_PTHREADS), 1) |
|
120 DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM |
|
121 endif |
|
122 |
|
123 ifeq ($(PTHREADS_USER), 1) |
|
124 DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM |
|
125 endif |
|
126 |
|
127 ifeq ($(USE_IPV6),1) |
|
128 DEFINES += -D_PR_INET6 |
|
129 endif |
|
130 |
|
131 ifeq ($(MOZ_UNICODE),1) |
|
132 DEFINES += -DMOZ_UNICODE |
|
133 endif |
|
134 |
|
135 #################################################################### |
|
136 # |
|
137 # Configuration for the release process |
|
138 # |
|
139 #################################################################### |
|
140 |
|
141 MDIST = /m/dist |
|
142 ifeq ($(OS_ARCH),WINNT) |
|
143 MDIST = //helium/dist |
|
144 MDIST_DOS = $(subst /,\\,$(MDIST)) |
|
145 endif |
|
146 |
|
147 # RELEASE_DIR is ns/dist/<module name> |
|
148 |
|
149 RELEASE_DIR = $(MOD_DEPTH)/dist/release/$(MOD_NAME) |
|
150 |
|
151 RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include |
|
152 RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin |
|
153 RELEASE_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 |
|
157 OBJ_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. |
|
165 ifdef MOZ_PROFILE_GENERATE |
|
166 ifdef NS_USE_GCC |
|
167 OBJ_SUFFIX := i_o |
|
168 endif |
|
169 endif |