# Generated automatically from Makefile.in by configure.
##
##  Makefile.in -- Build procedure for coffice Apache module
##

top_srcdir = ..

default: all

include ${top_srcdir}/Makefile.global

## non-standard include dirs
INC=-I../include -I.
## headers are found in all include dirs:
HDR=$(wildcard *.h) $(wildcard ../include/*.h)

## main module source
MSRC=mod_coffice.c
MOBJ=$(patsubst %.c,%.o,$(MSRC))

## additional code linked with the module
SRC=co_utils.c co_decode.c co_convutils.c co_error.c co_js.c \
co_broker.c co_result.c co_action.c co_session.c ap_parser.c \
co_jsobjects.c co_jsinheritance.c co_submodule.c \
co_recordset.c co_array.c co_string.c co_type.c co_public_web.c \
co_output.c co_logger.c co_context.c
OBJ=$(patsubst %.c,%.o,$(SRC))
CFLAGS=-DLINUX=22 -I/usr/include/gdbm -DEAPI -O2 -march=i386 -mcpu=i686 -fPIC
LIBS=-lpq -ljs 
LDFLAGS=  -L/opt/co/js/lib -L/usr/lib -L/usr/lib
CPPFLAGS= -DXP_UNIX -I/usr/include/apache  -I/opt/co/js/include -I/usr/include -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -I/include
CFLAGS_SHLIB=-fpic -DSHARED_MODULE
LDOPTS=-Wl,''$(OBJ) $(LIBS)''

CFLAGS+=-Wall -Wcast-align -Wwrite-strings -Wno-unused -Werror-implicit-function-declaration
#   the default target
all: mod_coffice.so

.c.o: $(HDR)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_SHLIB) $(INC) $<

$(OBJ): $(HDR)

#   compile the DSO file
mod_coffice.so: $(MSRC) $(OBJ) $(HDR)
	$(APXS) -c $(CPPFLAGS) -Wc,' $(CFLAGS)' $(INC) $(LIBS) $(LDFLAGS) $(LDOPTS) $(MSRC)

#   install the DSO file into the Apache installation
#   and activate it in the Apache configuration
install: all
	$(INSTALLMOD) mod_coffice.so

#   cleanup
clean:
	-rm -f *.o *.so

#   simple test
test: reload
	lynx -mime_header http://localhost/co/

#   reload the module by installing and restarting Apache
reload: install
	$(MAKE) restart

