diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 18:09:28 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 18:09:28 -0400 |
commit | 9d6c4f47d3891f9ad5a1c76e603dd7fe6fb9f4d1 (patch) | |
tree | f2702ea5aa14225435429fb08a99f563c3984447 /build-aux/Makefile.each.tail/10-std.mk | |
parent | 3203387339af01bf01ca13fedad97e0291814229 (diff) | |
parent | d331934d1fcdaea5474a1da3605907447f7ef6ee (diff) |
Merge remote-tracking branch 'autothing/mod-std'
Diffstat (limited to 'build-aux/Makefile.each.tail/10-std.mk')
-rw-r--r-- | build-aux/Makefile.each.tail/10-std.mk | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk new file mode 100644 index 0000000..5150a71 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -0,0 +1,46 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# Add some more defaults to the *_files variables +std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) + +# Fix each variable at its current value to avoid any weirdness +$(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files))) + +# Make each of the standard variables relative to the correct directory +std.src_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.src_files))) +std.gen_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.gen_files))) +std.cfg_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.cfg_files))) +std.out_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.out_files))) +std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) +std.clean_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.clean_files))) +std.slow_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.slow_files))) + +# Creative targets +$(outdir)/build : $(std.out_files) +$(outdir)/install : $(std.sys_files) +$(outdir)/installdirs: $(sort $(dir $(std.sys_files))) + +# Destructive targets +_std.uninstall/$(outdir) := $(std.sys_files) +_std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files)) +_std.clean/$(outdir) := $(filter-out $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files)) +_std.distclean/$(outdir) := $(filter-out $(std.gen_files) $(std.src_files),$(std.clean_files)) +_std.maintainer-clean/$(outdir) := $(filter-out $(std.src_files),$(std.clean_files)) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): %: %-hook + $(RM) -- $(sort $(filter-out %/,$(_std.$(@F)/$(@D)))) + $(RM) -r -- $(sort $(filter %/,$(_std.$(@F)/$(@D)))) + $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) +$(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook):: +.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook) |