#
# File:      makefile.vc
# Author:    David Webster
# Created:   2000
# Updated:
# Copyright: c) 2000, BHM
# Licence:   wxWindows Licence
#
# "%W% %G%"
#
# Makefile : Builds os2tiff.lib library for OS/2 3.0/4.0

# Suffixes
OBJSUFF=obj
SRCSUFF=cpp

OS2FLAGS=/c /W2 /DOS232 /D__VISAGECPP__ /D__VISAGECPP30__ /DOS2_32 /Tdc /Q /N100
OS2LINKFLAGS=/BASE:0x00010000 /PMTYPE:PM /NOE /NOD /ALIGN:16
OS2LIBFLAGS=/NOL /NOE
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB

!if "$(WXMAKINGDLL)" != "0"
EXTRADLLFLAGS=/DWXMAKINGDLL=1 /Ge- /D__OS2DLL__
EXTRALNKFLAGS=/DLL
!endif

# Change WXDIR or WXWIN to wherever wxWindows is found
WXDIR = $(WXWIN)

OS2TIFFDIR=$(WXDIR)\src\tiff
OS2TIFFINC=$(WINTIFFDIR)
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.lib

!if "$(WXMAKINGDLL)" != "1"
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.lib
!else
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.dll
!endif

INC=-I$(WXDIR)\src\TIFF -I$(OS2TIFFINC)

!ifndef FINAL
FINAL=0
!endif

!if "$(NOPCH)" == "1"
PCH=
PRECOMP=
MAKEPRECOMP=
!else
PCH=$(WXLIBNAME).pch
PRECOMP=/Si$(PCH)
MAKEPRECOMP=/Fi$(PCH)
!endif

!if "$(FINAL)" == "0"
!if "$(WXMAKINGDLL)" == "1"
D=DebugOS2DLL
!else
D=DebugOS2
!endif
OPT =
DEBUG_FLAGS= /Ti /D__WXDEBUG__ #/Fb
LINK_DEBUG_FLAGS=/DEBUG
CRTFLAG=/Gm /Gd
!else
# /O1 - smallest code
# /O2 - fastest code
!if "$(WXMAKINGDLL)" == "1"
D=RelseOS2DLL
!else
D=RelseOS2
!endif
OPT = /O+ /Oc /G5
DEBUG_FLAGS=
LINK_DEBUG_FLAGS=/RELEASE
CRTFLAG=/Gm /Gd
!endif

!if [md $(OS2TIFFDIR)\$D]
!endif


