##
##  Makefile -- Build procedure for sample gsbundle Apache module
##  Autogenerated via ``apxs -n gsbundle -g''.
##

#   the used tools
ifeq ($(osx),yes)
APACHEROOT=/Users/helge/apache1/
APACHEBIN=$(APACHEROOT)bin/
APXS=$(APACHEBIN)apxs
APACHECTL=$(APACHEBIN)apachectl
else
APXS=apxs
APACHECTL=apachectl
endif

#   additional user defines, includes and libraries
#DEF=-Dmy_define=my_value
#INC=-Imy/include/dir
#LIB=-Lmy/lib/dir -lmylib

#   the default target
all: mod_gsbundle.so

#   compile the DSO file
ifeq ($(USE_DYLD),yes)

APFLAGS=-DDARWIN -DUSE_HSREGEX -DSHARED_MODULE -I$(APACHEROOT)include/Apache

mod_gsbundle.o: mod_gsbundle.c
	$(CC) $(APFLAGS) -c $< -o $@

mod_gsbundle.so: mod_gsbundle.o
	$(CC) -bundle -undefined suppress -flat_namespace -o $@ $< -framework Foundation

else
mod_gsbundle.so: mod_gsbundle.c
	$(APXS) -c $(DEF) $(INC) $(LIB) mod_gsbundle.c
endif

#   install the DSO file into the Apache installation
#   and activate it in the Apache configuration
install: all
	$(APXS) -i -a -n 'gsbundle' mod_gsbundle.so

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

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

#   reload the module by installing and restarting Apache
reload: install restart

#   the general Apache start/restart/stop procedures
start:
	$(APACHECTL) start
restart:
	$(APACHECTL) restart
stop:
	$(APACHECTL) stop

