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.
75 srcdir := $(topsrcdir
)/$$(curdir
)
76 include $(topsrcdir
)/$$(curdir
)/manifest.mk
80 # Usage: $(call REAL_RECURSE_DIRS,$(DIRS),$(curdir))
81 define REAL_RECURSE_DIRS
82 $(foreach dir,$(1),$(eval
$(call RECURSE_DIR
,$(2),$(dir))))
85 # Usage: $(call RECURSE_DIRS,$(DIRS)))
87 $(call REAL_RECURSE_DIRS
,$(1),$(curdir
))
90 # Usage: $(eval $(call THING_SRCS,$(thingname)))
92 $(1)_CPPFLAGS ?
= $(COMPILE_CPPFLAGS
)
93 $(1)_CXXFLAGS ?
= $(COMPILE_CXXFLAGS
)
94 $(1)_CFLAGS ?
= $(COMPILE_CFLAGS
)
95 $(1)_CPPFLAGS
+= $($(1)_EXTRA_CPPFLAGS
)
96 $(1)_CXXFLAGS
+= $($(1)_EXTRA_CXXFLAGS
)
97 $(1)_CFLAGS
+= $($(1)_EXTRA_CFLAGS
)
98 $(1)_INCLUDES
+= $(INCLUDES
)
99 $(1)_DEFINES
+= $(DEFINES
)
101 $(1)_CXXOBJS
= $$($(1)_CXXSRCS
:%.
cpp=%.
$(OBJ_SUFFIX
))
103 $(1)_COBJS
= $$($(1)_CSRCS
:%.c
=%.
$(OBJ_SUFFIX
))
105 $(1)_ASMOBJS
= $$($(1)_ASMSRCS
:%.armasm
=%.
$(OBJ_SUFFIX
))
107 $(1)_MASMOBJS
= $$($(1)_MASMSRCS
:%.asm
=%.
$(OBJ_SUFFIX
))
114 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) \
115 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.deps
) \
116 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) \
117 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.deps
) \
120 $$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)): %.
$(II_SUFFIX
): %.
cpp $$(GLOBAL_DEPS
)
121 @
test -d
$$(dir $$@
) || mkdir
-p
$$(dir $$@
)
122 @echo
"Compiling $$*"
123 @
$(CXX
) -E
$$($(1)_CPPFLAGS
) $$($(1)_CXXFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) $$< > $$@
124 @
$(PYTHON
) $(topsrcdir
)/build
/dependparser.py
$$*.deps
$$< < $$@
> /dev
/null
126 $$($(1)_CXXOBJS
): %.
$(OBJ_SUFFIX
): %.
$(II_SUFFIX
) $$(GLOBAL_DEPS
)
127 @
$(CXX
) $(OUTOPTION
)$$@
$$($(1)_CPPFLAGS
) $$($(1)_CXXFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) -c
$$<
129 $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(I_SUFFIX
)): %.
$(I_SUFFIX
): %.c
$$(GLOBAL_DEPS
)
130 @
test -d
$$(dir $$@
) || mkdir
-p
$$(dir $$@
)
131 @echo
"Compiling $$*"
132 @
$(CC
) -E
$$($(1)_CPPFLAGS
) $$($(1)_CFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) $$< > $$@
133 @
$(PYTHON
) $(topsrcdir
)/build
/dependparser.py
$$*.deps
$$< < $$@
> /dev
/null
135 $$($(1)_COBJS
): %.
$(OBJ_SUFFIX
): %.
$(I_SUFFIX
) $$(GLOBAL_DEPS
)
136 @
$(CC
) $(OUTOPTION
)$$@
$$($(1)_CPPFLAGS
) $$($(1)_CFLAGS
) $$($(1)_DEFINES
) $$($(1)_INCLUDES
) -c
$$<
138 $$($(1)_ASMOBJS
): %.
$(OBJ_SUFFIX
): %.armasm
$$(GLOBAL_DEPS
)
139 $(ASM
) -o
$$@
$$($(1)_ASMFLAGS
) $$<
141 $$($(1)_MASMOBJS
): %.
$(OBJ_SUFFIX
): %.asm
$$(GLOBAL_DEPS
)
142 $(MASM
) -Fo
$$@
$$($(1)_MASMFLAGS
) $$<
145 @
$(PYTHON
) $(topsrcdir
)/build
/calcdepends.py
$$@
$$($(1)_CXXOBJS
:.
$(OBJ_SUFFIX
)=.
$(II_SUFFIX
)) $$($(1)_COBJS
:.
$(OBJ_SUFFIX
)=.
$(I_SUFFIX
))
147 include $(1).thing.pp
151 # Usage: $(eval $(call STATIC_LIBRARY_RULES,$(static_library_thingname)))
152 define STATIC_LIBRARY_RULES
153 $(1)_BASENAME ?
= $(1)
154 $(1)_NAME
= $(LIB_PREFIX
)$$($(1)_BASENAME
).
$(LIB_SUFFIX
)
156 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_ASMOBJS
) $$($(1)_MASMOBJS
)
158 $(call MKSTATICLIB
,$$@
) $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_ASMOBJS
) $$($(1)_MASMOBJS
)
160 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
163 all:: $$($(1)_DIR
)$$($(1)_NAME
)
168 # Usage: $(eval $(call DLL_RULES,$(dll_thingname)))
170 $(1)_BASENAME ?
= $(1)
171 $(1)_NAME
= $(LIB_PREFIX
)$$($(1)_BASENAME
).
$(DLL_SUFFIX
)
173 $$($(1)_EXTRA_DEPS
) \
174 $$(foreach lib
,$$($(1)_STATIC_LIBRARIES
) $$($(1)_DLLS
),$$($$(lib
)_NAME
)) \
179 $$($(1)_EXTRA_LDFLAGS
) \
180 $$(foreach lib
,$$(OS_LIBS
),$(call EXPAND_LIBNAME
,$$(lib
))) \
184 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_COBJS
) $$($(1)_DEPS
)
185 $(call MKDLL
,$$@
) $$($(1)_CXXOBJS
) $$($(1)_COBJS
) \
186 $(LIBPATH
).
$$(foreach lib
,$$($(1)_STATIC_LIBRARIES
),$$(call EXPAND_LIBNAME
,$$(lib
))) \
187 $$(foreach lib
,$$($(1)_DLLS
),$$(call EXPAND_DLLNAME
,$$(lib
))) \
190 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
193 all:: $$($(1)_DIR
)$$($(1)_NAME
)
198 # Usage: $(eval $(call PROGRAM_RULES,$(program_thingnaame)))
200 $(1)_BASENAME ?
= $(1)
201 $(1)_NAME ?
= $$($(1)_BASENAME
)$(PROGRAM_SUFFIX
)
203 $$($(1)_EXTRA_DEPS
) \
204 $$(foreach lib
,$$($(1)_STATIC_LIBRARIES
) $$($(1)_DLLS
),$$($$(lib
)_NAME
)) \
209 $$($(1)_EXTRA_LDFLAGS
) \
210 $$(foreach lib
,$$(OS_LIBS
),$(call EXPAND_LIBNAME
,$$(lib
))) \
214 $$($(1)_DIR
)$$($(1)_NAME
): $$($(1)_CXXOBJS
) $$($(1)_DEPS
)
216 $(call MKPROGRAM
,$$@
) \
218 $(LIBPATH
).
$$(foreach lib
,$$($(1)_STATIC_LIBRARIES
),$$(call EXPAND_LIBNAME
,$$(lib
))) \
219 $$(foreach lib
,$$($(1)_DLLS
),$$(call EXPAND_DLLNAME
,$$(lib
))) \
221 $(ifneq ($POSTMKPROGRAM,''))
222 $(call POSTMKPROGRAM
,$$@
)
224 GARBAGE
+= $$($(1)_DIR
)$$($(1)_NAME
)
227 all:: $$($(1)_DIR
)$$($(1)_NAME
)