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, 11 months ago) by mikep
Branches: MAIN
CVS tags: HEAD
Initial adding of files, and modified pages.

    1: #
    2: # Generic XPCOM component makefile
    3: # Copyright OEone Corp.
    4: #
    5: # Authors: Steve Crouse, Garth Smedley, Jody McIntyre
    6: #--------------------------------------------------------
    7: # Usage:
    8: #
    9: #  make clean     - remove output files, does not install
   10: #  make           - build the component and the test program, if not up to date
   11: #  make reset     - delete registration files from mozilla. good idea to run this after install
   12: #  make install   - install xpcom component into mozilla components directory
   13: #  make uninstall - remove xpcom component from mozilla components directory
   14: #  make dist      - tars the distribution files up.
   15: #  make test      - run the test program
   16: #
   17: #  By setting the following environment variable before invoking make, you can control the directories
   18: #  that install and uninstall use:
   19: #
   20: #     DESTDIR               - install/uninstall directory, ( Do not add a trailing slash )
   21: #
   22: #  This Makefile can be customized for use by any XPCOM component
   23: #  by modifying some of the variables below.
   24: #
   25: #     MOZZY                 - Provide the path to your Mozilla installation
   26: #     MOZZYDEV              - Provide the path to your Mozilla development installation
   27: #     LIBRARY_NAME          - Name of the final shared object to be built
   28: #     IDLFILE               - Components IDL file
   29: #     IDL_OUTPUT_BASENAME   - Base name of the .xpt and .h files to be generated
   30: #     SOURCE_FILES          - Source files needed to build component
   31: #     HEADER_FILES          - Header files needed to build component, used for dependencies and distribution
   32: #     EXTRA_DISTFILES       - extra files to be added to the tarball
   33: #     TEST_PROGRAM          - Name of standalone test program
   34: #     TEST_SOURCE_FILES     - Source files needed to build test program
   35: #
   36: #  You can also specify additional include paths and libraries to be linked
   37: #  in using:
   38: #
   39: #     INCLUDES              - Specify any additional include paths here
   40: #     EXTRA_LIBS            - Specify any additional libraries to be linked
   41: #
   42: 
   43: CC = g++
   44: 
   45: # Path to src directory
   46: #
   47: 
   48: SRC = .
   49: 
   50: # set PACKAGE and VERSION for distrbution tarball
   51: PACKAGE=wpplugin
   52: VERSION=0.99
   53: 
   54: # Distribution files
   55: # Add any extra files to go in the tarball, by default .so, .idl, .xpt and Makefile are included.
   56: 
   57: EXTRA_DISTFILES= nsWPPlugin_CID.h wpplugintst.html tst.png wordp.js wordp.xul README
   58: 
   59: # Path to your Mozilla installation
   60: #
   61: MOZZY = /usr/lib/oemozilla
   62: # Path to your Mozilla header files
   63: #
   64: MOZZYDEV = /usr/include/mozilla
   65: 
   66: # Define the name for the final shared object file
   67: #
   68: LIBRARY_NAME = libWPPlugin.so
   69: 
   70: # Define the name of the executable test program
   71: #
   72: TEST_PROGRAM = TestWPPlugin
   73: TEST_SOURCE_FILES = TestWPPlugin.cpp
   74: 
   75: # Provide the name for the components IDL file
   76: #
   77: IDLFILE = $(SRC)/nsWPPluginControl.idl
   78: 
   79: # Define the base name for the generated .h and .xpt files
   80: #
   81: IDL_OUTPUT_BASENAME = nsWPPluginControl
   82: 
   83: # List the source files needed for building the component
   84: #
   85: SOURCE_FILES = $(SRC)/nsWPPluginFactory.cpp $(SRC)/nsWPPlugin.cpp
   86: HEADER_FILES = $(SRC)/nsWPPluginFactory.h $(SRC)/nsWPPlugin.h
   87: 
   88: # List any custom include paths here
   89: #
   90: 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
   91: 
   92: # List any custom libraries to be linked here
   93: #
   94: EXTRA_LIBS = -lgtksuperwin -L $(SRC)/../libabiword -lAbiWord
   95: 
   96: # Mozilla directories
   97: #
   98: MOZINCLUDES = -I $(MOZZYDEV) -I $(MOZZYDEV)/nspr
   99: MOZIDLS = $(MOZZYDEV)/idl
  100: MOZLIBS = $(MOZZY)
  101: MOZCOMPONENTS = $(MOZZY)/components
  102: MOZINSTALL = $(DESTDIR)/$(MOZCOMPONENTS)
  103: MOZPLUGINS = $(DESTDIR)/$(MOZZY)/plugins
  104: 
  105: XPIDL = $(MOZLIBS)/xpidl
  106: 
  107: # Standard Netscape Portable Runtime and XPCOM libraries to be linked in
  108: #
  109: NSPR_LIBS =
  110: XPCOM_LIBS = -L $(MOZLIBS) -lxpcom
  111: 
  112: LIBS = $(NSPR_LIBS) $(XPCOM_LIBS) $(EXTRA_LIBS)
  113: TESTLIBS = $(NSPR_LIBS) $(XPCOM_LIBS)
  114: 
  115: 
  116: 
  117: # Make targets
  118: #
  119: 
  120: all: $(LIBRARY_NAME) $(IDLFILE) $(TEST_PROGRAM)
  121: 
  122: clean:
  123: 	rm  -f *.obj *.pdb *.res *.map *.lib *.exp *.o *.so *.dll *.xpt $(IDL_OUTPUT_BASENAME).h $(TEST_PROGRAM)
  124: 
  125: reset:
  126: 	rm -f $(MOZZY)/component.reg
  127: 	rm -f $(MOZZY)/chrome/*.rdf
  128: 
  129: install:
  130: 	install -d $(MOZINSTALL)/
  131: 	install $(LIBRARY_NAME) $(MOZINSTALL)/
  132: 	install $(IDL_OUTPUT_BASENAME).xpt $(MOZINSTALL)/
  133: 	install -d $(MOZPLUGINS)/
  134: 	install $(LIBRARY_NAME) $(MOZPLUGINS)/
  135: 
  136: uninstall:
  137: 	rm $(MOZINSTALL)/$(LIBRARY_NAME)
  138: 	rm $(MOZINSTALL)/$(IDL_OUTPUT_BASENAME).xpt
  139: 
  140: test:
  141: 	export NSPR_LOG_MODULES=nsComponentManager:5;\
  142:          export NSPR_LOG_FILE=xpcom.log;\
  143:          export MOZILLA_FIVE_HOME=$(MOZZY);\
  144:          export LD_LIBRARY_PATH=$(MOZZY);\
  145:          ./$(TEST_PROGRAM)
  146: 
  147: 
  148: # Builds xpcom shared object
  149: 
  150: $(LIBRARY_NAME): $(SOURCE_FILES) $(HEADER_FILES) $(IDL_OUTPUT_BASENAME)
  151: 	$(CC) -shared -o $(LIBRARY_NAME) $(SOURCE_FILES)  $(MOZINCLUDES)  $(INCLUDES) $(LIBS)
  152: 
  153: 
  154: # Generates .xpt and .h files from the IDL
  155: 
  156: $(IDLFILE): $(IDL_OUTPUT_BASENAME)
  157: 
  158: $(IDL_OUTPUT_BASENAME):
  159: 	$(XPIDL) -m typelib -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)
  160: 	$(XPIDL) -m header -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)
  161: 
  162: 
  163: # Build test program
  164: 
  165: $(TEST_PROGRAM) : $(TEST_SOURCE_FILES)
  166: 	$(CC) -o $(TEST_PROGRAM) $(TEST_SOURCE_FILES) $(MOZINCLUDES)  $(INCLUDES) $(TESTLIBS)  -lplds4 -lplc4 -lnspr4
  167: 
  168: 
  169: 
  170: 
  171: # distribution build
  172: 
  173: DISTFILES= $(SOURCE_FILES) $(HEADER_FILES) $(IDLFILE) $(TEST_SOURCE_FILES) Makefile $(EXTRA_DISTFILES)
  174: 
  175: distdir = $(PACKAGE)-$(VERSION)
  176: 
  177: dist: distdir
  178: 	chmod -R a+r $(distdir)
  179: 	tar czf $(distdir).tar.gz $(distdir)
  180: 	rm -rf $(distdir)
  181: 
  182: distdir:
  183: 	rm -rf $(distdir)
  184: 	mkdir $(distdir)
  185: 	for file in $(DISTFILES); do \
  186:        cp -p $$file $(distdir) ;\
  187: 	done

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