|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
Packit |
40b132 |
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
Packit |
40b132 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
#######################################################################
|
|
Packit |
40b132 |
# #
|
|
Packit |
40b132 |
# Parameters to this makefile (set these in this file): #
|
|
Packit |
40b132 |
# #
|
|
Packit |
40b132 |
# a) #
|
|
Packit |
40b132 |
# TARGETS -- the target to create #
|
|
Packit |
40b132 |
# (defaults to $LIBRARY $PROGRAM) #
|
|
Packit |
40b132 |
# b) #
|
|
Packit |
40b132 |
# DIRS -- subdirectories for make to recurse on #
|
|
Packit |
40b132 |
# (the 'all' rule builds $TARGETS $DIRS) #
|
|
Packit |
40b132 |
# c) #
|
|
Packit |
40b132 |
# CSRCS, CPPSRCS -- .c and .cpp files to compile #
|
|
Packit |
40b132 |
# (used to define $OBJS) #
|
|
Packit |
40b132 |
# d) #
|
|
Packit |
40b132 |
# PROGRAM -- the target program name to create from $OBJS #
|
|
Packit |
40b132 |
# ($OBJDIR automatically prepended to it) #
|
|
Packit |
40b132 |
# e) #
|
|
Packit |
40b132 |
# LIBRARY -- the target library name to create from $OBJS #
|
|
Packit |
40b132 |
# ($OBJDIR automatically prepended to it) #
|
|
Packit |
40b132 |
# f) #
|
|
Packit |
40b132 |
# JSRCS -- java source files to compile into class files #
|
|
Packit |
40b132 |
# (if you don't specify this it will default #
|
|
Packit |
40b132 |
# to *.java) #
|
|
Packit |
40b132 |
# g) #
|
|
Packit |
40b132 |
# PACKAGE -- the package to put the .class files into #
|
|
Packit |
40b132 |
# (e.g. netscape/applet) #
|
|
Packit |
40b132 |
# (NOTE: the default definition for this may be #
|
|
Packit |
40b132 |
# overridden if "jdk.mk" is included) #
|
|
Packit |
40b132 |
# h) #
|
|
Packit |
40b132 |
# JMC_EXPORT -- java files to be exported for use by JMC_GEN #
|
|
Packit |
40b132 |
# (this is a list of Class names) #
|
|
Packit |
40b132 |
# i) #
|
|
Packit |
40b132 |
# JRI_GEN -- files to run through javah to generate headers #
|
|
Packit |
40b132 |
# and stubs #
|
|
Packit |
40b132 |
# (output goes into the _jri sub-dir) #
|
|
Packit |
40b132 |
# j) #
|
|
Packit |
40b132 |
# JMC_GEN -- files to run through jmc to generate headers #
|
|
Packit |
40b132 |
# and stubs #
|
|
Packit |
40b132 |
# (output goes into the _jmc sub-dir) #
|
|
Packit |
40b132 |
# k) #
|
|
Packit |
40b132 |
# JNI_GEN -- files to run through javah to generate headers #
|
|
Packit |
40b132 |
# (output goes into the _jni sub-dir) #
|
|
Packit |
40b132 |
# #
|
|
Packit |
40b132 |
#######################################################################
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# CPU_TAG is now defined in the $(TARGET).mk files
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifndef COMPILER_TAG
|
|
Packit |
40b132 |
ifneq ($(DEFAULT_COMPILER), $(notdir $(firstword $(CC))))
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# Temporary define for the Client; to be removed when binary release is used
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
ifdef MOZILLA_CLIENT
|
|
Packit |
40b132 |
COMPILER_TAG =
|
|
Packit |
40b132 |
else
|
|
Packit |
40b132 |
COMPILER_TAG = _$(notdir $(firstword $(CC)))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
else
|
|
Packit |
40b132 |
COMPILER_TAG =
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifeq ($(MKPROG),)
|
|
Packit |
40b132 |
MKPROG = $(CC)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# This makefile contains rules for building the following kinds of
|
|
Packit |
40b132 |
# objects:
|
|
Packit |
40b132 |
# - (1) LIBRARY: a static (archival) library
|
|
Packit |
40b132 |
# - (2) SHARED_LIBRARY: a shared (dynamic link) library
|
|
Packit |
40b132 |
# - (3) IMPORT_LIBRARY: an import library, defined in $(OS_TARGET).mk
|
|
Packit |
40b132 |
# - (4) PROGRAM: an executable binary
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# NOTE: The names of libraries can be generated by simply specifying
|
|
Packit |
40b132 |
# LIBRARY_NAME (and LIBRARY_VERSION in the case of non-static libraries).
|
|
Packit |
40b132 |
# LIBRARY and SHARED_LIBRARY may be defined differently in $(OS_TARGET).mk
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef LIBRARY_NAME
|
|
Packit |
40b132 |
ifndef LIBRARY
|
|
Packit |
40b132 |
LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
ifndef SHARED_LIBRARY
|
|
Packit |
40b132 |
SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).$(DLL_SUFFIX)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
ifndef MAPFILE_SOURCE
|
|
Packit |
40b132 |
MAPFILE_SOURCE = $(LIBRARY_NAME).def
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
# Common rules used by lots of makefiles...
|
|
Packit |
40b132 |
#
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef PROGRAM
|
|
Packit |
40b132 |
PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef PROGRAMS
|
|
Packit |
40b132 |
PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX)))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifndef TARGETS
|
|
Packit |
40b132 |
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
# Make both .cpp and .cc work.
|
|
Packit |
40b132 |
CPPSRCS1 = $(CPPSRCS:.cpp=$(OBJ_SUFFIX))
|
|
Packit |
40b132 |
CPPSRCS2 = $(CPPSRCS1:.cc=$(OBJ_SUFFIX))
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifndef OBJS
|
|
Packit |
40b132 |
SIMPLE_OBJS = $(JRI_STUB_CFILES) \
|
|
Packit |
40b132 |
$(addsuffix $(OBJ_SUFFIX), $(JMC_GEN)) \
|
|
Packit |
40b132 |
$(CSRCS:.c=$(OBJ_SUFFIX)) \
|
|
Packit |
40b132 |
$(CPPSRCS2) \
|
|
Packit |
40b132 |
$(ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) \
|
|
Packit |
40b132 |
$(BUILT_CSRCS:.c=$(OBJ_SUFFIX)) \
|
|
Packit |
40b132 |
$(BUILT_CPPSRCS:.cpp=$(OBJ_SUFFIX)) \
|
|
Packit |
40b132 |
$(BUILT_ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX))
|
|
Packit |
40b132 |
OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifndef BUILT_SRCS
|
|
Packit |
40b132 |
BUILT_SRCS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), \
|
|
Packit |
40b132 |
$(BUILT_CSRCS) $(BUILT_CPPSRCS) $(BUILT_ASFILES))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifeq (,$(filter-out WIN%,$(OS_TARGET)))
|
|
Packit |
40b132 |
MAKE_OBJDIR = $(INSTALL) -D $(OBJDIR)
|
|
Packit |
40b132 |
else
|
|
Packit |
40b132 |
define MAKE_OBJDIR
|
|
Packit |
40b132 |
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
|
|
Packit |
40b132 |
endef
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifndef PACKAGE
|
|
Packit |
40b132 |
PACKAGE = .
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef NSBUILDROOT
|
|
Packit |
40b132 |
JDK_GEN_DIR = $(SOURCE_XP_DIR)/_gen
|
|
Packit |
40b132 |
JMC_GEN_DIR = $(SOURCE_XP_DIR)/_jmc
|
|
Packit |
40b132 |
JNI_GEN_DIR = $(SOURCE_XP_DIR)/_jni
|
|
Packit |
40b132 |
JRI_GEN_DIR = $(SOURCE_XP_DIR)/_jri
|
|
Packit |
40b132 |
JDK_STUB_DIR = $(SOURCE_XP_DIR)/_stubs
|
|
Packit |
40b132 |
else
|
|
Packit |
40b132 |
JDK_GEN_DIR = _gen
|
|
Packit |
40b132 |
JMC_GEN_DIR = _jmc
|
|
Packit |
40b132 |
JNI_GEN_DIR = _jni
|
|
Packit |
40b132 |
JRI_GEN_DIR = _jri
|
|
Packit |
40b132 |
JDK_STUB_DIR = _stubs
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
|
|
Packit |
40b132 |
so_locations $(BUILT_SRCS) $(NOSUCHFILE)
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef NS_USE_JDK
|
|
Packit |
40b132 |
ALL_TRASH += $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \
|
|
Packit |
40b132 |
$(JMC_HEADERS) $(JMC_STUBS) $(JMC_EXPORT_FILES) \
|
|
Packit |
40b132 |
$(JNI_HEADERS) \
|
|
Packit |
40b132 |
$(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) \
|
|
Packit |
40b132 |
$(JDK_GEN_DIR) $(JMC_GEN_DIR) $(JNI_GEN_DIR) \
|
|
Packit |
40b132 |
$(JRI_GEN_DIR) $(JDK_STUB_DIR)
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef JAVA_DESTPATH
|
|
Packit |
40b132 |
ALL_TRASH += $(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class)
|
|
Packit |
40b132 |
ifdef JDIRS
|
|
Packit |
40b132 |
ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
else # !JAVA_DESTPATH
|
|
Packit |
40b132 |
ALL_TRASH += $(wildcard $(PACKAGE)/*.class) $(JDIRS)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
endif #NS_USE_JDK
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef NSS_BUILD_CONTINUE_ON_ERROR
|
|
Packit |
40b132 |
# Try to build everything. I.e., don't exit on errors.
|
|
Packit |
40b132 |
EXIT_ON_ERROR = +e
|
|
Packit |
40b132 |
IGNORE_ERROR = -
|
|
Packit |
40b132 |
CLICK_STOPWATCH = date
|
|
Packit |
40b132 |
else
|
|
Packit |
40b132 |
EXIT_ON_ERROR = -e
|
|
Packit |
40b132 |
IGNORE_ERROR =
|
|
Packit |
40b132 |
CLICK_STOPWATCH = true
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef REQUIRES
|
|
Packit |
40b132 |
MODULE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/public/, $(REQUIRES))
|
|
Packit |
40b132 |
INCLUDES += $(MODULE_INCLUDES)
|
|
Packit |
40b132 |
ifeq ($(MODULE), sectools)
|
|
Packit |
40b132 |
PRIVATE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/private/, $(REQUIRES))
|
|
Packit |
40b132 |
INCLUDES += $(PRIVATE_INCLUDES)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef SYSTEM_INCL_DIR
|
|
Packit |
40b132 |
YOPT = -Y$(SYSTEM_INCL_DIR)
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
ifdef DIRS
|
|
Packit |
40b132 |
define SUBMAKE
|
|
Packit |
40b132 |
+@echo "cd $2; $(MAKE) $1"
|
|
Packit |
40b132 |
$(IGNORE_ERROR)@$(MAKE) -C $(2) $(1)
|
|
Packit |
40b132 |
@$(CLICK_STOPWATCH)
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
endef
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
LOOP_OVER_DIRS = $(foreach dir,$(DIRS),$(call SUBMAKE,$@,$(dir)))
|
|
Packit |
40b132 |
endif
|
|
Packit |
40b132 |
|
|
Packit |
40b132 |
MK_RULESET = included
|