# Generated automatically from Makefile.in by configure.
# $Id: Makefile.in,v 1.55 1997/01/13 04:34:37 rasmus Exp $
#
# Makefile for PHP/FI
# Copyright 1995,1996,1997 Rasmus Lerdorf
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of 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.
#
#  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 the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

srcdir = .

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644

prefix = /usr/local
exec_prefix = ${prefix}

### configure variable replacement block ###
SHELL = /bin/sh
AR = ar rc
RANLIB = ranlib
CC = gcc
YACC = bison -y -d -l
LIBS = -L.  -lm  -lgdbm       
STATICLIBS = -lgdbm -lm        
USEDLIBS = 
OPT_CFLAGS = -O
INC_CFLAGS = 
SYS_CFLAGS = 
CFLAGS = $(OPT_CFLAGS) $(INC_CFLAGS) $(SYS_CFLAGS) -DPHPSENDMAIL=1 -DSENDMAIL=\""/usr/sbin/sendmail -t"\"
LDFLAGS =        
#DEBUG=-g -Wall -DDEBUG
#CPPFLAGS =  -I.              -I/usr/include/apache -DACCESS_CONTROL -DACCESS_DIR=\"/var/lib/php/access\" -DLOGGING=1 -DLOG_DIR=\"/var/lib/php/log\"  -DFILE_UPLOAD -DAPACHE=1 -DAPACHE_NEWAPI=1 $(DEBUG) 
CPPFLAGS =  -I.   -DACCESS_CONTROL -DACCESS_DIR=\"/var/lib/php/access\" -DLOGGING=1 -DLOG_DIR=\"/tmp/php.log\"  -DFILE_UPLOAD $(DEBUG) 

PHP_PROGS:  libphp.a module_auto_build

# Files that can be generated, but should be up to date for a distribution.
DISTDEP = Makefile
# Files to distribute.
DISTFILES = ChangeLog README COPYING \
	src/Makefile.in config.h.in configure.in configure \
	install-sh install src/parse.raw src/lex.c src/main.c src/error.c \
	src/date.c src/stack.c src/calc.c src/var.c src/echo.c src/php.h \
	src/cond.c src/switch.c src/db.c src/while.c src/parse.h \
	src/string.c src/msql.c src/sybsql.c src/pg95.c src/reg.c src/exec.c\
	src/uniqid.c \
	src/file.c src/crypt.c src/head.c src/info.c src/post.c src/type.c \
	src/conf.c src/acc.c src/local.c src/dns.c src/log.c src/sort.c src/dir.c \
	src/rand.c src/gd.c examples/log.html examples/log.readme examples/clock.html \
	src/parse.c src/mime.c src/fsock.c src/microtime.c src/mod_php.c src/mod_php.h \
	src/pool.c src/regex/COPYRIGHT src/regex/Makefile \
	src/regex/README src/regex/WHATSNEW src/regex/cclass.h \
	src/regex/cname.h src/regex/debug.c src/regex/engine.c \
	src/regex/main.c src/regex/mkh src/regex/regcomp.c src/regex/regerror.c \
	src/regex/regex.3 src/regex/regex.7 src/regex/regex.h \
	src/regex/regex2.h src/regex/regexec.c src/regex/regfree.c \
	src/regex/split.c src/regex/tests src/regex/utils.h \
	src/mysql.c src/solid.c src/mail.c \
	scripts/msqllog scripts/mysqllog \
	examples/url.readme examples/url_add.html examples/url_cat.html \
	examples/url_main.html examples/demo_main.html examples/demo_dir.html \
	examples/demo_echo.html examples/demo_last.html examples/demo_rand.html \
	examples/demo_synt.html examples/demo_dns.html examples/demo_date.html \
	examples/demo_str.html examples/demo_reg.html examples/demo_msql.html \
	examples/demo_dbm.html examples/demo_misc.html examples/demo_stat.html \
	examples/guestbook.html examples/survey.html examples/rwho.html \
	examples/mail.html examples/README examples/mlog.html examples/mlog_today.inc \
	examples/mlog_total.inc examples/mlog_yesterday.inc examples/mlog_ref.inc \
	examples/mlog_top.inc examples/setsince.html \
	examples/mylog.html examples/mylog_today.inc \
	examples/mylog_total.inc examples/mylog_yesterday.inc \
	examples/mylog_ref.inc examples/mylog_top.inc \
	examples/sybase/README examples/sybase/add.html examples/sybase/back.gif \
	examples/sybase/book.gif examples/sybase/bookmarks.html \
	examples/sybase/create.gif examples/sybase/create.html \
	examples/sybase/crtab.sql examples/sybase/delete.gif \
	examples/sybase/delete.html examples/sybase/folder.gif \
	examples/sybase/index.html examples/sybase/mark-big.gif \
	examples/sybase/phpwrap.sh examples/sybase/remove.html \
	examples/sybase/wood.gif \
	doc/doc.html doc/nfs_hack.txt doc/config.gif doc/faq.phtml \
	test/testphp test/testmenu test/testphp.awk test/template test/README \
	test/basic/001.tst test/basic/002.tst test/basic/003.tst test/basic/004.tst \
	test/basic/005.tst test/basic/006.tst test/basic/007.tst test/basic/008.tst \
	test/basic/009.tst test/basic/010.tst \
	test/func/001.tst \
	test/reg/001.tst test/reg/002.tst test/reg/003.tst test/reg/004.tst \
	test/reg/005.tst test/reg/006.tst test/reg/007.tst \
	test/msql/001.tst test/msql/002.tst test/msql/003.tst test/msql/README \
	test/dbm/001.tst test/dbm/002.tst test/dbm/003.tst test/dbm/004.tst \
	test/dbm/005.tst test/dbm/006.tst \
	test/lang/001.tst test/lang/002.tst test/lang/003.tst test/lang/004.tst \
	test/lang/005.tst test/lang/006.tst test/lang/007.tst test/lang/008.tst \
	test/lang/009.tst test/lang/010.tst test/lang/011.tst test/lang/012.tst \
	test/lang/013.tst test/lang/014.tst test/lang/015.tst test/lang/015.inc \
	test/lang/016.tst test/lang/016.inc test/lang/017.tst \
	test/pg95/001.tst test/pg95/002.tst test/pg95/003.tst test/pg95/004.tst \
	test/pg95/005.tst test/pg95/README

