XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.15 2004/06/01 00:17:08 dawes Exp $
/*
 * Copyright (c) 1994-2004 by The XFree86 Project, Inc.
 * All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 *   1.  Redistributions of source code must retain the above copyright
 *       notice, this list of conditions, and the following disclaimer.
 *
 *   2.  Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer
 *       in the documentation and/or other materials provided with the
 *       distribution, and in the same place and form as other copyright,
 *       license and disclaimer information.
 *
 *   3.  The end-user documentation included with the redistribution,
 *       if any, must include the following acknowledgment: "This product
 *       includes software developed by The XFree86 Project, Inc
 *       (http://www.xfree86.org/) and its contributors", in the same
 *       place and form as other third-party acknowledgments.  Alternately,
 *       this acknowledgment may appear in the software itself, in the
 *       same form and location as other such third-party acknowledgments.
 *
 *   4.  Except as contained in this notice, the name of The XFree86
 *       Project, Inc shall not be used in advertising or otherwise to
 *       promote the sale, use or other dealings in this Software without
 *       prior written authorization from The XFree86 Project, Inc.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#if HasSharedLibraries

XCOMM This isn't an option we must build a shared lib
#define DoSharedLib YES

#define LibHeaders NO
#define LibName xrx
#define SoRev SOXRXREV

SharedLibReferences(xrx,xrx,$(RXSRC),SOXRXREV,6.3)

          RXSRC = ../rx
    RX_INCLUDES = -I$(RXSRC)

#if HasBSD44Sockets
 SOCKET_DEFINES = -DBSD44SOCKETS
#endif

/* Netscape be damned.  Allow fresh (re-)installs to proceed correctly */
#if UseInstalledX11

#ifdef SGIArchitecture
#if OSMajorVersion == 5 && OSMinorVersion < 3 || OSMajorVersion == 6 && OSMinorVersion < 2
     XT_DEFINES = -DXUSE_XTREGISTERWINDOW
#endif
/* Even though we want to build the distribution with -n32, Navigator 3.0 
 * binaries are still built on IRIX 5.2, which means we need to use the 
 * old style object format. This is a hack because this Imakefile gets
 * included too late to do this properly, that is to say that the
 * CCOPTIONS in Imake.tmpl gets the -n32 options that we don't want,
 * but the CCOPTIONS in Library.tmpl does get set correctly, and over-
 * rides the value. So it works, but it's not pretty.
 */
#undef sgiCCOptions
#define sgiCCOptions -xansi
#ifdef Mips64Architecture
     SHLIBLDFLAGS = -shared
#endif
               LD = ld
#endif

#ifdef SunArchitecture
VENDOR_INCLUDES = -I/usr/openwin/include
#if OSMajorVersion < 5 || OSMajorVersion == 5 && OSMinorVersion < 6
     XT_DEFINES = -DXUSE_XTREGISTERWINDOW
#endif
#if !HasGcc
/* 
 * Based on Xmd.h 2.6 appears to be no more than R6pl11, so we need this.
 * Hopefully Sun will fix this in 2.7.
 */
#undef DefaultCCOptions
#define DefaultCCOptions -Xc 
#endif
#if OSMajorVersion == 4
FUNCPROTO_DEFINES = -DXFUNCPROTO_NOT_AVAILABLE
#endif
#endif

#ifdef HPArchitecture
/* Even though HP ships R6 in 10.20, Netscape 3.x is built on HPUX 9 and is 
 * linked against X11R5 libraries, so we continue to use _XtRegisterWindow 
 * until such time as Netscape releases a version that is linked with X11R6.
 */
     XT_DEFINES = -DXUSE_XTREGISTERWINDOW
#if OSMajorVersion < 10 || (OSMajorVersion == 10 && OSMinorVersion < 2)
   TOP_INCLUDES = -I/usr/include -I$(BUILDINCDIR)
#else
   TOP_INCLUDES = -I/usr/include/X11R5 -I$(BUILDINCDIR)
#endif
#endif

#if defined(AlphaArchitecture) && defined(OSF1Architecture)
#if OSMajorVersion < 4
     XT_DEFINES = -DXUSE_XTREGISTERWINDOW
#endif
#endif

