# $Id: Makefile.in 9226 2009-07-26 11:06:58Z tamas $
#
# Run ./configure in the main MapServer directory to turn this Makefile.in
# into a proper Makefile

#
# If you want to ignore missing datafile errors uncomment the following
# line. This is especially useful with large tiled datasets that may not
# have complete data for each tile.
#
#IGNORE_MISSING_DATA=-DIGNORE_MISSING_DATA
IGNORE_MISSING_DATA = @IGNORE_MISSING_DATA@

#
# If you want to use shape Z and M parameter this option must be set.
# It's OFF by default.
#
#USE_POINT_Z_M=-DUSE_POINT_Z_M
USE_POINT_Z_M = @USE_POINT_Z_M@

#
# Apparently these aren't as commonplace as I'd hoped. Edit the
# following line to reflect the missing functions on your platform.
#
# STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP -DNEED_STRDUP -DNEED_STRLCAT
STRINGS= @STRINGS@

# Proj.4 distribution (cartographic projection routines). Not required for normal use. (EXPERIMENTAL)
PROJ_INC= @PROJ_INC@
PROJ_LIBS= @PROJ_LIBS@
PROJ=     @PROJ_ENABLED@

# GD distribution (graphics library GIF and/or PNG support). (REQUIRED)
#
#   - Versions 1.3 to 1.5 write non-LZW GIF (-DUSE_GD_1_3).
#   - Versions 1.6 and greater write PNG (-DUSE_GD_1_6). Add -lpng -lz to GD_LIB line.
#
#
GDFONT_OBJ=gd-1.2/gdfontt.o gd-1.2/gdfonts.o gd-1.2/gdfontmb.o gd-1.2/gdfontl.o gd-1.2/gdfontg.o
GD_INC=  @GD_INC@
GD_LIB=  @GD_LIB@
GD=      @GD_DEF@
GD_STATIC = @GD_STATIC@

#
# Optional Anti-Grain Geometry Support.
#
AGG=     @AGG_ENABLED@
AGG_INC=  @AGG_INC@


# 
# ZLIB option (compressed SVG)
#
ZLIB_INC=  @ZLIB_INC@
ZLIB_LIB=  @ZLIB_LIB@
ZLIB=      @ZLIB_ENABLED@

# PDFlib distribution (PDF library w/ PDF support). (EXPERIMENTAL)
#
#
#
PDF_INC=  @PDF_INC@
PDF_LIB=  @PDF_LIB@
PDF=      @PDF_ENABLED@

# TIFF distribution (raster support for TIFF and GEOTIFF imagery). (RECOMMENDED)
TIFF_INC= @TIFF_INC@
TIFF_LIB= @TIFF_LIB@
TIFF=     @TIFF_ENABLED@

# JPEG distribution (raster support for grayscale JPEG images, INPUT ONLY).
JPEG_INC= @JPEG_INC@
JPEG_LIB= @JPEG_LIB@
JPEG=     @JPEG_ENABLED@

# EPPL7 Support (this activates ERDAS as well) Included in the distribution. Probably the best raster alternative if
# you've got EPPL7 laying around. See http://www.lmic.state.mn.us/ for more information. (RECOMMENDED)
EPPL=     @EPPL_ENABLED@
EPPL_OBJ= @EPPL_OBJ@

# ESRI SDE Support. You MUST have the SDE Client libraries and include files
# on your system someplace. The actual SDE server you wish to connect to can
# be elsewhere.
SDE=	  @SDE_ENABLED@
SDE_LIB=  @SDE_LIB@
SDE_INC=  @SDE_INC@

# Optional OGR Support.  OGC Simple Feature inspired interface for vector
# formats.  See http://ogr.maptools.org/
# Note that since OGR is part of the GDAL library, it uses GDAL_LIB + GDAL_INC
OGR=	  @OGR_ENABLED@

# Optional GDAL Support (provides read access to a variety of raster formats)
# See http://www.remotesensing.org/gdal/
GDAL=	  @GDAL_ENABLED@
GDAL_LIB=  @GDAL_LIB@
GDAL_INC=  @GDAL_INC@

