
GDAL_ROOT	=	..

XTRAOBJ =	$(SETARGV)

LIBS	=	$(GDAL_ROOT)\gdal_i.lib

XTRAFLAGS =	-I..\frmts -I..\alg -I..\ogr -I..\ogr\ogrsf_frmts

!INCLUDE ..\nmake.opt

!IFDEF INCLUDE_OGR_FRMTS
OGR_PROGRAMS =	gdal_contour.exe gdaltindex.exe gdal_rasterize.exe \
		gdal_grid.exe ogrinfo.exe ogr2ogr.exe ogrtindex.exe \
		gdalbuildvrt.exe
!ENDIF

default:	gdal_translate.exe gdalinfo.exe gdaladdo.exe gdalwarp.exe \
		nearblack.exe gdalmanage.exe gdalenhance.exe gdaltransform.exe\
		$(OGR_PROGRAMS)

all:	default gdalwarpsimple.exe

gdalinfo.exe:	gdalinfo.c $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalinfo.c $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdal_translate.exe:	gdal_translate.cpp $(GDALLIB) $(XTRAOBJ)
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdal_translate.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdaladdo.exe:	gdaladdo.cpp $(GDALLIB) $(XTRAOBJ)
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdaladdo.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdalwarpsimple.exe:	gdalwarpsimple.c $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalwarpsimple.c $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdaltransform.exe:	gdaltransform.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdaltransform.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdalwarp.exe:	gdalwarp.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalwarp.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdal_contour.exe:	gdal_contour.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdal_contour.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
nearblack.exe:	nearblack.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) nearblack.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdalenhance.exe:	gdalenhance.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalenhance.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1

gdal_grid.exe:	gdal_grid.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdal_grid.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1

gdalmanage.exe:	gdalmanage.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalmanage.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1

gdaltindex.exe:	gdaltindex.c $(GDALLIB) $(XTRAOBJ)
	$(CC) /I$(GDAL_ROOT) $(CFLAGS) $(XTRAFLAGS) gdaltindex.c \
		$(XTRAOBJ) $(LIBS) /link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdal_rasterize.exe:	gdal_rasterize.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdal_rasterize.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1

multireadtest.exe:	multireadtest.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) multireadtest.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
ogr2ogr.exe:	ogr2ogr.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) ogr2ogr.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
ogrinfo.exe:	ogrinfo.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) ogrinfo.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
ogrtindex.exe:	ogrtindex.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) ogrtindex.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
testepsg.exe:	testepsg.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) testepsg.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
test_ogrsf.exe:	test_ogrsf.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) test_ogrsf.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
gdalbuildvrt.exe:	gdalbuildvrt.cpp $(GDALLIB) $(XTRAOBJ) 
	$(CC) $(CFLAGS) $(XTRAFLAGS) gdalbuildvrt.cpp $(XTRAOBJ) $(LIBS) \
		/link $(LINKER_FLAGS)
	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
	
clean:
	-del *.obj
	-del *.exe
	-del *.pdb
	-del *.ilk
	-del *.lib
	-del *.manifest

install:	default
	copy *.exe $(BINDIR)
