diff --git a/make/subtree.mk b/make/subtree.mk index f90f25ef..50ccd96c 100644 --- a/make/subtree.mk +++ b/make/subtree.mk @@ -1,15 +1,29 @@ +ifeq ($(DEVELOPMENT),false) SUBTREE_OWNER ?= root SUBTREE_GROUP ?= root SUBTREE_MODE ?= 0644 SUBTREE_DIROWNER ?= root SUBTREE_DIRGROUP ?= root SUBTREE_DIRMODE ?= 0755 +else +SUBTREE_OWNER ?= $(shell id -un) +SUBTREE_GROUP ?= $(shell id -gn) +SUBTREE_MODE ?= 0644 +SUBTREE_DIROWNER ?= $(shell id -un) +SUBTREE_DIRGROUP ?= $(shell id -gn) +SUBTREE_DIRMODE ?= 0755 SUBTREE_INSTALL_PREFIX ?= /srv/www/proj/$(PROJECT) +endif -SUBTREE_DIRS = $(shell for f in `git ls-files . | sed 's%/[^/]\+$$%%' | sort -u | grep -v Makefile`; do if [ -d "$$f" ]; then echo $$f; fi; done) -SUBTREE_FILES = $(shell for f in `git ls-files . | grep -v Makefile`; do if [ -f "$$f" ]; then echo $$f; fi; done) -INSTALLED_SUBTREE_DIRS = $(addprefix $(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_DIRS)) -INSTALLED_SUBTREE_FILES = $(addprefix $(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_FILES)) +#ifeq ($(SUBTREE_SRC),) +#SUBTREE_SRC = $(shell find .) +#endif + +SUBTREE_DIRS = $(shell for f in `git ls-files . || find | sed 's%/[^/]\+$$%%' | sort -u | grep -v Makefile`; do if [ -d "$$f" ]; then echo $$f; fi; done) +SUBTREE_FILES = $(shell for f in `git ls-files . || find | grep -v Makefile`; do if [ -f "$$f" ]; then echo $$f; fi; done) + +INSTALLED_SUBTREE_DIRS = $(addprefix $(ENV_PREFIX)$(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_DIRS)) +INSTALLED_SUBTREE_FILES = $(addprefix $(ENV_PREFIX)$(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_FILES)) include $(MODDIR)/make/defs.mk @@ -21,6 +35,6 @@ distclean: $(INSTALLED_SUBTREE_DIRS): $(INSTALL) -d -o $(SUBTREE_DIROWNER) -g $(SUBTREE_DIRGROUP) -m $(SUBTREE_DIRMODE) $@ -$(SUBTREE_INSTALL_PREFIX)/%: % +$(ENV_PREFIX)$(SUBTREE_INSTALL_PREFIX)/%: % $(INSTALL) -o $(SUBTREE_OWNER) -g $(SUBTREE_GROUP) -m $(SUBTREE_MODE) $< $@