#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL.  You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation.  Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.  All Rights
# Reserved.

IGNORE_MANIFEST=1
#

#------------------------------------------------------------------------
#
# Makefile to build the IMGLIB LIB
#
#------------------------------------------------------------------------

!ifdef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
!endif


#LIBRARY_NAME = img$(MOZ_BITS)
!ifndef STANDALONE_IMAGE_LIB
IMGSRC=	$(DEPTH)\modules\libimg\src\_jmc
!endif

#
# Make sure we have MOZILLA_CLIENT defined so we get the
#   proper JS includes
#
LCFLAGS		= $(LCFLAGS)  -DMOZILLA_CLIENT

!ifdef BUILD_DEBUG_GC
LCFLAGS		= $(LCFLAGS) -DDEBUG_GC
!endif

LCFLAGS		= $(LCFLAGS) /TP

!ifdef STANDALONE_IMAGE_LIB
LLIBS=$(DIST)\lib\png.lib \
 	$(LIBNSPR)  \
	$(LIBJPEG)  \
	$(DIST)\lib\libplc21.lib	\
	$(DIST)\lib\util.lib            \
	$(DIST)\lib\zip$(MOZ_BITS)$(VERSION_NUMBER).lib \
	$(DIST)\lib\xpcom32.lib \
!ifdef NU_CACHE
	$(DIST)\lib\cache.lib \
!endif
	$(NULL)
!else
LLIBS=$(DIST)\lib\png.lib \
	$(NULL)
!endif

MISCDEP=$(LLIBS)
!ifndef STANDALONE_IMAGE_LIB
OBJS=.\$(OBJDIR)\MIMGCB.obj \
	$(NULL)

CSRCS =		   \
	_jmc\MIMGCB.c \
	$(NULL)
!endif

#LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
!ifdef STANDALONE_IMAGE_LIB
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
!else
LIBRARY_SUFFIX = $(MOZ_BITS)
!endif

!ifdef STANDALONE_IMAGE_LIB
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=img$(MOZ_BITS)$(VERSION_NUMBER)
DLL1NAME=img$(MOZ_BITS)$(VERSION_NUMBER)
PDBFILE=$(DLLNAME).pdb
MAPFILE=$(DLLNAME).map
!if "$(MOZ_BITS)" == "16"
DEFFILE=$(DLL1NAME).def
!endif


#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAPFILE= $(DLLNAME).map

!endif


MODULE=img 
DEPTH=..\..\.. 
LOCAL_INCLUDES=-I../png -I. -I$(DEPTH)/dist/public/zlib 
LIBRARY_NAME=img 
EXTRA_LIBS=$(DIST)/lib/libzlib.a $(DIST)/lib/libpng.a 

### STANDALONE_IMAGE_LIB
!ifdef STANDALONE_IMAGE_LIB
CPPSRCS=color.cpp colormap.cpp dither.cpp gif.cpp if.cpp ilclient.cpp il_util.cpp \
    ilNetReader.cpp jpeg.cpp scale.cpp xbm.cpp ipng.cpp png_png.cpp xpcompat.cpp
REQUIRES=zlib nspr jpeg util img png xpcom
CPP_OBJS=.\$(OBJDIR)\color.obj .\$(OBJDIR)\colormap.obj \
    .\$(OBJDIR)\dither.obj .\$(OBJDIR)\gif.obj .\$(OBJDIR)\if.obj \
    .\$(OBJDIR)\ilclient.obj .\$(OBJDIR)\il_util.obj \
    .\$(OBJDIR)\ilNetReader.obj .\$(OBJDIR)\jpeg.obj \
    .\$(OBJDIR)\scale.obj .\$(OBJDIR)\xbm.obj \
    .\$(OBJDIR)\ipng.obj .\$(OBJDIR)\png_png.obj .\$(OBJDIR)\xpcompat.obj \
	
!if "$(MOZ_BITS)" != "16"
LINCS=-I$(XPDIST)\public\zlib -I$(XPDIST)\public\nspr \
    -I$(XPDIST)\public\jpeg -I$(XPDIST)\public\util -I$(XPDIST)\public\img \
!ifdef NU_CACHE
    -I$(XPDIST)\public\cache \
!endif
    -I$(XPDIST)\public\png -I$(XPDIST)\public\xpcom 
!endif

### non-STANDALONE_IMAGE_LIB
!else
CPPSRCS=color.cpp colormap.cpp dither.cpp dummy_nc.cpp external.cpp gif.cpp if.cpp \
   ilclient.cpp il_util.cpp jpeg.cpp scale.cpp xbm.cpp ipng.cpp png_png.cpp ilNetReader.cpp 
REQUIRES=jtools java zlib nspr dbm jpeg util img png layer js xpcom
EXPORTS=PIMGCB.h PPSIMGCB.h 
JMC_HEADERS=$(JMC_GEN_DIR)\MIMGCB.h $(JMC_GEN_DIR)\MPSIMGCB.h 
JMC_STUBS=$(JMC_GEN_DIR)\MIMGCB.c $(JMC_GEN_DIR)\MPSIMGCB.c 
JMC_OBJS=.\$(OBJDIR)\MIMGCB.obj .\$(OBJDIR)\MPSIMGCB.obj 
JMC_GEN=MIMGCB MPSIMGCB 
JMC_GEN_FLAGS=-cimpl -noexc -module 
CPP_OBJS=.\$(OBJDIR)\color.obj .\$(OBJDIR)\colormap.obj \
    .\$(OBJDIR)\dither.obj .\$(OBJDIR)\dummy_nc.obj \
    .\$(OBJDIR)\external.obj .\$(OBJDIR)\gif.obj .\$(OBJDIR)\if.obj \
    .\$(OBJDIR)\ilclient.obj .\$(OBJDIR)\il_util.obj \
    .\$(OBJDIR)\jpeg.obj .\$(OBJDIR)\scale.obj .\$(OBJDIR)\xbm.obj \
    .\$(OBJDIR)\ipng.obj .\$(OBJDIR)\png_png.obj .\$(OBJDIR)\ilNetReader.obj
!if "$(MOZ_BITS)" != "16"
LINCS=-I$(XPDIST)\public\jtools -I$(XPDIST)\public\java \
    -I$(XPDIST)\public\zlib -I$(XPDIST)\public\nspr \
    -I$(XPDIST)\public\dbm -I$(XPDIST)\public\jpeg \
    -I$(XPDIST)\public\util -I$(XPDIST)\public\img \
    -I$(XPDIST)\public\png -I$(XPDIST)\public\layer \
!ifdef NU_CACHE
    -I$(XPDIST)\public\cache \
!endif
    -I$(XPDIST)\public\js -I$(XPDIST)\public\xpcom
!endif
!endif

include <$(DEPTH)\config\rules.mak> 

!ifdef STANDALONE_IMAGE_LIB
install:: $(DLL)
    $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
    $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
!else
$(JMC_GEN_DIR)\MIMGCB.h: $(JMCSRCDIR)\IMGCB.class
    $(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
$(JMC_GEN_DIR)\MIMGCB.c: $(JMCSRCDIR)\IMGCB.class
    $(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)
$(JMC_GEN_DIR)\MPSIMGCB.h: $(JMCSRCDIR)\PSIMGCB.class
    $(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
$(JMC_GEN_DIR)\MPSIMGCB.c: $(JMCSRCDIR)\PSIMGCB.class
    $(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)

export:: $(LIBRARY)
    $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib

symbols::
	@echo "LIBRARY_NAME     is $(LIBRARY_NAME)"
	@echo "LIBRARY          is $(LIBRARY)"
!endif