install: all 
	test/dbm/*.tst test/lang/*.tst

OBJS= parse.o lex.o main.o error.o date.o stack.o calc.o var.o \
	  echo.o cond.o switch.o db.o while.o string.o msql.o sybsql.o\
	  reg.o exec.o file.o crypt.o head.o info.o post.o \
	  type.o conf.o acc.o local.o dns.o log.o sort.o dir.o rand.o \
	  gd.o mime.o fsock.o microtime.o pg95.o pool.o \
	  uniqid.o mysql.o solid.o mail.o

all: $(PHP_PROGS) module_auto_build

regex/libregex.a:
	cd regex; make lib CC=$(CC) AUX_CFLAGS='$(CFLAGS)' RANLIB=$(RANLIB)

.c.o:
	$(CC) $(CFLAGS) $(SYSTEM) $(NSAPI_DEFS) $(NSAPI_INCLUDE) $(CPPFLAGS) -c $<


php.cgi: staticlib
	$(CC) $(CFLAGS) -o php.cgi $(LDFLAGS) -L. -lphp $(USEDLIBS)
	@echo ""
	@echo "If you wish to test your php.cgi binary, type: make test"
	@echo "If not, you may install it by copying it to your cgi-bin"
	@echo "directory at this point."
	@echo ""

sharedlib: libphp.so
libphp.so: libphp.so.1
	ln -s $< $@
libphp.so.1: libphp.so.1.0
	ln -s $< $@
libphp.so.1.0: $(OBJS)
	$(CC) -shared -Wl,-soname,libphp.so.1 -o $@ $(OBJS)

staticlib: libphp.a
libphp.a: $(OBJS)
	$(AR) libphp.a $(OBJS)
	$(RANLIB) libphp.a

mod_php.o: mod_php.h mod_php.c
	$(CC) -fPIC $(CFLAGS) $(SYSTEM) $(NSAPI_DEFS) $(NSAPI_INCLUDE) $(CPPFLAGS) -DDEBIAN -c $(srcdir)/mod_php.c

mod_php-dynamic.so: mod_php.o
	$(CC) -shared $< $(LDFLAGS) -L. -lphp $(LIBS) -lm -o $@
mod_php-static.so: mod_php.o
	$(CC) -shared $< $(LDFLAGS) -L. -lphp $(STATICLIBS) -lm -o $@

module_auto_build: 
	@echo "The PHP module has been built for ELF dynamic linking."
	@echo "Please install it where it belongs (usually in the"
	@echo "/usr/local/lib/apache/modules or /usr/lib/apache/modules"
	@echo "directories) and add a LoadModule line to your httpd.conf"
	@echo "file."

module_user_build: $(OBJS)
	-cp mod_php.[ch] libphp.a /usr/include/apache
	@echo ""
	@echo "You now need to recompile your Apache server."
	@echo "mod_php.* and libphp.a should have been copied to your"
	@echo "Apache src directory, if they weren't, do so manually."
	@echo "Then edit your Confiration file for Apache and look for"
	@echo "the EXTRA_CFLAGS line and add "
	@echo "-DSERVER_SUBVERSION=\\\"PHP/FI-2.0b10\\\", then on"
	@echo "the \"EXTRA_LIBS\" line and add the following to that line:"
	@echo ""
	@echo "-L. -lphp  -lgdbm           -lm"
	@echo ""
	@echo "If you have the GD library, you will need to add -lgd to the above."
	@echo "Make sure you add -lgd before -lm on the above line."
	@echo ""
	@echo "For Apache 1.2 you must set the WANTHSREGEX Configuration parameter to 'no'"
	@echo "Then add the following line to the very end of the Configuration file:"
	@echo ""
	@echo "Module php_module   mod_php.o"
	@echo ""
	@echo "After compiling and testing your httpd binary, you may want to"
	@echo "strip it of its debugging symbols with: strip httpd"
	@echo ""

parser:
	mv parse.raw parse.y
	$(YACC) parse.y
	mv *.tab.c parse.c
	mv *.tab.h parse.h
	mv parse.y parse.raw

clean:
	rm -f Makefile ../config.status ../config.cache ../config.log php.cgi *.o core *.so.* regex/*.a regex/*.o

tags:
	etags ${srcdir}/*.c ${srcdir}/*.h ${srcdir}/[a-z]*.in

test:
	cd ../test; \
	./testmenu

dist: $(DISTDEP)
	distname=`sed -e '/define PHP_VERSION/!d' \
	-e 's/[^0-9.]*\([0-9.a-z]*\).*/php-\1/' -e q php.h`; \
	rm -fr ../$$distname; \
	mkdir ../$$distname; \
	mkdir ../$$distname/examples; \
	mkdir ../$$distname/examples/sybase; \
	mkdir ../$$distname/src; \
	mkdir ../$$distname/src/regex; \
	mkdir ../$$distname/doc; \
	mkdir ../$$distname/scripts; \
	mkdir ../$$distname/test; \
	mkdir ../$$distname/test/basic; \
	mkdir ../$$distname/test/lang; \
	mkdir ../$$distname/test/func; \
	mkdir ../$$distname/test/reg; \
	mkdir ../$$distname/test/dbm; \
	mkdir ../$$distname/test/msql; \
	mkdir ../$$distname/test/pg95; \
	for file in $(DISTFILES); do \
	  ln ../$$file ../$$distname/$$file \
	  || { echo copying ../$$file instead; cp -p ../$$file ../$$distname/$$file;}; \
	done; \
	chmod -R a+rX ../$$distname; \
	cd ..; \
	tar -chvf $$distname.tar $$distname; \
	rm -fr $$distname

