Here is an example
Makefile.in for building an XPCOM component library. In this example, all of the source files are in the same directory.
DEPTH = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk
MODULE = filepicker LIBRARY_NAME = fileview SHORT_LIBNAME = fileview
FORCE_SHARED_LIB = 1IS_COMPONENT = 1 MODULE_NAME = nsFileViewModule REQUIRES = \ xpcom \ layout \ dom \ string \ locale \ $(NULL) CPPSRCS = \ nsFileView.cpp \ nsWildCard.cpp \ $(NULL) EXTRA_DSO_LDOPTS += $(XPCOM_GLUE_LDOPTS) include $(topsrcdir)/config/rules.mk
There are several variables involved here:
- MODULE should be set to a short name for this module of code.
- LIBRARY_NAME should be set to the base name of the shared library that should be created for this module. You should not prepend "lib" or append any suffix such as "dll" to this name.
LIBRARY_NAMEis longer than 8 characters, you should set SHORT_LIBNAME to an 8 character or less name for this library. This is to address limitations on Windows and OS/2. If
LIBRARY_NAMEis 8 characters or less, you do not need to specify
- EXPORT_LIBRARY should be set to 1 unless FORCE_SHARED_LIB is set.
- FORCE_SHARED_LIB should be set to 1, if your module is a shared library (.dll) even in a static build (libxul). Normally, that's what you want for libraries that are not part of core Mozilla.
- IS_COMPONENT should be set to 1 for all components.
- MODULE_NAME is used mainly for static builds, and should match the module name used in your
- REQUIRES is a list of other modules whose header files you need to include.
dist/include/module_nameis added to the compiler include list for each module you specify in REQUIRES.
- CPPSRCS lists the C++ files to compile in this directory. You can use CSRCS to specify C files.
- EXTRA_DSO_LDOPTS are extra libraries and linker flags necessary for building components. Components using the external API have
)added to it. Use this for FORCE_SHARED_LIB. Core Mozilla libs, which are part of libxul and use the internal API, use