Building a component DLL
From MDC
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 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsFileViewModule REQUIRES = \ xpcom \ layout \ dom \ string \ locale \ $(NULL) CPPSRCS = \ nsFileView.cpp \ nsWildCard.cpp \ $(NULL) include $(topsrcdir)/config/rules.mk EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
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.
IfLIBRARY_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. IfLIBRARY_NAMEis 8 characters or less, you do not need to specifySHORT_LIBNAME. - EXPORT_LIBRARY should be set to 1 unless you want to make sure your module is a shared library even in a static build.
- 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
NS_IMPL_NSGETMODULEcall. - REQUIRES is a list of other modules whose header files you need to include. dist/include/module_name is 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 has
$(MOZ_COMPONENT_LIBS)added to it. These are extra libraries and linker flags necessary for building components.