summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
Diffstat (limited to 'make')
-rw-r--r--make/nginx.mk11
1 files changed, 10 insertions, 1 deletions
diff --git a/make/nginx.mk b/make/nginx.mk
index 85a7be4..f0e23a1 100644
--- a/make/nginx.mk
+++ b/make/nginx.mk
@@ -1,3 +1,8 @@
+installed_nginx_sites = $(wildcard /etc/nginx/http.d/*.joeac.net.conf)
+installed_nginx_subdomains = $(installed_nginx_sites:/etc/nginx/http.d/%.joeac.net.conf=%)
+nginx_subdomains_to_remove = $(filter-out $(SUBDOMAINS),$(installed_nginx_subdomains))
+nginx_sites_to_remove = $(nginx_subdomains_to_remove:%=/etc/nginx/http.d/%.joeac.net.conf)
+
define install_nginx_module_rule =
.PHONY: install_nginx_$(module)
install_nginx_$(module): $(if $(SUBDOMAIN_$(module)),/etc/nginx/http.d/$(SUBDOMAIN_$(module)).joeac.net.conf)
@@ -25,11 +30,15 @@ $(foreach module,$(MODULES),$(eval $(uninstall_nginx_module_rule)))
/etc/nginx/http.d:
sudo mkdir -p /etc/nginx/http.d
+.PHONY: remove_/etc/nginx/http.d/%.joeac.net.conf
+remove_/etc/nginx/http.d/%.joeac.net.conf:
+ rm -f $(@:remove_%=%)
+
.PHONY: install_nginx
install_nginx: /etc/nginx/nginx.conf $(add_prefix install_nginx_,$(NGINX_MODULES))
.PHONY: reinstall_nginx
-reinstall_nginx: /etc/nginx/nginx.conf $(add_prefix reinstall_nginx_,$(NGINX_MODULES))
+reinstall_nginx: /etc/nginx/nginx.conf $(add_prefix reinstall_nginx_,$(NGINX_MODULES)) $(addprefix remove_,$(nginx_sites_to_remove))
.PHONY: uninstall_nginx
uninstall_nginx: $(foreach module,$(NGINX_MODULES),uninstall_nginx_$(module))