GDAL_ROOT	=	..\..

DIRLIST		=	generic geojson shape ntf sdts tiger s57 dgn mitab gml \
			avc rec mem vrt csv gmt bna kml gpx \
			geoconcept xplane georss gtm dxf vfk pgdump gpsbabel \
			sua openair pds htf aeronavfaa $(ARCOBJECTS_DIR) \
			$(OGDIDIR) $(FMEDIR) $(OCIDIR) $(PG_DIR) $(DWGDIR) \
			$(ODBCDIR) $(SQLITE_DIR) $(MYSQL_DIR) $(ILI_DIR) \
			$(SDE_DIR) $(IDB_DIR) $(NAS_DIR) $(DODSDIR) \
			$(PCIDSK_DIR) $(LIBKMLDIR) $(WFSDIR) $(SOSIDIR)

!INCLUDE $(GDAL_ROOT)\nmake.opt

!IF "$(PCIDSK_SETTING)" == "EXTERNAL"
PCIDSK_DIR	=	pcidsk
PCIDSKOBJ	=	pcidsk\*.obj
!ENDIF
!IF "$(PCIDSK_SETTING)" == "INTERNAL"
PCIDSK_DIR	=	pcidsk
PCIDSKOBJ	=	pcidsk\*.obj
!ENDIF

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

!IFDEF ODBC_SUPPORTED
ODBCDIR	=	odbc pgeo mssqlspatial
ODBCOBJ =	odbc\*.obj pgeo\*.obj mssqlspatial\*.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 HAS_ARCOBJECTS
ARCOBJECTS_DIR = arcobjects
ARCOBJECTS_OBJ = arcobjects\*.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

!IFDEF LIBKML_DIR
LIBKMLDIR = libkml
LIBKMLOBJ =	libkml\*.obj
!ENDIF

!IFDEF CURL_LIB
WFSDIR = wfs
WFS_OBJ = wfs\*.obj
!ENDIF

!IFDEF SOSI_ENABLED
SOSIDIR = sosi
SOSI_OBJ = sosi\*.obj
!ENDIF

default:
	for %d in ( $(DIRLIST) ) do \
		cd %d \
		&& $(MAKE) /f makefile.vc \
		&& cd .. \
		|| exit 1

	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 georss\*.obj gtm\*.obj \
				 dxf\*.obj vfk\*.obj pgdump\*.obj gpsbabel\*.obj \
				 sua\*.obj openair\*.obj pds\*.obj htf\*.obj \
				 aeronavfaa\*.obj \
				$(OGDIOBJ) $(ODBCOBJ) $(SQLITE_OBJ) \
				$(FMEOBJ) $(OCIOBJ) $(PG_OBJ) $(MYSQL_OBJ) \
				$(ILI_OBJ) $(DWG_OBJ) $(SDE_OBJ) $(ARCDRIVER_OBJ) $(IDB_OBJ) \
				$(DODS_OBJ) $(NAS_OBJ) $(PCIDSKOBJ) $(LIBKMLOBJ) $(WFS_OBJ) \
				$(SOSI_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 \
		&& $(MAKE) /f makefile.vc clean \
		&& cd .. \
		|| exit 1

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