# Optional GEOS Support.
# See http://geos.refractions.net/
GEOS=     @GEOS_ENABLED@
GEOS_LIB=  @GEOS_LIB@
GEOS_INC=  @GEOS_INC@

# Optional PostGIS Support.  See http://postgis.refractions.net/
POSTGIS=      @POSTGIS_ENABLED@
POSTGIS_LIB=  @POSTGIS_LIB@
POSTGIS_INC=  @POSTGIS_INC@

# Optional MyGIS Support.  See http://postgis.refractions.net/
MYGIS=      @MYGIS_ENABLED@
MYGIS_LIB=  @MYGIS_LIB@
MYGIS_INC=  @MYGIS_INC@

# Optional ORACLESPATIAL Support. Contact: cabral@cttmar.univali.br
ORACLESPATIAL=@ORACLESPATIAL_ENABLED@
ORACLESPATIAL_LIB=@ORACLESPATIAL_LIB@
ORACLESPATIAL_INC=@ORACLESPATIAL_INC@

# Optional MING/SWF/FLASH Support. Contact: assefa@dmsolutions.ca
MING=@MING_ENABLED@
MING_LIB=@MING_LIB@
MING_INC=@MING_INC@

# libcurl ... required for WMS/WFS Client Connections
CURL_INC=@CURL_INC@
CURL_LIB=@CURL_LIB@

# libxml2 ... required for OGC SOS Server
XML2_INC=@XML2_INC@
XML2_LIB=@XML2_LIB@

# Optional FastCGI
FASTCGI=@FASTCGI_ENABLED@
FASTCGI_INC=@FASTCGI_INC@
FASTCGI_LIB=@FASTCGI_LIB@

# OWS: OGC Web Services support
# OGC WMS Server:  -DUSE_WMS_SVR (Requires PROJ4 support)
# OGC WMS Client Connections:  -DUSE_WMS_LYR (Requires PROJ4 and libcurl)
# OGC WFS Server: -DUSE_WFS_SVR (Requires OGR, PROJ4 recommended)
# OGC WFS Client: -DUSE_WFS_LYR (Requires OGR, PROJ4 and libcurl)
# OGC WCS Server: -DUSE_WCS_SVR (Requires GDAL and PROJ4)
# OGC SOS Server: -DUSE_SOS_SVR (Requires PROJ4 and libxml2)
OWS=@WMS_SVR_ENABLED@ @WMS_LYR_ENABLED@ @WFS_SVR_ENABLED@ @WFS_LYR_ENABLED@ @WCS_SVR_ENABLED@ @SOS_SVR_ENABLED@

#
# IMPORTANT NOTE ABOUT REGEX FOR PHP_MAPSCRIPT USERS:
#
# In order to compile the PHP_MAPSCRIPT module, we have to make MapServer
# uses the same version of the REGEX library that PHP was compiled with:
#
PHP_REGEX_OBJ=@PHP_REGEX_OBJ@
PHP_REGEX_INC=@PHP_REGEX_INC@

#
# Multithreading support.
#
THREAD=@THREAD_FLAG@
THREAD_LIB=@THREAD_LIB@

#
# libiconv - Enables Internationalization
#
ICONV=@ICONV_ENABLED@
ICONV_LIB=@ICONV_LIB@
ICONV_INC=@ICONV_INC@

#
# Flags.
#

XTRALIBS= @XTRALIBS@
RUNPATHS= @RPATHS@

FLAGS = @DEBUG_FLAGS@ \
        $(IGNORE_MISSING_DATA) $(USE_POINT_Z_M) $(STRINGS) $(EPPL) $(PROJ) \
	$(OWS) $(MING) $(ORACLESPATIAL) $(TIFF) $(JPEG) $(GD) $(AGG) $(PDF) $(SDE) \
	$(SDERASTER) $(OGR) $(GDAL) $(GEOS) $(ICONV) $(FASTCGI) $(PHP_REGEX) \
	$(REGEX_INC) $(POSTGIS) $(MYGIS) $(THREAD) $(ZLIB) \
	$(GD_INC) $(AGG_INC) $(PDF_INC) $(PROJ_INC) $(TIFF_INC) $(JPEG_INC) $(EGIS_INC) \
	$(SDE_INC) $(GDAL_INC) $(POSTGIS_INC) $(MYGIS_INC) \
	$(CURL_INC) $(MING_INC) $(ORACLESPATIAL_INC) $(GEOS_INC) $(ICONV_INC) \
	$(FASTCGI_INC) $(ZLIB_INC) $(XML2_INC)

