# Makefile.in: -*- Text -*-  Source for configure to make a Makefile from.
# Author: Brian J. Fox (bfox@ai.mit.edu).
#
# This file is part of <Meta-HTML>(tm), a system for the rapid deployment
# of Internet and Intranet applications via the use of the Meta-HTML
# language.
#
#  Copyright (c) 1995, 1996, Brian J. Fox (bfox@ai.mit.edu).
#  Copyright (c) 1996, Universal Access Inc. (http://www.ua.com).
#
# Meta-HTML is free software; you can redistribute it and/or modify
# it under the terms of the UAI Free Software License as published
# by Universal Access Inc.; either version 1, 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
# UAI Free Software License for more details.
#
# You should have received a copy of the UAI Free Software License
# along with this program; if you have not, you may obtain one by
# writing to:
#
# Universal Access Inc.
# 129 El Paseo Court
# Santa Barbara, CA
# 93101

# Items that were filled in by configure.
VPATH	= @srcdir@
srcdir	= @srcdir@
DEFS	= @DEFS@
INSTALL = @INSTALL@
DASH_SHARED = @DASH_SHARED@
SHARED_LD = @SHARED_LD@
GDBMLIB = @GDBMLIB@
GDBM_IN = @GDBM_IN@
MSQLLIB = @MSQLLIB@
MSQL_IN = @MSQL_IN@
IODBCLIB = @IODBCLIB@
IODBC_IN = @IODBC_IN@
DESLIB	= @DESLIB@
DBINC	= $(GDBM_IN) $(MSQL_IN) $(IODBC_IN)
DBLIB	= $(GDBMLIB) $(MSQLLIB) $(IODBCLIB) $(DESLIB)
PERL_INC= @PERL_INC@
PERL_LIB= @PERL_LIB@
MODPERL_SO = @MODPERL_SO@
OS_LIBS = @OS_LIBS@
EXE	= @EXE@

WEBBASEDIR = @WEBBASEDIR@
WEBDEF	= -DWEBBASEDIR='"$(WEBBASEDIR)"'
VERSDEF = -DMHTML_VERSION_STRING='"$(MHTML_VERSION)"'
prefix	= @prefix@
exec_prefix = @exec_prefix@
bindir	= $(exec_prefix)/bin
libdir	= $(exec_prefix)/lib

# The real locations of programs.
AR	= ar
RANLIB	= @RANLIB@
MKDIR	= mkdir
LN	= ln
CP	= cp
RM	= rm -f
LD	= ld

# You cannot compile with anything other than GNU C.
CC		 = gcc $(GCC_WARN)
GCC_WARN	= -Wall -Wstrict-prototypes -Wshadow
# PROFILE_FLAGS	= -pg
DEBUG_FLAGS	= -g $(PROFILE_FLAGS)
# OPTIMIZE_FLAGS	= -O69
INCLUDE_FLAGS	= @EXTRAINC@ -I.. -I../libutils -I../libmhtml $(DBINC)
CFLAGS		= $(OPTIMIZE_FLAGS) $(DEBUG_FLAGS) $(PCFLAGS) $(INCLUDE_FLAGS)
LDFLAGS		= $(DEBUG_FLAGS)

MODULES		= example.so directory.so logs.so parser.so timer.so \
		  profiler.so elsewhen.so $(MODPERL_SO)
TARGETS		= $(MODULES)

.SUFFIXES: .so
.c.so:
	$(CC) -c -o $*.o $(CFLAGS) $(DEFS) $(VERSDEF) $(INCLUDE_FLAGS) $<
	$(SHARED_LD) $(LD_FLAGS) $(DASH_SHARED) -o $@ $*.o

all:	$(TARGETS)

modperl.so: modperl.c
	$(CC) -c -o modperl.o $(CFLAGS) $(DEFS) $(VERSDEF) $(INCLUDE_FLAGS) $(PERL_INC) $<
	$(SHARED_LD) $(LD_FLAGS) -L $(PERLBASE) $(DASH_SHARED) -o modperl.so modperl.o $(PERL_LIB)

Makefile: Makefile.in
	(cd ..; ./config.status)

install: $(TARGETS)
	if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
	for file in $(TARGETS); do \
	  $(INSTALL) $$file $(libdir)/$$file; \
	done

clean-executables: FORCE
	$(RM) $(TARGETS)

clean:  FORCE
	$(RM) *.o $(TARGETS) so_locations

distclean realclean: clean
	$(RM) *.cache *.log Makefile *~

tags TAGS: FORCE
	(cd ..; $(MAKE) $@)

FORCE:
