File:  [mozdev] / abimoz / plugin / Makefile
Revision 1.7: download - view: text, annotated - select for diffs - revision graph
Fri Oct 25 14:42:28 2002 UTC (15 years, 1 month ago) by mikep
Branches: MAIN
CVS tags: HEAD
Upgraded to Mozilla 1.2b and abiword 1.0.3.

#This file is part of AbiMoz.
#
#Makefile - To build the plugin
#Copyright (C) 2001 OEone Corporation
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#The author of this program can be contacted in writing at
#OEone Corporation, 290 St-Joseph Blvd., Hull, QC J8Y 3Y3, CANADA.

#
# 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=abimoz
VERSION=0.1

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

EXTRA_DISTFILES= wpplugintst.html README wordp.js wordp.xul tst.png abi

# Path to your Mozilla installation
#
MOZZY = $(HOME)/mozilla.cvs/dist/bin
# Path to your Mozilla header files
#
MOZZYDEV = $(HOME)/mozilla.cvs/dist/include

# 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)/nsWPPlugin.cpp $(SRC)/pnWPPluginScriptablePeer.cpp $(SRC)/npp_gate.cpp $(SRC)/npunix.c
HEADER_FILES = $(SRC)/nsWPPlugin.h $(SRC)/pnWPPluginScriptablePeer.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 -DPLUGIN_DEBUG
 
# List any custom libraries to be linked here
#
EXTRA_LIBS =
 
# -lgtksuperwin

# Mozilla directories

MOZINCLUDES = -I $(MOZZYDEV) -I $(MOZZYDEV)/nspr -I $(MOZZYDEV)/plugin -I $(MOZZYDEV)/xpcom -I $(MOZZYDEV)/string -I $(MOZZYDEV)/widget -I $(MOZZYDEV)/java 
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 *.xpt *.dll $(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 $(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)


########################################## ABIWORD SETTINGS ######################################################
ABIWORD_DEFINES= -DABIWORD_APP_NAME=\"WordProcessor\" -DABIWORD_APP_LIBDIR=\"\" -DHAVE_LIBJPEG
ABIWORD_FLAGS= -O2 -Wall -ansi -pedantic -DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR -D_XOPEN_SOURCE -D__USE_XOPEN_EXTENDED -DNDEBUG
ABIBUILD= $(HOME)/rpmbuild/BUILD/abiword-1.0.3
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 \
-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 \
-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 \
-I$(ABIBUILD)/abi/src/af/gr/unix -I$(ABIBUILD)/abi/src/other/spell/xp -I$(ABIBUILD)/expat/lib
ABILIBPATH= `ls -d $(ABIBUILD)/abi/src/L*`/obj
ABILINKFLAGS= -lgtk -lgdk -lpng -ljpeg -L$(ABILIBPATH) -lAbiGr -lAbiFmt  -lAbiPTbl -lAbiImpExp -lAbiXAp -lAbiWPAp -lAbiEv -lAbiUtil -lAbiWordVer -lAbiSpell\
-lAbi_libwv -L$(ABIBUILD)/psiconv/psiconv/.libs -lpsiconv -L$(ABIBUILD)/expat/lib/.libs -lexpat -lAbiXAp -lAbiWPAp -lAbiGr
ABIOBJS= main.o xap_UnixFrame.o ap_UnixApp.o js_ViewListener.o

LIBS += $(ABILINKFLAGS)
########################################## ABIWORD SETTINGS ######################################################

# Builds xpcom shared object

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

main.o: $(SRC)/abi/main.cpp
	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/main.cpp

xap_UnixFrame.o: $(SRC)/abi/xap_UnixFrame.cpp
	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/xap_UnixFrame.cpp

ap_UnixApp.o: $(SRC)/abi/ap_UnixApp.cpp
	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/ap_UnixApp.cpp

js_ViewListener.o: $(SRC)/abi/js_ViewListener.cpp
	$(CC) -c $(ABIWORD_DEFINES) $(ABIWORD_FLAGS) $(ABIINCLUDES) $(SRC)/abi/js_ViewListener.cpp

# 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 \
	if [ -f $$file ]; then\
		cp -p $$file $(distdir);\
	fi\
	done
	for dir in $(DISTFILES); do \
	if [ -d $$dir ]; then\
		cp -r $$dir $(distdir);\
	fi\
	done

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