
OBJ	=	gdal_wrap.obj gdalnumeric.obj numpydataset.obj
PYGDAL_DLL	=	_gdal.dll

GDAL_ROOT	=	..

SCRIPTSDIR  =   ..\swig\python\scripts
PY_COMMANDS	=	$(SCRIPTSDIR)\epsg_tr.py \
                $(SCRIPTSDIR)\gdalchksum.py \
                $(SCRIPTSDIR)\gdal2xyz.py \
                $(SCRIPTSDIR)\gcps2wld.py \
			    $(SCRIPTSDIR)\gdalimport.py \
			    $(SCRIPTSDIR)\gdal_merge.py \
			    $(SCRIPTSDIR)\pct2rgb.py \
			    $(SCRIPTSDIR)\rgb2pct.py \
			    $(SCRIPTSDIR)\gcps2vec.py \
			    $(SCRIPTSDIR)\mkgraticule.py
PY_MODULES	=	gdal.py ogr.py osr.py gdalconst.py gdalnumeric.py

!INCLUDE ..\nmake.opt

!IFDEF HAVE_NUMPY
NUMPY_DEF = -DHAVE_NUMPY
!ELSE
NUMPY_DEF =
!ENDIF

!IF $(MSVC_VER) == 1400
PYOPTFLAGS = /nologo /MD /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
!ELSE
PYOPTFLAGS = /nologo /MD /EHsc /Ox /DNDEBU
!ENDIF

EXTRAFLAGS = -I$(PYDIR)/include $(NUMPY_DEF) $(MSVC_VLD_FLAGS)
CFLAGS = $(PYOPTFLAGS) $(INC) $(EXTRAFLAGS) $(MSVC_VLD_FLAGS)

default:	$(PYGDAL_DLL)

$(PYGDAL_DLL):	$(OBJ)
	link /dll /def:_gdal.def $(OBJ) ../gdal_i.lib /LIBPATH:$(PYDIR)/libs \
		/out:$(PYGDAL_DLL) $(MSVC_VLD_LIB)
	
clean:
	-del *.obj *.dll *.lib
	-del *.manifest

install:	$(PYGDAL_DLL)
	-mkdir $(PY_INST_DIR)
	for %d in ( $(PY_MODULES) ) do copy %d $(PY_INST_DIR)
	-mkdir $(PY_INST_DIR)
	for %d in ( $(PY_COMMANDS) ) do copy %d $(BINDIR)
	copy $(PYGDAL_DLL) $(PY_INST_DIR)
	-if exist $(PYGDAL_DLL).manifest xcopy /y /r /d /f $(PYGDAL_DLL).manifest $(PY_INST_DIR)