CPPFLAGS=$(OS2FLAGS) $(EXTRADLLFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(INC) $(OPT) $(CRTFLAG)
LINKFKAGS=$(OS2LINKFLAGS) $(EXTRALNKFLAGS)

{..\tiff}.c{..\tiff\$D}.obj:
    @echo $<
    icc @<<
$(CPPFLAGS) /Fo$@ /Tp $<
<<

OBJECTS = \
  ..\tiff\$D\tif_aux.obj \
  ..\tiff\$D\tif_close.obj \
  ..\tiff\$D\tif_codec.obj \
  ..\tiff\$D\tif_compress.obj \
  ..\tiff\$D\tif_dir.obj \
  ..\tiff\$D\tif_dirinfo.obj \
  ..\tiff\$D\tif_dirread.obj \
  ..\tiff\$D\tif_dirwrite.obj \
  ..\tiff\$D\tif_dumpmode.obj \
  ..\tiff\$D\tif_error.obj \
  ..\tiff\$D\tif_fax3.obj \
  ..\tiff\$D\tif_fax3sm.obj \
  ..\tiff\$D\tif_flush.obj \
  ..\tiff\$D\tif_getimage.obj \
  ..\tiff\$D\tif_jpeg.obj \
  ..\tiff\$D\tif_luv.obj \
  ..\tiff\$D\tif_lzw.obj \
  ..\tiff\$D\tif_next.obj \
  ..\tiff\$D\tif_open.obj \
  ..\tiff\$D\tif_os2.obj \
  ..\tiff\$D\tif_packbits.obj \
  ..\tiff\$D\tif_pixarlog.obj \
  ..\tiff\$D\tif_predict.obj \
  ..\tiff\$D\tif_print.obj \
  ..\tiff\$D\tif_read.obj \
  ..\tiff\$D\tif_strip.obj \
  ..\tiff\$D\tif_swab.obj \
  ..\tiff\$D\tif_thunder.obj \
  ..\tiff\$D\tif_tile.obj \
  ..\tiff\$D\tif_version.obj \
  ..\tiff\$D\tif_warning.obj \
  ..\tiff\$D\tif_write.obj \
  ..\tiff\$D\tif_zip.obj

LIBOBJECTS = \
  tif_aux.obj \
  tif_close.obj \
  tif_codec.obj \
  tif_compress.obj \
  tif_dir.obj \
  tif_dirinfo.obj \
  tif_dirread.obj \
  tif_dirwrite.obj \
  tif_dumpmode.obj \
  tif_error.obj \
  tif_fax3.obj \
  tif_fax3sm.obj \
  tif_flush.obj \
  tif_getimage.obj \
  tif_jpeg.obj \
  tif_luv.obj \
  tif_lzw.obj \
  tif_next.obj \
  tif_open.obj \
  tif_os2.obj \
  tif_packbits.obj \
  tif_pixarlog.obj \
  tif_predict.obj \
  tif_print.obj \
  tif_read.obj \
  tif_strip.obj \
  tif_swab.obj \
  tif_thunder.obj \
  tif_tile.obj \
  tif_version.obj \
  tif_warning.obj \
  tif_write.obj \
  tif_zip.obj

all:  $(OBJECTS) $(OS2TIFFLIB)

!if "$(WXMAKINGDLL)" != "1"

$(WXDIR)\lib\os2tiff.lib: $(LIBOBJECTS)
 touch $(WXDIR)\lib\os2tiff.lib
 del $(WXDIR)\lib\os2tiff.lib
 ilib $(OS2LIBFLAGS) $@ @<<
    $**;
<<
  del *.obj

!else

# Update the dynamic link library
$(WXDIR)\lib\os2tiff.dll: $(OBJECTS)
    icc @<<
    /B" $(LINKFLAGS)" /Fe$@
    $(LIBS)
    $(OBJECTS)
    $(WXDIR)\src\os2\os2tiff.def
<<
    implib $(WXDIR)\lib\os2tiffd.lib $(WXDIR)\src\os2\os2tiff.def

!endif

clean:
        del      $(OS2TIFFLIB)
        erase /N $(OS2TIFFDIR)\$D
        rd       $(OS2TIFFDIR)\$D

cleanall:     clean

$(LIBOBJECTS):
  copy ..\tiff\$D\tif_aux.obj
  copy ..\tiff\$D\tif_close.obj
  copy ..\tiff\$D\tif_codec.obj
  copy ..\tiff\$D\tif_compress.obj
  copy ..\tiff\$D\tif_dir.obj
  copy ..\tiff\$D\tif_dirinfo.obj
  copy ..\tiff\$D\tif_dirread.obj
  copy ..\tiff\$D\tif_dirwrite.obj
  copy ..\tiff\$D\tif_dumpmode.obj
  copy ..\tiff\$D\tif_error.obj
  copy ..\tiff\$D\tif_fax3.obj
  copy ..\tiff\$D\tif_fax3sm.obj
  copy ..\tiff\$D\tif_flush.obj
  copy ..\tiff\$D\tif_getimage.obj
  copy ..\tiff\$D\tif_jpeg.obj
  copy ..\tiff\$D\tif_luv.obj
  copy ..\tiff\$D\tif_lzw.obj
  copy ..\tiff\$D\tif_next.obj
  copy ..\tiff\$D\tif_open.obj
  copy ..\tiff\$D\tif_os2.obj
  copy ..\tiff\$D\tif_packbits.obj
  copy ..\tiff\$D\tif_pixarlog.obj
  copy ..\tiff\$D\tif_predict.obj
  copy ..\tiff\$D\tif_print.obj
  copy ..\tiff\$D\tif_read.obj
  copy ..\tiff\$D\tif_strip.obj
  copy ..\tiff\$D\tif_swab.obj
  copy ..\tiff\$D\tif_thunder.obj
  copy ..\tiff\$D\tif_tile.obj
  copy ..\tiff\$D\tif_version.obj
  copy ..\tiff\$D\tif_warning.obj
  copy ..\tiff\$D\tif_write.obj
  copy ..\tiff\$D\tif_zip.obj