NGINX_DIR = $(top_builddir)/vendor/nginx-$(NGINX_VERSION)

EXTRA_DIST =					\
	nginx-module				\
	configure

if WITH_GROONGA_HTTPD
NGINX_MAKEILE = $(NGINX_DIR)/Makefile
NGINX_MAKEFILE_DEPEND_FILES =			\
	configure				\
	Makefile.am				\
	$(top_builddir)/config.status		\
	$(srcdir)/nginx-module/config

$(NGINX_MAKEILE): $(NGINX_MAKEFILE_DEPEND_FILES)
	$(srcdir)/configure --srcdir="$(srcdir)" `../../config.status --config`

# nginx's Makefile specify 'build' as the default rule.
# This isn't compatible with the 'all' default rule generated by Automake
# So, override the all rule.
all-nginx: $(NGINX_MAKEILE)
	(cd $(NGINX_DIR) && $(MAKE) build)
all-local: all-nginx

clean-nginx: $(NGINX_MAKEILE)
	(cd $(NGINX_DIR) && $(MAKE) clean)
clean-local: clean-nginx

install-exec-nginx: $(NGINX_MAKEILE)
	(cd $(NGINX_DIR) && $(MAKE) install)
install-exec-local: install-exec-nginx
endif
