gecko-dev/java/xpcom/test/Makefile.test
frankm%eng.sun.com 926dd894bf Modularize code (somewhat), general cleanup. Proxy-related code has
been moved to xpj_proxy.c, code used only for testing has been copied
into xptest.cpp, and each "module" now has its own header (for internal
use only).
1999-09-16 18:50:27 +00:00

94 lines
2.1 KiB
Makefile

# Makefile
MOZILLA=../../..
CC=gcc
CPP=g++
CFLAGS=-Wall -g -fno-rtti -fno-handle-exceptions -pipe
SHLIB_FLAGS=-fpic
SHLIB_LDFLAGS=-shared
DEFINES=-DXP_UNIX
INCLUDE=-I$(MOZILLA)/dist/include -I$(MOZILLA)/xpcom/public -I../src -I$(JDKHOME)/include -I$(JDKHOME)/include/solaris -I$(JDKHOME)/include/linux
LIBS=-L$(MOZILLA)/dist/lib -lxptinfo -lxptcmd -lxptcall -lxpt -lxpcom -lplds3 -lplc3 -lnspr3
COMPDIR=$(MOZILLA)/dist/bin/components
XPIDL=$(MOZILLA)/dist/bin/xpidl
GENPROXY=$(MOZILLA)/dist/bin/genproxy
JAVAC=$(JDKHOME)/bin/javac
CLASSDIR=$(MOZILLA)/dist/classes
TEST_CLASSES=XPCTest.class
PROXY_JAR=sample.jar
PROXY_DIR=_genproxy
.SUFFIXES: .java .class .cpp .o
all: sample xptest $(TEST_CLASSES) $(PROXY_JAR)
#
# Build class files.
#
.java.class:
$(JAVAC) -g -d . -classpath $(CLASSDIR):. $<
#
# Compile C++.
#
.cpp.o:
$(CPP) $(CFLAGS) $(DEFINES) $(INCLUDE) $(SHLIB_FLAGS) -c $<
#
# Sample XPCOM module.
#
sample: JSISample.h $(COMPDIR)/libxpjtest.so $(COMPDIR)/xpjtest.xpt
#
# Build sample header & typelib
#
JSISample.cpp: JSISample.h
JSISample.h: JSISample.idl
$(XPIDL) -w -v -m header -I $(MOZILLA)/dist/idl JSISample.idl
$(COMPDIR)/xpjtest.xpt: JSISample.idl
$(XPIDL) -w -v -m typelib -o $(COMPDIR)/xpjtest -I $(MOZILLA)/dist/idl JSISample.idl
#
# Sample object shared library
#
libxpjtest.so: JSISample.h JSSample.o
$(CPP) $(SHLIB_LDFLAGS) -L$(MOZILLA)/dist/lib -lxpcom -o libxpjtest.so JSSample.o
chmod +x libxpjtest.so
$(COMPDIR)/libxpjtest.so: libxpjtest.so
../../../config/nsinstall -R -m 555 libxpjtest.so $(COMPDIR)
#
# C++ test program
#
xptest: xptest.o
$(CPP) -g -Wall -o xptest $(LIBS) xptest.o
#
# Java proxies
#
$(PROXY_JAR): $(GENPROXY) $(COMPDIR)/xpjtest.xpt
- mkdir $(PROXY_DIR)
$(GENPROXY) -d $(PROXY_DIR) $(COMPDIR)/xpjtest.xpt
$(GENPROXY) -i -d $(PROXY_DIR) $(COMPDIR)/xpjtest.xpt
$(JAVAC) -g -d $(PROXY_DIR) -classpath $(CLASSDIR):. $(PROXY_DIR)/*.java
(cd $(PROXY_DIR); jar cf ../$(PROXY_JAR) org)
clean:
$(RM) -r *.o *.so core xptest $(COMPDIR)/libxpjtest.so $(COMPDIR)/xpjtest.xpt JSISample.h $(TEST_CLASSES) $(PROXY_JAR) $(PROXY_DIR)