GDAL_ROOT	=	..\..
!INCLUDE $(GDAL_ROOT)\nmake.opt


OBJ	=    jpgdataset.obj jpgdataset_12.obj vsidataio.obj


!IFDEF JPEG_EXTERNAL_LIB
EXTRAFLAGS      = -I..\zlib -I$(JPEGDIR)
!ELSE
EXTRAFLAGS = 	-I..\zlib -Ilibjpeg $(JPEG12_FLAGS) 
!ENDIF

!IFDEF JPEG12_SUPPORTED
JPEG12_FLAGS =  -DJPEG_DUAL_MODE_8_12 
EXTRA_DEP    =  libjpeg12src
!ENDIF

default:	$(EXTRA_DEP) $(OBJ)
	xcopy /D  /Y *.obj ..\o
!IFNDEF JPEG_EXTERNAL_LIB
	cd libjpeg
	$(MAKE) /f makefile.vc
	cd ..
!ENDIF
!IFDEF JPEG12_SUPPORTED
	cd libjpeg12
	$(MAKE) /f makefile.vc
	cd ..
!ENDIF

clean:
	-del *.obj
        cd libjpeg
	$(MAKE) /f makefile.vc clean
	cd ..
        cd libjpeg12
	$(MAKE) /f makefile.vc clean
	cd ..

libjpeg12src:
	cd libjpeg12
	$(MAKE) /f makefile.vc jcapimin12.c
	cd ..
