File:  [mozdev] / abimoz / plugin / Makefile
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Mon Nov 5 19:00:23 2001 UTC (17 years, 11 months ago) by mostafa
Branches: MAIN
CVS tags: HEAD
Restructured plugin to contain AbiWord code in itself.

    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=moziword
   52: VERSION=0.1
   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 README wordp.js wordp.xul tst.png abi
   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 -DPLUGIN_DEBUG
   91:  
   92: #-I ./ -I/usr/include/gtk-1.2 -I/usr/include/libole2 -I/usr/local/include -fno-rtti
   93: 
   94: # List any custom libraries to be linked here
   95: #
   96: EXTRA_LIBS =
   97:  
   98: # -lgtksuperwin
   99: 
  100: # Mozilla directories
  101: 
  102: MOZINCLUDES = -I $(MOZZYDEV) -I $(MOZZYDEV)/nspr -I $(MOZZYDEV)/plugin -I $(MOZZYDEV)/xpcom -I $(MOZZYDEV)/string -I $(MOZZYDEV)/widget
  103: MOZIDLS = $(MOZZYDEV)/idl
  104: MOZLIBS = $(MOZZY)
  105: MOZCOMPONENTS = $(MOZZY)/components
  106: MOZINSTALL = $(DESTDIR)/$(MOZCOMPONENTS)
  107: MOZPLUGINS = $(MOZZY)/plugins
  108: 
  109: XPIDL = $(MOZLIBS)/xpidl
  110: 
  111: # Standard Netscape Portable Runtime and XPCOM libraries to be linked in
  112: #
  113: NSPR_LIBS =
  114: XPCOM_LIBS = -L $(MOZLIBS) -lxpcom
  115: 
  116: LIBS = $(NSPR_LIBS) $(XPCOM_LIBS) $(EXTRA_LIBS)
  117: TESTLIBS = $(NSPR_LIBS) $(XPCOM_LIBS)
  118: 
  119: 
  120: 
  121: # Make targets
  122: #
  123: 
  124: all: $(LIBRARY_NAME) $(IDLFILE) $(TEST_PROGRAM)
  125: 
  126: clean:
  127: 	rm  -f *.obj *.pdb *.res *.map *.lib *.exp *.o *.so *.dll *.xpt $(IDL_OUTPUT_BASENAME).h $(TEST_PROGRAM)
  128: 
  129: reset:
  130: 	rm -f $(MOZZY)/component.reg
  131: 	rm -f $(MOZZY)/chrome/*.rdf
  132: 
  133: install:
  134: 	install -d $(MOZINSTALL)/
  135: 	install $(LIBRARY_NAME) $(MOZINSTALL)/
  136: 	install $(IDL_OUTPUT_BASENAME).xpt $(MOZINSTALL)/
  137: 	install $(LIBRARY_NAME) $(MOZPLUGINS)/
  138: 
  139: uninstall:
  140: 	rm $(MOZINSTALL)/$(LIBRARY_NAME)
  141: 	rm $(MOZINSTALL)/$(IDL_OUTPUT_BASENAME).xpt
  142: 
  143: test:
  144: 	export NSPR_LOG_MODULES=nsComponentManager:5;\
  145:          export NSPR_LOG_FILE=xpcom.log;\
  146:          export MOZILLA_FIVE_HOME=$(MOZZY);\
  147:          export LD_LIBRARY_PATH=$(MOZZY);\
  148:          ./$(TEST_PROGRAM)
  149: 
  150: 
  151: ########################################## ABIWORD SETTINGS ######################################################
  152: ABIWORD_DEFINES= -DABIWORD_APP_NAME=\"WordProcessor\" -DABIWORD_APP_LIBDIR=\"\" -DVERSION=\"1.1\"
  153: ABIWORD_FLAGS= -O2 -Wall -ansi -pedantic -DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR -D_XOPEN_SOURCE -D__USE_XOPEN_EXTENDED -DNDEBUG
  154: ABIBUILD= /usr/local/oe-abiword-devel
  155: ABIINCLUDES= $(INCLUDES) -I$(ABIBUILD)/abi/src/af/util/xp -I$(ABIBUILD)/abi/src/af/xap/xp -I$(ABIBUILD)/abi/src/wp/ap/unix -I$(ABIBUILD)/abi/src/wp/ap/xp \
  156: -I$(ABIBUILD)/abi/src/af/xap/unix -I$(ABIBUILD)/abi/src/text/ptbl/xp -I$(ABIBUILD)/abi/src/af/ev/unix -I$(ABIBUILD)/abi/src/af/ev/xp \
  157: -I$(ABIBUILD)/abi/src/af/util/unix -I$(ABIBUILD)/abi/src/wp/impexp/xp -I$(ABIBUILD)/abi/src/text/fmt/xp -I$(ABIBUILD)/abi/src/af/gr/xp \
  158: -I$(ABIBUILD)/abi/src/af/gr/unix -I$(ABIBUILD)/abi/src/other/spell/xp -I$(ABIBUILD)/expat/lib
  159: ABILIBPATH= $(ABIBUILD)/abi/src/Linux_2.4.6_i386_OBJ/obj
  160: ABILINKFLAGS= -lgtk -lgdk -lpng -L$(ABILIBPATH) -lAbiGr -lAbiFmt  -lAbiPTbl -lAbiImpExp -lAbiXAp -lAbiWPAp -lAbiEv -lAbiUtil -lAbiWordVer -lAbiSpell\
  161: -lAbi_libwv -L$(ABIBUILD)/psiconv/psiconv/.libs -lpsiconv -L$(ABIBUILD)/expat/lib/.libs -lexpat -lAbiXAp -lAbiWPAp -lAbiGr
  162: ABIOBJS= main.o xap_UnixFrame.o ap_UnixFrame.o ap_UnixApp.o ev_UnixToolbar.o
  163: 
  164: LIBS += $(ABILINKFLAGS)
  165: ########################################## ABIWORD SETTINGS ######################################################
  166: 
  167: # Builds xpcom shared object
  168: 
  169: $(LIBRARY_NAME): $(SOURCE_FILES) $(HEADER_FILES) $(IDL_OUTPUT_BASENAME) $(ABIOBJS)
  170: 	$(CC) -shared -o $(LIBRARY_NAME) $(SOURCE_FILES) $(ABIOBJS) $(MOZINCLUDES) $(INCLUDES) $(LIBS)
  171: 
  172: main.o: $(SRC)/abi/main.cpp
  173: 	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/main.cpp
  174: 
  175: xap_UnixFrame.o: $(SRC)/abi/xap_UnixFrame.cpp
  176: 	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/xap_UnixFrame.cpp
  177: 
  178: ap_UnixFrame.o: $(SRC)/abi/ap_UnixFrame.cpp
  179: 	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/ap_UnixFrame.cpp
  180: 
  181: ap_UnixApp.o: $(SRC)/abi/ap_UnixApp.cpp
  182: 	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/ap_UnixApp.cpp
  183: 
  184: ev_UnixToolbar.o: $(SRC)/abi/ev_UnixToolbar.cpp
  185: 	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/ev_UnixToolbar.cpp
  186: 
  187: # Generates .xpt and .h files from the IDL
  188: 
  189: $(IDLFILE): $(IDL_OUTPUT_BASENAME)
  190: 
  191: $(IDL_OUTPUT_BASENAME):
  192: 	$(XPIDL) -m typelib -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)
  193: 	$(XPIDL) -m header -w -I $(MOZIDLS) -o $(IDL_OUTPUT_BASENAME) $(IDLFILE)
  194: 
  195: 
  196: # Build test program
  197: 
  198: $(TEST_PROGRAM) : $(TEST_SOURCE_FILES)
  199: 	$(CC) -o $(TEST_PROGRAM) $(TEST_SOURCE_FILES) $(MOZINCLUDES) $(INCLUDES) $(TESTLIBS)  -lplds4 -lplc4 -lnspr4
  200: 
  201: 
  202: 
  203: 
  204: # distribution build
  205: 
  206: DISTFILES= $(SOURCE_FILES) $(HEADER_FILES) $(IDLFILE) $(TEST_SOURCE_FILES) Makefile $(EXTRA_DISTFILES)
  207: 
  208: distdir = $(PACKAGE)-$(VERSION)
  209: 
  210: dist: distdir
  211: 	chmod -R a+r $(distdir)
  212: 	tar czf $(distdir).tar.gz $(distdir)
  213: 	rm -rf $(distdir)
  214: 
  215: distdir:
  216: 	rm -rf $(distdir)
  217: 	mkdir $(distdir)
  218: 	for file in $(DISTFILES); do \
  219: 	if [ -f $$file ]; then\
  220: 		cp -p $$file $(distdir);\
  221: 	fi\
  222: 	done
  223: 	for dir in $(DISTFILES); do \
  224: 	if [ -d $$dir ]; then\
  225: 		cp -r $$dir $(distdir);\
  226: 	fi\
  227: 	done

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