CCFLAGS   = @CFLAGS@ $(FLAGS)

# Link flags and shared libs only
SUP_LIBS =  $(GD_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
          $(JPEG_LIB) $(SDE_LIB) $(GDAL_LIB) $(MING_LIB) $(POSTGIS_LIB) \
	  $(MYGIS_LIB) $(CURL_LIB) $(ORACLESPATIAL_LIB) $(GEOS_LIB) \
	  $(THREAD_LIB) $(ICONV_LIB) $(ZLIB_LIB) $(XML2_LIB) $(XTRALIBS)

# STATIC_LIBS is full filename with path of libs that will be statically linked
STATIC_LIBS= $(GD_STATIC)

LDFLAGS= $(RUNPATHS) -L../.. -lmapserver $(SUP_LIBS) $(STATIC_LIBS)

LIBMAPSCRIPT_SHARED= libmapscript.@SO_EXT@
LD_SHARED= @LD_SHARED@

# END OF CONFIGURE----

#
# SWIG Stuff
#
SWIG= swig

#
# CSHARP Stuff
#
CSC= mcs

CC= @CC@

#
# --- You shouldn't have to edit anything else. ---
#
all: interface mapscript_so mapscript_csharp

sign:
	sn -k mapscript.snk

interface: ../mapscript.i
	$(SWIG) -csharp -namespace OSGeo.MapServer $(FLAGS) -o mapscript_wrap.c ../mapscript.i

mapscript_so: mapscript_wrap.c
	$(CC) -fpic -c $(CCFLAGS) mapscript_wrap.c
	$(LD_SHARED) mapscript_wrap.o -o $(LIBMAPSCRIPT_SHARED) $(LDFLAGS)

mapscript_csharp::
	$(CSC) /t:library /out:mapscript_csharp.dll *.cs config/AssemblyInfo.cs
	$(CSC) /r:mapscript_csharp.dll /out:shpdump.exe examples/shpdump.cs
	$(CSC) /r:mapscript_csharp.dll /out:shapeinfo.exe examples/shapeinfo.cs
	$(CSC) /r:mapscript_csharp.dll /out:drawmap.exe examples/drawmap.cs
	$(CSC) /r:mapscript_csharp.dll /out:inline.exe examples/inline.cs
	$(CSC) /r:mapscript_csharp.dll /out:drawquery.exe examples/drawquery.cs
	$(CSC) /r:mapscript_csharp.dll /r:System.Drawing.dll /out:getbytes.exe examples/getbytes.cs
	$(CSC) /r:mapscript_csharp.dll /out:HTMLtemplate.exe examples/HTMLtemplate.cs
	$(CSC) /r:mapscript_csharp.dll /out:RFC24.exe examples/RFC24.cs

dll_config: Makefile
	rm -rf mapscript_csharp.dll.config
	echo "<configuration>" >> mapscript_csharp.dll.config
	echo "<dllmap dll=\"mapscript\" target=\""mapscript"\">" >> mapscript_csharp.dll.config
	echo "</configuration>" >> mapscript_csharp.dll.config

clean:
	rm -rf edu *.o *.c *.cs *.@SO_EXT@ *.dll *.dll.config

test:
	LC_ALL=C mono ./shpdump.exe ../../tests/point.shp
	LC_ALL=C mono ./shapeinfo.exe ../../tests/point.shp
	LC_ALL=C mono ./inline.exe aggpng24 inline_test.png
	LC_ALL=C mono ./drawmap.exe ../../tests/test.map test_csharp.png
ifeq ($(strip $(AGG)),-DUSE_AGG)
	LC_ALL=C mono ./drawmap.exe ../../tests/test.map test_csharp_agg.png aggpng24
endif
	LC_ALL=C mono ./getbytes.exe ../../tests/test.map test_csharp2.png
	LC_ALL=C mono ./RFC24.exe ../../tests/test.map

