GDAL_ROOT	=	..\..

DIRLIST		=	generic geojson shape ntf sdts tiger s57 dgn mitab gml \
			avc rec mem vrt csv gmt bna kml gpx \
			geoconcept xplane \
			$(OGDIDIR) $(FMEDIR) $(OCIDIR) $(PG_DIR) $(DWGDIR) \
			$(ODBCDIR) $(SQLITE_DIR) $(MYSQL_DIR) $(ILI_DIR) \
			$(SDE_DIR) $(IDB_DIR) $(NAS_DIR) $(DODSDIR)

!INCLUDE $(GDAL_ROOT)\nmake.opt

!IFDEF OGDIDIR
OGDIDIR	=	ogdi
OGDIOBJ =	ogdi\*.obj
!ENDIF

!IFDEF ODBC_SUPPORTED
ODBCDIR	=	odbc pgeo
ODBCOBJ =	odbc\*.obj pgeo\*.obj
!ENDIF

!IFDEF SQLITE_LIB
SQLITE_DIR	=	sqlite
SQLITE_OBJ =	sqlite\*.obj
!ENDIF

!IFDEF OCI_LIB
OCIDIR	=	oci
OCIOBJ =	oci\*.obj
!ENDIF

!IFDEF FME_DIR
FMEDIR = fme
FMEOBJ = fme\*.obj
!ENDIF

!IFDEF PG_INC_DIR
PG_DIR = pg
PG_OBJ = pg\*.obj
!ENDIF

!IFDEF DWGDIRECT
DWGDIR = dxfdwg
DWG_OBJ = dxfdwg\*.obj
!ENDIF

!IFDEF SDE_LIB
SDE_DIR = sde
SDE_OBJ = sde\*.obj
!ENDIF

!IFDEF MYSQL_INC_DIR
MYSQL_DIR = mysql
MYSQL_OBJ = mysql\*.obj
!ENDIF

!IFDEF ILI_ENABLED
ILI_DIR = ili
ILI_OBJ = ili\*.obj ili\iom\*.obj
!ENDIF

!IFDEF NAS_ENABLED
NAS_DIR = nas
NAS_OBJ = nas\*.obj
!ENDIF

!IFDEF INFORMIXDIR
IDB_DIR = idb
IDB_OBJ = idb\*.obj
!ENDIF

!IFDEF DODS_DIR
DODSDIR = dods
DODS_OBJ = dods\*.obj
!ENDIF

default:
	for %d in ( $(DIRLIST) ) do \
		cd %d \
		&& nmake /NOLOGO /f makefile.vc \
		&& cd ..

	lib /out:ogrsf_frmts.lib generic\*.obj shape\*.obj ntf\*.obj \
				 sdts\*.obj s57\*.obj tiger\*.obj gml\*.obj \
				 mitab\*.obj dgn\*.obj avc\*.obj mem\*.obj \
				 vrt\*.obj csv\*.obj rec\*.obj kml\*.obj \
				 gmt\*.obj bna\*.obj geoconcept\*.obj \
				 geojson\*.obj geojson\jsonc\*.obj \
				 gpx\*.obj xplane\*.obj \
				$(OGDIOBJ) $(ODBCOBJ) $(SQLITE_OBJ) \
				$(FMEOBJ) $(OCIOBJ) $(PG_OBJ) $(MYSQL_OBJ) \
				$(ILI_OBJ) $(DWG_OBJ) $(SDE_OBJ) $(IDB_OBJ) \
				$(DODS_OBJ) $(NAS_OBJ)
	lib /out:ogrsf_frmts_sup.lib \
				 ..\..\frmts\iso8211\*.obj \
				 ..\..\frmts\sdts\sdtsattrreader.obj \
				 ..\..\frmts\sdts\sdtscatd.obj \
				 ..\..\frmts\sdts\sdtsiref.obj \
				 ..\..\frmts\sdts\sdtslib.obj \
				 ..\..\frmts\sdts\sdtslinereader.obj \
				 ..\..\frmts\sdts\sdtspointreader.obj \
				 ..\..\frmts\sdts\sdtspolygonreader.obj \
				 ..\..\frmts\sdts\sdtsrasterreader.obj \
				 ..\..\frmts\sdts\sdtstransfer.obj \
				 ..\..\frmts\sdts\sdtsindexedreader.obj \
				 ..\..\frmts\sdts\sdtsxref.obj

clean:
	-del ogrsf_frmts.lib
	-del ogrsf_frmts_sup.lib
	for %d in ( $(DIRLIST) ) do \
		cd %d \
		&& nmake /NOLOGO /f makefile.vc clean \
		&& cd ..

html-install:
	copy *.html $(HTMLDIR)
	-for %d in ( $(DIRLIST) ) do \
		copy %d\drv_*.html $(HTMLDIR)
