#	$Id: yMakefile,v 1.52 2007-07-18 18:49:23 haley Exp $
#
#	Makefile for libraster - libraries for dealing with
#	a variety of raster image formats.
#

# Build the Parallax video frame buffer driver only for local systems.

#if	defined(hostlonecone)	|| defined(hostgulebra) || \
	defined(hostsalida)	|| defined(hostsunlight)
#define BuildRasterParallax
#endif

#if	defined(BuildParallax)
#define BuildRasterParallax
#endif

#ifdef	BuildXlibDependentCode
#define	BuildRasterXWD
#endif

MYNAME		= libncarg_ras
INCLUDES	= ncarg_ras.h

#ifdef IRIX
LOCLIB		= $(NCARGRASLIB) $(NCARGCLIB) -ldf $(NCDFLIBS) -lsun
#else
LOCLIB		= $(NCARGRASLIB) $(NCARGCLIB) -ldf
#endif

#ifdef BuildRasterHDF
HDF_OBJS =	hdf.o
HDF_SRCS =	hdf.c
HDF_DEFS = 	-DBuildRasterHDF $(HDFDEFINES)
#endif

#ifdef BuildRasterHPPCL
HPPCL_OBJS =	hppcl.o
HPPCL_SRCS =	hppcl.c
HPPCL_DEFS =	-DBuildRasterHPPCL
#endif

#ifdef BuildRasterNrif
NRIF_OBJS =	nrif.o
NRIF_SRCS =	nrif.c
NRIF_DEFS = 	-DBuildRasterNrif
#endif

#ifdef BuildRasterSun
SUN_OBJS =	sunraster.o
SUN_SRCS =	sunraster.c
SUN_DEFS = 	-DBuildRasterSun
#endif

#ifdef BuildRasterXWD
XWD_OBJS =	xwd.o
XWD_SRCS =	xwd.c
XWD_DEFS = 	-DBuildRasterXWD
#endif

#if defined (BuildRasterParallax) && defined(SUN)
PARALLAX_OBJS =	parallax.o
PARALLAX_SRCS =	parallax.c
PARALLAX_DEFS =	-DBuildRasterParallax
#endif

#ifdef BuildRasterAVS
AVS_OBJS =	avsraster.o
AVS_SRCS =	avsraster.c
AVS_DEFS =	-DBuildRasterAVS
#endif

#ifdef BuildRasterSGI
SGI_OBJS =	sgiraster.o
SGI_SRCS =	sgiraster.c
SGI_DEFS =	-DBuildRasterSGI
#endif

#ifdef BuildRasterAbekas
ABEKAS_OBJS =	abekas.o
ABEKAS_SRCS =	abekas.c
ABEKAS_DEFS =	-DBuildRasterAbekas
#endif

#ifdef BuildRasterNetcdf
NETCDF_OBJS =	netcdf.o
NETCDF_SRCS =	netcdf.c
NETCDF_DEFS =	-DBuildRasterNetcdf
#endif

#ifdef BuildRasterBinary
BINARY_OBJS =	binary.o
BINARY_SRCS =	binary.c
BINARY_DEFS =	-DBuildRasterBinary
#endif

#ifdef BuildRasterYUV
YUV_OBJS =	yuv.o
YUV_SRCS =	yuv.c
YUV_DEFS =	-DBuildRasterYUV
#endif

#if defined(Darwin) && defined(i386)
EXTRA_CCOPTIONS = -D__UNIXOS2__
#endif

EXTRA_DEFINES =	$(HDF_DEFS) $(HPPCL_DEFS) $(NRIF_DEFS) $(SUN_DEFS) \
		$(XWD_DEFS) $(PARALLAX_DEFS) $(AVS_DEFS) $(SGI_DEFS) \
		$(ABEKAS_DEFS) $(NETCDF_DEFS) $(BINARY_DEFS) $(YUV_DEFS) \
		-DNGTMPDIR='"$(NGTMPDIR)"' $(ARCH_DEF) $(VENDOR_DEF)

DEVICE_OBJS =	$(HDF_OBJS) $(HPPCL_OBJS) $(NRIF_OBJS) $(SUN_OBJS) \
		$(XWD_OBJS) $(PARALLAX_OBJS) $(AVS_OBJS) $(SGI_OBJS) \
		$(ABEKAS_OBJS) $(NETCDF_OBJS) $(BINARY_OBJS) $(YUV_OBJS)

DEVICE_SRCS =	$(HDF_SRCS) $(HPPCL_SRCS) $(NRIF_SRCS) $(SUN_SRCS) \
		$(XWD_SRCS) $(PARALLAX_SRCS) $(AVS_SRCS) $(SGI_SRCS) \
		$(ABEKAS_SRCS) $(NETCDF_SRCS) $(BINARY_SRCS) $(YUV_SRCS)

GENERIC_OBJS =	raster.o cleartext.o error.o misc.o palette.o \
		dither.o resample.o composite.o ntsc.o color.o \
		rasterop.o generic.o memory.o $(DEVICE_OBJS)

GENERIC_SRCS =	raster.c cleartext.c error.c misc.c palette.c \
		dither.c resample.c composite.c ntsc.c color.c \
		rasterop.c generic.c memory.c $(DEVICE_SRCS)

OBJS		= $(GENERIC_OBJS)
SRCS		= $(GENERIC_SRCS)

LibraryTarget($(MYNAME),$(OBJS))
BuildSharedFromArch(libNGras,libncarg_ras.a,1,0,$(NCARGCLIB) $(HDFLIB) -lm -lc)
BuildIncludes($(INCLUDES),ncarg,..)
InstallTarget($(INCLUDES),$(INSTALL_INC),$(NCARGINCPATH))
DependTarget($(SRCS))

hdf.o:		Makefile
raster.o:	Makefile

test: rasls.o rascopy.o
	$(CC) $(CFLAGS) -o rasls rasls.o $(LOCLIB) -lmalloc
	$(CC) $(CFLAGS) -o rascopy rascopy.o $(LOCLIB) -lmalloc

lint:
	lint -I$(CINC) $(SRCS) 1> lint.out 2>&1

