#
#  Copyright (C) 1989-94 GROUPE BULL
#
#  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:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#  GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
#  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#  Except as contained in this notice, the name of GROUPE BULL shall not be
#  used in advertising or otherwise to promote the sale, use or other dealings
#  in this Software without prior written authorization from GROUPE BULL.
#

#
# XPM Imakefile - Arnaud LE HORS
#

# default locations
#ifndef XpmLibDir
#define XpmLibDir $(USRLIBDIR)
#endif
#ifndef XpmIncDir
#define XpmIncDir $(INCDIR)
#endif

# Sorry... uncomment this by hand if you want a shared Xpm library
# and your system can handle this. Right now my system can not
# handle shared libs, so to prevent trouble I disable it by default.
#
#define SharedLibXpm No

# SGI requires a specification file for shared library that we don't have
#ifndef SharedLibXpm
#define SharedLibXpm (HasSharedLibraries && \
	!(defined(SGIArchitecture) && !SystemV4))
#endif

#ifndef NormalLibXpm
#define NormalLibXpm YES
#endif

#ifdef RsArchitecture
REQUIREDLIBS = -lXext -lXt -lX11
#endif

# on Dec Alpha we need to define the following to build the shared library
#ifdef AlphaArchitecture
SO_REQLIBS=-lX11 -lc
#endif

## if your system doesn't provide strcasecmp add -DNEED_STRCASECMP
## if your system doesn't provide strdup add -DNEED_STRDUP
## if your system doesn't provide pipe remove -DZPIPE

#if defined(UltrixArchitecture) || \
    (defined(MipsArchitecture) && !defined(SGIArchitecture))
DEFINES = -DZPIPE -DNEED_STRDUP
#else
DEFINES = -DZPIPE
#endif


#
# Normaly the following part should not need to be edited
#

XPMLIBDIR = XpmLibDir
XPMINCDIR = XpmIncDir

# get the version numbers from the xpm include file
#define XPM_NUMBERS
#include "xpm.h"
SOXPMLIBREV = XpmVersion./**/XpmRevision

HEADERS = xpm.h
  SRCS = data.c create.c misc.c rgb.c scan.c parse.c hashtable.c \
	 XpmCrBufFrI.c XpmCrDataFrP.c XpmCrPFrBuf.c XpmRdFToI.c XpmWrFFrI.c \
	 XpmCrBufFrP.c XpmCrIFrBuf.c XpmCrPFrData.c XpmRdFToP.c XpmWrFFrP.c \
	 XpmCrDataFrI.c XpmCrIFrData.c XpmRdFToData.c XpmWrFFrData.c

  OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtable.o \
	 XpmCrBufFrI.o XpmCrDataFrP.o XpmCrPFrBuf.o XpmRdFToI.o XpmWrFFrI.o \
	 XpmCrBufFrP.o XpmCrIFrBuf.o XpmCrPFrData.o XpmRdFToP.o XpmWrFFrP.o \
	 XpmCrDataFrI.o XpmCrIFrData.o XpmRdFToData.o XpmWrFFrData.o

       INCLUDES = -I.
   INSTALLFLAGS = $(INSTINCFLAGS)
       LINTLIBS = $(LINTXTOLL) $(LINTXLIB) 

#ifdef OsNameDefines
OS_NAME_DEFINES = OsNameDefines
#endif

#define DoSharedLib SharedLibXpm
#define DoNormalLib NormalLibXpm

#if (ProjectX < 5)
    STD_DEFINES = LibraryDefines
    CDEBUGFLAGS = LibraryCDebugFlags
#else
#define LibName Xpm
#define SoRev SOXPMLIBREV
#include <Library.tmpl>
#endif

#if (ProjectX < 5)

#if DoSharedLib
SharedLibraryObjectRule()
NormalSharedLibraryTarget(Xpm,$(SOXPMLIBREV),$(OBJS))
InstallSharedLibrary(Xpm,$(SOXPMLIBREV),$(XPMLIBDIR))
#else
NormalLibraryObjectRule()
#endif
NormalLibraryTarget(Xpm,$(OBJS))
InstallLibrary(Xpm,$(XPMLIBDIR))

#else /* (ProjectX < 5) */
#if (ProjectX == 5)

LibraryObjectRule()

#if DoSharedLib
SharedLibraryTarget(Xpm,$(SOXPMLIBREV),$(OBJS),shared,..)
InstallSharedLibrary(Xpm,$(SOXPMLIBREV),$(XPMLIBDIR))
#endif
#if DoNormalLib
NormalLibraryTarget(Xpm,$(OBJS))
InstallLibrary(Xpm,$(XPMLIBDIR))
#endif

#endif /* (ProjectX == 5) */
#endif /* (ProjectX < 5) */

InstallMultiple($(HEADERS),$(XPMINCDIR))
LintLibraryTarget(Xpm,$(SRCS))
InstallLintLibrary(Xpm,$(LINTLIBDIR))
DependTarget()
NormalLintTarget($(SRCS))