cond.o: cond.c parse.h php.h
main.o: main.c php.h
stack.o: stack.c php.h parse.h
calc.o: calc.c php.h parse.h
date.o: date.c php.h parse.h
echo.o: echo.c php.h parse.h
lex.o: lex.c php.h parse.h
var.o: var.c php.h parse.h
switch.o: switch.c php.h parse.h
db.o: db.c php.h parse.h
string.o: string.c php.h parse.h
reg.o: reg.c php.h parse.h
exec.o: exec.c php.h parse.h
file.o: file.c php.h parse.h
crypt.o: crypt.c php.h parse.h
head.o: head.c php.h parse.h
info.o: info.c php.h
post.o: post.c php.h parse.h
type.o: type.c php.h parse.h
conf.o: conf.c php.h
acc.o: acc.c php.h
local.o: local.c php.h
dns.o: dns.c php.h parse.h
log.o: log.c php.h
sort.o: sort.c php.h parse.h
dir.o: dir.c php.h parse.h
rand.o: rand.c php.h parse.h
error.o: error.c php.h
gd.o: gd.c parse.h php.h
fsock.o: fsock.c php.h parse.h
microtime.o: microtime.c php.h parse.h
pg95.o: pg95.c php.h parse.h
mysql.o: mysql.c php.h parse.h
solid.o: solid.c php.h parse.h
mail.o: mail.c php.h parse.h
uniqid.o: uniqid.c php.h parse.h
sybsql.o: sybsql.c php.h parse.h
install: all 
