2
2
# vim:set ts=8 sw=8 sts=8 noet:
4
# ***** BEGIN LICENSE BLOCK *****
5
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
7
# The contents of this file are subject to the Mozilla Public License Version
8
# 1.1 (the "License"); you may not use this file except in compliance with
9
# the License. You may obtain a copy of the License at
10
# http://www.mozilla.org/MPL/
12
# Software distributed under the License is distributed on an "AS IS" basis,
13
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
# for the specific language governing rights and limitations under the
17
# The Original Code is mozilla.org code.
19
# The Initial Developer of the Original Code is
20
# Netscape Communications Corporation.
21
# Portions created by the Initial Developer are Copyright (C) 1998
22
# the Initial Developer. All Rights Reserved.
25
# Chase Phillips <chase@mozilla.org>
26
# Benjamin Smedberg <benjamin@smedbergs.us>
27
# Jeff Walden <jwalden+code@mit.edu>
28
# Joey Armstrong <joey@mozilla.com>
30
# Alternatively, the contents of this file may be used under the terms of
31
# either of the GNU General Public License Version 2 or later (the "GPL"),
32
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
33
# in which case the provisions of the GPL or the LGPL are applicable instead
34
# of those above. If you wish to allow use of your version of this file only
35
# under the terms of either the GPL or the LGPL, and not to allow others to
36
# use your version of this file under the terms of the MPL, indicate your
37
# decision by deleting the provisions above and replace them with the notice
38
# and other provisions required by the GPL or the LGPL. If you do not delete
39
# the provisions above, a recipient may use your version of this file under
40
# the terms of any one of the MPL, the GPL or the LGPL.
42
# ***** END LICENSE BLOCK *****
4
# This Source Code Form is subject to the terms of the Mozilla Public
5
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
6
# You can obtain one at http://mozilla.org/MPL/2.0/.
45
10
$(error topsrcdir was not set))
512
480
# A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
513
481
# variables we know to check can just set NEED_MDDEPDIR explicitly.
514
482
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
515
MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
516
GARBAGE_DIRS += $(MDDEPDIR)
483
MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
484
GARBAGE_DIRS += $(CURDIR)/$(MDDEPDIR)
780
748
# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
781
DO_EXPAND_LIBS = $(foreach f,$(1),$(if $(filter %.$(LIB_SUFFIX),$(f)),$(if $(wildcard $(f).$(LIBS_DESC_SUFFIX)),$(f).$(LIBS_DESC_SUFFIX),$(if $(wildcard $(f)),$(f)))))
782
LIBS_DEPS = $(call DO_EXPAND_LIBS,$(filter %.$(LIB_SUFFIX),$(LIBS) $(if $(PROGRAM)$(SIMPLE_PROGRAMS),$(MOZ_GLUE_PROGRAM_LDFLAGS))))
783
SHARED_LIBRARY_LIBS_DEPS = $(call DO_EXPAND_LIBS,$(SHARED_LIBRARY_LIBS))
749
ifneq (,$(strip $(filter %.$(LIB_SUFFIX),$(LIBS) $(EXTRA_DSO_LDOPTS)) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LIBS)))
750
$(MDDEPDIR)/libs: Makefile.in
751
@mkdir -p $(MDDEPDIR)
752
@$(EXPAND_LIBS_DEPS) LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(LIBS)) , \
753
SHARED_LIBRARY_LIBS_DEPS = $(SHARED_LIBRARY_LIBS) , \
754
DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)) > $@
756
ifneq (,$(wildcard $(MDDEPDIR)/libs))
757
include $(MDDEPDIR)/libs
760
$(MDDEPDIR)/libs: $(wildcard $(filter %.$(LIBS_DESC_SUFFIX),$(LIBS_DEPS) $(SHARED_LIBRARY_LIBS_DEPS) $(DSO_LDOPTS_DEPS)))
762
EXTRA_DEPS += $(MDDEPDIR)/libs
784
765
HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
785
DSO_LDOPTS_DEPS = $(call DO_EXPAND_LIBS,$(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)))
787
767
# Dependencies which, if modified, should cause everything to rebuild
788
768
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
901
881
touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
903
883
else # !WINNT || GNU_CC
904
ifeq ($(CPP_PROG_LINK),1)
905
884
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
906
885
@$(call CHECK_STDCXX,$@)
907
else # ! CPP_PROG_LINK
908
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
909
endif # CPP_PROG_LINK
910
886
endif # WINNT && !GNU_CC
912
888
ifdef ENABLE_STRIP
960
936
endif # MSVC with manifest tool
962
ifeq ($(CPP_PROG_LINK),1)
963
938
$(EXPAND_CCC) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS)
964
939
@$(call CHECK_STDCXX,$@)
966
$(EXPAND_CC) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS)
967
endif # CPP_PROG_LINK
968
940
endif # WINNT && !GNU_CC
970
942
ifdef ENABLE_STRIP
1144
1116
endif # MOZ_AUTO_DEPS
1118
$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS)
1146
1120
# Rules for building native targets must come first because of the host_ prefix
1147
host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1121
host_%.$(OBJ_SUFFIX): %.c
1148
1122
$(REPORT_BUILD)
1149
1123
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1151
host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1153
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1155
host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1157
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1159
host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1125
host_%.$(OBJ_SUFFIX): %.cpp
1127
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1129
host_%.$(OBJ_SUFFIX): %.cc
1131
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1133
host_%.$(OBJ_SUFFIX): %.m
1160
1134
$(REPORT_BUILD)
1161
1135
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1163
host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1137
host_%.$(OBJ_SUFFIX): %.mm
1164
1138
$(REPORT_BUILD)
1165
1139
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1177
1151
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
1178
1152
# 'moc' only knows about #defines it gets on the command line (-D...), not in
1179
1153
# included headers like mozilla-config.h
1180
moc_%.cpp: %.h $(GLOBAL_DEPS)
1181
1155
$(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
1183
moc_%.cc: %.cc $(GLOBAL_DEPS)
1184
1158
$(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $(_VPATH_SRCS:.cc=.h) $(OUTOPTION)$@
1186
qrc_%.cpp: %.qrc $(GLOBAL_DEPS)
1187
1161
$(ELOG) $(RCC) -name $* $< $(OUTOPTION)$@
1190
1164
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1192
%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1166
%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX)
1193
1167
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1196
%.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1170
%.$(OBJ_SUFFIX): %.S
1197
1171
$(AS) -o $@ $(ASFLAGS) -c $<
1199
1173
%:: %.cpp $(GLOBAL_DEPS)
1219
1193
$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1220
1194
endif #STRICT_CPLUSPLUS_SUFFIX
1222
$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1196
$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm
1223
1197
$(REPORT_BUILD)
1224
1198
@$(MAKE_DEPS_AUTO_CXX)
1225
1199
$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1227
$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1201
$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m
1228
1202
$(REPORT_BUILD)
1229
1203
@$(MAKE_DEPS_AUTO_CC)
1230
1204
$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1462
1436
# generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
1463
1437
# warn against overriding existing .h file.
1464
$(XPIDL_GEN_DIR)/.done:
1465
$(MKDIR) -p $(XPIDL_GEN_DIR)
1468
# don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1469
# with any addition to the directory, regenerating all .h files -> everything.
1472
1440
$(topsrcdir)/xpcom/idl-parser/header.py \
1474
1442
$(topsrcdir)/xpcom/idl-parser/xpidl.py \
1477
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
1446
$(call mkdir_deps,$(XPIDL_GEN_DIR)) \
1447
$(call mkdir_deps,$(MDDEPDIR)) \
1450
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
1478
1451
$(REPORT_BUILD)
1479
1452
$(PYTHON_PATH) \
1480
-I$(topsrcdir)/other-licenses/ply \
1481
1454
-I$(topsrcdir)/xpcom/idl-parser \
1482
1455
$(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
1483
1456
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
1486
1459
ifndef NO_GEN_XPT
1487
1460
# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1488
1461
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1489
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
1462
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
1490
1463
$(REPORT_BUILD)
1491
1464
$(PYTHON_PATH) \
1492
-I$(topsrcdir)/other-licenses/ply \
1493
1466
-I$(topsrcdir)/xpcom/idl-parser \
1494
1467
-I$(topsrcdir)/xpcom/typelib/xpt/tools \
1495
1468
$(topsrcdir)/xpcom/idl-parser/typelib.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
2028
2001
CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \
2029
2002
$(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).)))
2032
2005
$(CHECK_FROZEN_VARIABLES)
2035
2008
if test -d $(DIST)/bin ; then touch $(DIST)/bin/.purgecaches ; fi
2011
#############################################################################
2012
# Derived targets and dependencies
2014
include $(topsrcdir)/config/makefiles/autotargets.mk
2015
ifneq ($(NULL),$(AUTO_DEPS))
2016
default all libs tools export:: $(AUTO_DEPS)