File:  [mozdev] / abimoz / plugin / Makefile
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Oct 29 15:54:11 2001 UTC (17 years, 6 months ago) by mikep
Branches: MAIN
CVS tags: HEAD
Initial adding of files, and modified pages.

#
# Generic XPCOM component makefile
# Copyright OEone Corp.
#
# Authors: Steve Crouse, Garth Smedley, Jody McIntyre
#--------------------------------------------------------
# Usage:
#
#  make clean     - remove output files, does not install
#  make           - build the component and the test program, if not up to date
#  make reset     - delete registration files from mozilla. good idea to run this after install
#  make install   - install xpcom component into mozilla components directory
#  make uninstall - remove xpcom component from mozilla components directory
#  make dist      - tars the distribution files up.
#  make test      - run the test program
#
#  By setting the following environment variable before invoking make, you can control the directories
#  that install and uninstall use:
#
#     DESTDIR               - install/uninstall directory, ( Do not add a trailing slash )
#
#  This Makefile can be customized for use by any XPCOM component
#  by modifying some of the variables below.
#
#     MOZZY                 - Provide the path to your Mozilla installation
#     MOZZYDEV              - Provide the path to your Mozilla development installation
#     LIBRARY_NAME          - Name of the final shared object to be built
#     IDLFILE               - Components IDL file
#     IDL_OUTPUT_BASENAME   - Base name of the .xpt and .h files to be generated
#     SOURCE_FILES          - Source files needed to build component
#     HEADER_FILES          - Header files needed to build component, used for dependencies and distribution
#     EXTRA_DISTFILES       - extra files to be added to the tarball
#     TEST_PROGRAM          - Name of standalone test program
#     TEST_SOURCE_FILES     - Source files needed to build test program
#
#  You can also specify additional include paths and libraries to be linked
#  in using:
#
#     INCLUDES              - Specify any additional include paths here
#     EXTRA_LIBS            - Specify any additional libraries to be linked
#

CC = g++

# Path to src directory
#

SRC = .

# set PACKAGE and VERSION for distrbution tarball
PACKAGE=wpplugin
VERSION=0.99

# Distribution files
# Add any extra files to go in the tarball, by default .so, .idl, .xpt and Makefile are included.

EXTRA_DISTFILES= nsWPPlugin_CID.h wpplugintst.html tst.png wordp.js wordp.xul README

# Path to your Mozilla installation
#
MOZZY = /usr/lib/oemozilla
# Path to your Mozilla header files
#
MOZZYDEV = /usr/include/mozilla

# Define the name for the final shared object file
#
LIBRARY_NAME = libWPPlugin.so

# Define the name of the executable test program
#
TEST_PROGRAM = TestWPPlugin
TEST_SOURCE_FILES = TestWPPlugin.cpp

# Provide the name for the components IDL file
#
IDLFILE = $(SRC)/nsWPPluginControl.idl

# Define the base name for the generated .h and .xpt files
#
IDL_OUTPUT_BASENAME = nsWPPluginControl

# List the source files needed for building the component
#
SOURCE_FILES = $(SRC)/nsWPPluginFactory.cpp $(SRC)/nsWPPlugin.cpp
HEADER_FILES = $(SRC)/nsWPPluginFactory.h $(SRC)/nsWPPlugin.h

# List any custom include paths here
#
INCLUDES = -I ./ -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/gtk-1.2 -I/usr/include/libole2 -I/usr/local/include -fno-rtti -DPLUGIN_DEBUG

# List any custom libraries to be linked here
#
EXTRA_LIBS = -lgtksuperwin -L $(SRC)/../libabiword -lAbiWord

# Mozilla directories
#
MOZINCLUDES = -I $(MOZZYDEV) -I $(MOZZYDEV)/nspr
MOZIDLS = $(MOZZYDEV)/idl
MOZLIBS = $(MOZZY)
MOZCOMPONENTS = $(MOZZY)/components
MOZINSTALL = $(DESTDIR)/$(MOZCOMPONENTS)
MOZPLUGINS = $(DESTDIR)/$(MOZZY)/plugins

XPIDL = $(MOZLIBS)/xpidl

# Standard Netscape Portable Runtime and XPCOM libraries to be linked in
#
NSPR_LIBS =
XPCOM_LIBS = -L $(MOZLIBS) -lxpcom

LIBS = $(NSPR_LIBS) $(XPCOM_LIBS) $(EXTRA_LIBS)
TESTLIBS = $(NSPR_LIBS) $(XPCOM_LIBS)



# Make targets
#

all: $(LIBRARY_NAME) $(IDLFILE) $(TEST_PROGRAM)

clean:
	rm  -f *.obj *.pdb *.res *.map *.lib *.exp *.o *.so *.dll *.xpt $(IDL_OUTPUT_BASENAME).h $(TEST_PROGRAM)

reset:
	rm -f $(MOZZY)/component.reg
	rm -f $(MOZZY)/chrome/*.rdf

install:
	install -d $(MOZINSTALL)/
	install $(LIBRARY_NAME) $(MOZINSTALL)/
	install $(IDL_OUTPUT_BASENAME).xpt $(MOZINSTALL)/
	install -d $(MOZPLUGINS)/
	install $(LIBRARY_NAME) $(MOZPLUGINS)/

uninstall:
	rm $(MOZINSTALL)/$(LIBRARY_NAME)
	rm $(MOZINSTALL)/$(IDL_OUTPUT_BASENAME).xpt

test:
	export NSPR_LOG_MODULES=nsComponentManager:5;\
         export NSPR_LOG_FILE=xpcom.log;\
         export MOZILLA_FIVE_HOME=$(MOZZY);\
         export LD_LIBRARY_PATH=$(MOZZY);\
         ./$(TEST_PROGRAM)


# Builds xpcom shared object

$(LIBRARY_NAME): $(SOURCE_FILES) $(HEADER_FILES) $(IDL_OUTPUT_BASENAME)
	$(CC) -shared -o $(LIBRARY_NAME) $(SOURCE_FILES)  $(MOZINCLUDES)  $(INCLUDES) $(LIBS)


# Generates .xpt and .h files from the IDL

$(IDLFILE): $(IDL_OUTPUT_BASENAME)

$(IDL_OUTPUT_BASENAME):
	$(XPIDL) -m typelib -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)
	$(XPIDL) -m header -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)


# Build test program

$(TEST_PROGRAM) : $(TEST_SOURCE_FILES)
	$(CC) -o $(TEST_PROGRAM) $(TEST_SOURCE_FILES) $(MOZINCLUDES)  $(INCLUDES) $(TESTLIBS)  -lplds4 -lplc4 -lnspr4




# distribution build

DISTFILES= $(SOURCE_FILES) $(HEADER_FILES) $(IDLFILE) $(TEST_SOURCE_FILES) Makefile $(EXTRA_DISTFILES)

distdir = $(PACKAGE)-$(VERSION)

dist: distdir
	chmod -R a+r $(distdir)
	tar czf $(distdir).tar.gz $(distdir)
	rm -rf $(distdir)

distdir:
	rm -rf $(distdir)
	mkdir $(distdir)
	for file in $(DISTFILES); do \
       cp -p $$file $(distdir) ;\
	done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>