1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
14 # The Original Code is [Open Source Virtual Machine].
16 # The Initial Developer of the Original Code is
17 # Adobe System Incorporated.
18 # Portions created by the Initial Developer are Copyright (C) 2005-2006
19 # the Initial Developer. All Rights Reserved.
23 # Alternatively, the contents of this file may be used under the terms of
24 # either the GNU General Public License Version 2 or later (the "GPL"), or
25 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 # in which case the provisions of the GPL or the LGPL are applicable instead
27 # of those above. If you wish to allow use of your version of this file only
28 # under the terms of either the GPL or the LGPL, and not to allow others to
29 # use your version of this file under the terms of the MPL, indicate your
30 # decision by deleting the provisions above and replace them with the notice
31 # and other provisions required by the GPL or the LGPL. If you do not delete
32 # the provisions above, a recipient may use your version of this file under
33 # the terms of any one of the MPL, the GPL or the LGPL.
35 # ***** END LICENSE BLOCK *****
42 srcdir := $(topsrcdir
)
44 COMPILE_CPPFLAGS
= $(CPPFLAGS
) $(APP_CPPFLAGS
)
45 COMPILE_CXXFLAGS
= $(CXXFLAGS
) $(APP_CXXFLAGS
)
46 COMPILE_CFLAGS
= $(CFLAGS
) $(APP_CFLAGS
)
49 COMPILE_CPPFLAGS
+= $(DEBUG_CPPFLAGS
)
50 COMPILE_CXXFLAGS
+= $(DEBUG_CXXFLAGS
)
51 COMPILE_CFLAGS
+= $(DEBUG_CFLAGS
)
52 LDFLAGS
+= $(DEBUG_LDFLAGS
)
54 COMPILE_CPPFLAGS
+= $(OPT_CPPFLAGS
)
55 COMPILE_CXXFLAGS
+= $(OPT_CXXFLAGS
)
56 COMPILE_CFLAGS
+= $(OPT_CFLAGS
)
59 ifdef MACOSX_DEPLOYMENT_TARGET
60 export MACOSX_DEPLOYMENT_TARGET
63 GLOBAL_DEPS
:= Makefile
67 # Usage: from within RECURSE_DIRS
71 # Note: positional parameters passed to $(call) are expanded "early". This is
72 # the magic that sets and revert $(curdir) and $(srcdir) properly.
74 # Bug 632086: Generate paths without "./"; closer to canonical form make needs.
75 curdir
:= $(subst .
/,,$(1)/$(2))
76 srcdir := $(topsrcdir
)/$$(curdir
)
77 include $(topsrcdir
)/$$(curdir
)/manifest.mk
81 # Usage: $(call REAL_RECURSE_DIRS,$(DIRS),$(curdir))
82 define REAL_RECURSE_DIRS
83 $(foreach dir,$(1),$(eval
$(call RECURSE_DIR
,$(2),$(dir))))
86 # Usage: $(call RECURSE_DIRS,$(DIRS)))
88 $(call REAL_RECURSE_DIRS
,$(1),$(curdir
))
91 # Usage: $(eval $(call THING_SRCS,$(thingname)))
93 $(1)_CPPFLAGS ?
= $(COMPILE_CPPFLAGS
)
94 $(1)_CXXFLAGS ?
= $(COMPILE_CXXFLAGS
)
95 $(1)_CFLAGS ?
= $(COMPILE_CFLAGS
)
96 $(1)_CPPFLAGS
+= $($(1)_EXTRA_CPPFLAGS
)
97 $(1)_CXXFLAGS
+= $($(1)_EXTRA_CXXFLAGS
)
98 $(1)_CFLAGS
+= $($(1)_EXTRA_CFLAGS
)
99 $(1)_INCLUDES
+= $(INCLUDES
)
100 $(1)_DEFINES
+= $(DEFINES
)
102 $(1)_CXXOBJS
= $$($(1)_CXXSRCS
:%.
cpp=%.
$(OBJ_SUFFIX
))
104 $(1)_COBJS
= $$($(1)_CSRCS
:%.c
=%.
$(OBJ_SUFFIX
))
106 $(1)_ASMOBJS
= $$($(1)_ASMSRCS
:%.armasm
=%.
$(OBJ_SUFFIX
))
108 $(1)_MASMOBJS
= $$($(1)_MASMSRCS
:%.asm
=%.
$(OBJ_SUFFIX
))
115 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) \
116 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.deps
) \
117 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) \
118 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.deps
) \
121 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)): %.
$(II_SUFFIX
): %.
cpp $$(GLOBAL_DEPS
)
122 @
test -d
$$(dir $$@
) || mkdir
-p
$$(dir $$@
)
123 @echo
"Preprocessing $$*"
124 @
$(CXX
) -E
$$($(1)_CPPFLAGS
) $$($(1)_CXXFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) $$< > $$@
125 @
$(PYTHON
) $(topsrcdir
)/build
/dependparser.py
$$*.deps
$$< < $$@
> /dev
/null
127 $$($(1)_CXXOBJS
): %.
$(OBJ_SUFFIX
): %.
$(II_SUFFIX
) $$(GLOBAL_DEPS
)
128 @echo
"Compiling $$*"
129 @
$(CXX
) $(OUTOPTION
)$$@
$$($(1)_CPPFLAGS
) $$($(1)_CXXFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) -c
$$<
131 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(I_SUFFIX
)): %.
$(I_SUFFIX
): %.c
$$(GLOBAL_DEPS
)
132 @
test -d
$$(dir $$@
) || mkdir
-p
$$(dir $$@
)
133 @echo
"Preprocessing $$*"
134 @
$(CC
) -E
$$($(1)_CPPFLAGS
) $$($(1)_CFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) $$< > $$@
135 @
$(PYTHON
) $(topsrcdir
)/build
/dependparser.py
$$*.deps
$$< < $$@
> /dev
/null
137 $$($(1)_COBJS
): %.
$(OBJ_SUFFIX
): %.
$(I_SUFFIX
) $$(GLOBAL_DEPS
)
138 @echo
"Compiling $$*"
139 @
$(CC
) $(OUTOPTION
)$$@
$$($(1)_CPPFLAGS
) $$($(1)_CFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) -c
$$<
141 $$($(1)_ASMOBJS
): %.
$(OBJ_SUFFIX
): %.armasm
$$(GLOBAL_DEPS
)
142 $(ASM
) -o
$$@
$$($(1)_ASMFLAGS
) $$<
144 $$($(1)_MASMOBJS
): %.
$(OBJ_SUFFIX
): %.asm
$$(GLOBAL_DEPS
)
145 $(MASM
) -Fo
$$@
$$($(1)_MASMFLAGS
) $$<
148 @
$(PYTHON
) $(topsrcdir
)/build
/calcdepends.py
$$@
$$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(I_SUFFIX
))
150 include $(1).thing.pp
154 # Usage: $(eval $(call STATIC_LIBRARY_RULES,$(static_library_thingname)))
155 define STATIC_LIBRARY_RULES
156 $(1)_BASENAME ?
= $(1)
157 $(1)_NAME
= $(LIB_PREFIX
)$$($(1)_BASENAME
).
$(LIB_SUFFIX
)
159 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_ASMOBJS
) $$($(1)_MASMOBJS
)
161 $(call MKSTATICLIB
,$$@
) $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_ASMOBJS
) $$($(1)_MASMOBJS
)
163 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
166 all:: $$($(1)_DIR
)$$($(1)_NAME
)
171 # Usage: $(eval $(call DLL_RULES,$(dll_thingname)))
173 $(1)_BASENAME ?
= $(1)
174 $(1)_NAME
= $(LIB_PREFIX
)$$($(1)_BASENAME
).
$(DLL_SUFFIX
)
176 $$($(1)_EXTRA_DEPS
) \
177 $$(foreach lib
,$$($(1)_STATIC_LIBRARIES
) $$($(1)_DLLS
),$$($$(lib
)_NAME
)) \
182 $$($(1)_EXTRA_LDFLAGS
) \
183 $$(foreach lib
,$$(OS_LIBS
),$(call EXPAND_LIBNAME
,$$(lib
))) \
187 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_DEPS
)
188 $(call MKDLL
,$$@
) $$($(1)_CXXOBJS
) $$($(1)_COBJS
) \
189 $(LIBPATH
).
$$(foreach lib
,$$($(1)_STATIC_LIBRARIES
),$$(call EXPAND_LIBNAME
,$$(lib
))) \
190 $$(foreach lib
,$$($(1)_DLLS
),$$(call EXPAND_DLLNAME
,$$(lib
))) \
193 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
196 all:: $$($(1)_DIR
)$$($(1)_NAME
)
201 # Usage: $(eval $(call PROGRAM_RULES,$(program_thingnaame)))
203 $(1)_BASENAME ?
= $(1)
204 $(1)_NAME ?
= $$($(1)_BASENAME
)$(PROGRAM_SUFFIX
)
206 $$($(1)_EXTRA_DEPS
) \
207 $$(foreach lib
,$$($(1)_STATIC_LIBRARIES
) $$($(1)_DLLS
),$$($$(lib
)_NAME
)) \
212 $$($(1)_EXTRA_LDFLAGS
) \
213 $$(foreach lib
,$$(OS_LIBS
),$(call EXPAND_LIBNAME
,$$(lib
))) \
217 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_DEPS
)
219 $(call MKPROGRAM
,$$@
) \
221 $(LIBPATH
).
$$(foreach lib
,$$($(1)_STATIC_LIBRARIES
),$$(call EXPAND_LIBNAME
,$$(lib
))) \
222 $$(foreach lib
,$$($(1)_DLLS
),$$(call EXPAND_DLLNAME
,$$(lib
))) \
224 $(ifneq ($POSTMKPROGRAM,''))
225 $(call POSTMKPROGRAM
,$$@
)
227 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
230 all:: $$($(1)_DIR
)$$($(1)_NAME
)
235 # Delete target files if their recipe had an error exit-status code.