#ifdef IBMArchitecture
/* No clue when IBM might ship R6 */
     XT_DEFINES = -DXUSE_XTREGISTERWINDOW
#endif

#endif /* UseInstalledX11 */

 PLUGIN_DEFINES = -DXP_UNIX
PLUGIN_INCLUDES = -I./include

        DEFINES = StrcasecmpDefines -DNETSCAPE_PLUGIN $(PLUGIN_DEFINES) $(XT_DEFINES) $(SOCKET_DEFINES) $(FUNCPROTO_DEFINES)
       INCLUDES = -I. $(PLUGIN_INCLUDES) $(RX_INCLUDES) $(VENDOR_INCLUDES)

    PARAMS_SRCS = PRead.c PParse.c BuildReq.c
    PARAMS_OBJS = PRead.o PParse.o BuildReq.o

     XMISC_SRCS = XUrls.c XAuth.c XDpyName.c Prefs.c
     XMISC_OBJS = XUrls.o XAuth.o XDpyName.o Prefs.o

           SRCS = Main.c SetWin.c PProcess.c NewNDest.c Global.c stubs.c \
		$(PARAMS_SRCS) $(XMISC_SRCS)
           OBJS = Main.o SetWin.o PProcess.o NewNDest.o Global.o stubs.o \
		$(PARAMS_OBJS) $(XMISC_OBJS)

#if UseInstalledX11

XCOMM we need to link in the right libraries so it will work no matter
XCOMM which libraries Netscape itself is using.
#if !VendorHasX11R6_3libXext
X11R6_3_EXTENSIONS = ../libxplugin/libxplugin.a
#ifdef SunArchitecture
PLUGIN_LDOPTIONS = -L/usr/openwin/lib
CCENVSETUP =
#if OSMajorVersion == 5 && OSMinorVersion > 5
RXICELIB = $(ICELIB)
#endif
#if OSMajorVersion == 4
    EXTENSIONLIB =
#endif
#endif
#ifdef HPArchitecture
#if OSMajorVersion < 10 || (OSMajorVersion == 10 && OSMinorVersion < 2)
       LDPRELIBS = -L/usr/lib/X11
#else
       LDPRELIBS = -L/usr/lib/X11R5
#endif
#endif
#ifdef IBMArchitecture
    XTOOLONLYLIB = -lXm -lXt
    EXTENSIONLIB = -lXext
        XONLYLIB = -lX11
        RXICELIB = $(ICELIB)
      LDPOSTLIBS =
       LDPRELIBS =
#endif
#ifdef SequentArchitecture
        RXICELIB = $(ICELIB)
        XONLYLIB = -lX11 -lsocket
PLUGIN_LDOPTIONS = $(LDPRELIBS)
#endif
#else
PLUGIN_LDOPTIONS = $(LDPRELIBS)
#endif

/* Sun and HP don't ship it yet, SGI has it inside libXt. */
#if defined(AlphaArchitecture) && defined(OSF1Architecture)
RXICELIB = $(ICELIB)
#endif

#else  /* UseInstalledX11 */
PLUGIN_LDOPTIONS = $(LDPRELIBS)
#endif /* UseInstalledX11 */

    REQUIREDLIBS =  $(X11R6_3_EXTENSIONS) $(PLUGIN_LDOPTIONS) $(RXICELIB) $(XTOOLONLYLIB) $(XLIB)

#include <Library.tmpl>

LinkFile(PRead.c,$(RXSRC)/PRead.c)
LinkFile(PParse.c,$(RXSRC)/PParse.c)
LinkFile(BuildReq.c,$(RXSRC)/BuildReq.c)
LinkFile(XUrls.c,$(RXSRC)/XUrls.c)
LinkFile(XAuth.c,$(RXSRC)/XAuth.c)
LinkFile(XDpyName.c,$(RXSRC)/XDpyName.c)
LinkFile(Prefs.c,$(RXSRC)/Prefs.c)

DependTarget()
InstallManPage(libxrx,$(MANDIR))

#ifdef IBMArchitecture
AllTarget(shr.o)

install::
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) shr.o $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).so
	$(RM) $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).a
#endif

#endif /* HasSharedLibraries */
