# Run ./configure in the main MapServer directory to turn this Makefile.in
# into a proper Makefile

#
# This is an adapted version of php-3.0.14/dl/Makefile.tmpl for the 
# MapServer php_mapscript.so module.
#
# $Id: Makefile.in,v 1.15 2006/08/26 16:29:54 hobu Exp $
#

# +----------------------------------------------------------------------+
# | PHP HTML Embedded Scripting Language Version 3.0                     |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997,1998 PHP Development Team (See Credits file)      |
# +----------------------------------------------------------------------+
# | This program is free software; you can redistribute it and/or modify |
# | it under the terms of one of the following licenses:                 |
# |                                                                      |
# |  A) the GNU General Public License as published by the Free Software |
# |     Foundation; either version 2 of the License, or (at your option) |
# |     any later version.                                               |
# |                                                                      |
# |  B) the PHP License as published by the PHP Development Team and     |
# |     included in the distribution in the file: LICENSE                |
# |                                                                      |
# | This program is distributed in the hope that it will be useful,      |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
# | GNU General Public License for more details.                         |
# |                                                                      |
# | You should have received a copy of both licenses referred to here.   |
# | If you did not, or have any questions about PHP licensing, please    |
# | contact core@php.net.                                                |
# +----------------------------------------------------------------------+

CC =     gcc -fPIC
LD =     g++ -shared 
CFLAGS = -O2 -fPIC -Wall    -DCOMPILE_DL=1 -DPHP4
RUNPATHS= 

#
# Set PHP_SRC_DIR to point to the root of the PHP source tree
#
PHP_SRC_DIR = /usr/include/php

PHP_INC = -I$(PHP_SRC_DIR) -I$(PHP_SRC_DIR)/dl -I$(PHP_SRC_DIR)/main \
	  -I$(PHP_SRC_DIR)/Zend -I$(PHP_SRC_DIR)/include \
	  -I$(PHP_SRC_DIR)/TSRM 

#
# 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_INC=


#
# Set MapServer extensions parameters.  See main MapServer Makefile for 
# more details... 
# Common defaults are:
# MS_DEFINE = -DUSE_TTF -DUSE_TIFF -DUSE_EPPL -DUSE_GD_1_2
# MS_INCLUDE = -I../.. -I../../gd-1.2 -I../../gdft
# MS_LIBS = -L../.. -lmap -L../../gdft -lgdft -ltiff -lttf -L../../gd-1.2 -lgd
#
MS_DEFINE =          -DUSE_WMS_SVR    -DUSE_POSTGIS  -DUSE_GDAL -DUSE_OGR -DUSE_GEOS   -DUSE_PROJ -DUSE_EPPL   -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DUSE_ICONV -DUSE_ZLIB 
MS_INC =    -I/usr/local/src/mapserver-4.10.0       -I/usr/include  -I/usr/local/include -I/usr/local/include  -I/usr/local/include  -I/usr/include   
MS_STATIC =  
MS_LIBS =   $(RUNPATHS) -L/usr/local/src/mapserver-4.10.0 -lmap       -L/usr/lib -lpq  -ljpeg -lfreetype -lpng -lz   -L/usr/local/lib -lgdal -L/usr/local/lib -lgeos_c   -L/usr/local/lib -lproj  -lgd -L/usr/lib -lgd -ljpeg -lfreetype -lpng -lz   -lc -lz   -lm -lstdc++ $(MS_STATIC)


#
# The rest of the file should not have to be edited...
#

CFLAGS112 = $(CFLAGS) $(MS_DEFINE) $(MS_INC) $(PHP_INC) $(PHP_REGEX_INC)

all: php_mapscript.so

PHPMS_OBJS =  php_mapscript_util.o php_mapscript.o mapscript_i.o $(PHP_REGEX_OBJ)

PHPPROJ_OBJS = php_mapscript_util.o php_proj.o $(PHP_REGEX_OBJ)


php_mapscript.so: $(PHPMS_OBJS) ../../libmap.a
	$(LD) -o $@ $(PHPMS_OBJS) $(MS_LIBS)

php_proj.so:  $(PHPPROJ_OBJS)
	$(LD) -o $@ $(PHPPROJ_OBJS) $(MS_LIBS)

%.o: %.c php_mapscript_util.h php_mapscript.h
	$(CC) $(CFLAGS112) -c -o $@ $<


clean:
	-rm -f *.so *.o perl.out

