diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-30 14:46:36 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-30 18:54:01 -0500 |
commit | dc9339b5699ee3b0d48145a1389f93e9e09d02a6 (patch) | |
tree | ed71bd691ea6e0d05d47e2bfd891c333bf5709ab /build-aux/Makefile.each.tail/20-libretools.mk | |
parent | 4f9203808ef9607ae27eba3cf77079bbe661fd95 (diff) |
Update and tidy the build system for autothing v3.
Diffstat (limited to 'build-aux/Makefile.each.tail/20-libretools.mk')
-rw-r--r-- | build-aux/Makefile.each.tail/20-libretools.mk | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/build-aux/Makefile.each.tail/20-libretools.mk b/build-aux/Makefile.each.tail/20-libretools.mk index 0b74d41..c498396 100644 --- a/build-aux/Makefile.each.tail/20-libretools.mk +++ b/build-aux/Makefile.each.tail/20-libretools.mk @@ -1,4 +1,4 @@ -# Copyright (C) 2015, 2016 Luke Shumaker +# Copyright (C) 2015-2017 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 @@ -13,40 +13,41 @@ # 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/>. -ifneq ($(sort $(wildcard $(addprefix $(srcdir)/,$(devtools-files)))),$(sort $(addprefix $(srcdir)/,$(devtools-files)))) +ifneq ($(sort $(wildcard $(addprefix $(srcdir)/,$(libretools.src.devtools)))),$(sort $(addprefix $(srcdir)/,$(libretools.src.devtools)))) ifeq ($(wildcard $(devtoolsdir)/),) $(error config.mk:devtoolsdir points to a non-existant directory: $(devtoolsdir)) endif endif -std.src_files += $(libretools-srcs) -std.gen_files += .srcfiles.mk $(devtools-files) -std.out_files += $(filter-out $(std.src_files) $(std.gen_files),$(libretools-files)) \ - $(if $(pots),everything.pot) -std.sys_files += $(addprefix $(bindir)/,$(libretools-bins)) \ - $(addprefix $(pkgconfdir)/,$(libretools-confs)) \ - $(addprefix $(pkglibexecdir)/,$(libretools-libexecs) $(libretools-libs)) \ - $(addprefix $(pkgdocdir)/,$(libretools-docs)) \ - $(addprefix $(mandir)/man1/,$(filter %.1,$(libretools-mans))) \ - $(addprefix $(mandir)/man2/,$(filter %.2,$(libretools-mans))) \ - $(addprefix $(mandir)/man3/,$(filter %.3,$(libretools-mans))) \ - $(addprefix $(mandir)/man4/,$(filter %.4,$(libretools-mans))) \ - $(addprefix $(mandir)/man5/,$(filter %.5,$(libretools-mans))) \ - $(addprefix $(mandir)/man6/,$(filter %.6,$(libretools-mans))) \ - $(addprefix $(mandir)/man7/,$(filter %.7,$(libretools-mans))) \ - $(addprefix $(mandir)/man8/,$(filter %.8,$(libretools-mans))) -std.clean_files += *.pot *.ugly *.rej *.orig .tmp* - -exec_$(outdir) := $(exec_$(outdir)) $(libretools-bins) $(libretools-libexecs) - -_is_executable = $(filter $(exec_$(@D)),$(@F)) +# Connect with `files` module ######################################## +files.src.gen += $(libretools.src.devtools) +files.out.all += $(filter-out $(files.src),$(libretools.out)) \ + $(if $(libretools.pots),everything.pot) +files.sys.all += $(addprefix $(bindir)/,$(libretools.out.bins)) \ + $(addprefix $(pkgconfdir)/,$(libretools.out.confs)) \ + $(addprefix $(pkglibexecdir)/,$(libretools.out.libexecs) $(libretools.out.libs)) \ + $(addprefix $(pkgdocdir)/,$(libretools.out.docs)) \ + $(addprefix $(mandir)/man1/,$(filter %.1,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man2/,$(filter %.2,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man3/,$(filter %.3,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man4/,$(filter %.4,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man5/,$(filter %.5,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man6/,$(filter %.6,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man7/,$(filter %.7,$(libretools.out.mans))) \ + $(addprefix $(mandir)/man8/,$(filter %.8,$(libretools.out.mans))) +files.out.int += *.pot *.ugly *.rej *.orig +# Generate rules ##################################################### $(srcdir)/%.in: $(devtoolsdir)/%.in cp -T '$<' '$@' $(srcdir)/%.in: $(devtoolsdir)/lib/% cp -T '$<' '$@' + +# Build rules ######################################################## +_is_executable = $(filter $(libretools.out.bins) $(libretools.out.libexecs),$(@F)) + $(outdir)/%: $(srcdir)/%.in - @echo 'EDIT < $< > $@'; $(edit) < '$<' | install -T -m$(if $(_is_executable),755,644) /dev/stdin '$@' + @echo 'EDIT < $< > $@'; $(libretools.edit) < '$<' | install -T -m$(if $(_is_executable),755,644) /dev/stdin '$@' $(outdir)/%: $(srcdir)/%.ronn ronn --roff $(RONNFLAGS) < '$<' > '$@' $(outdir)/%.html: $(srcdir)/%.ronn @@ -55,19 +56,20 @@ $(outdir)/%.pot: $(outdir)/% $(topsrcdir)/src/lib/librexgettext $(topsrcdir)/src/lib/librexgettext $(LIBREXGETTEXT_FLAGS) '$<' > '$@' $(outdir)/%.pot: $(srcdir)/% $(topsrcdir)/src/lib/librexgettext $(topsrcdir)/src/lib/librexgettext $(LIBREXGETTEXT_FLAGS) '$<' > '$@' -$(outdir)/everything.pot: $(addprefix $(outdir)/,$(addsuffix .pot,$(pots))) - cat $^ | $(pofmt) > '$@' +$(outdir)/everything.pot: $(addprefix $(outdir)/,$(addsuffix .pot,$(libretools.pots))) + cat $^ | $(libretools.pofmt) > '$@' # If we have a .patch file, the flow is: # $(devtoolsdir)/%.in -> %.in + %.patch -> %.ugly -> % -_do_patch = $(filter $(patsubst %.patch,%,$(filter %.patch,$(detect-all))),$(patsubst %.in,%,$(devtools-files))) +_do_patch = $(filter $(patsubst %.patch,%,$(filter %.patch,$(libretools.src.git))),$(patsubst %.in,%,$(libretools.src.devtools))) $(outdir)/%.ugly: $(srcdir)/%.in $(srcdir)/%.patch cp -T $< $@ patch $@ $(<D)/$*.patch $(sort $(addprefix $(outdir)/,$(_do_patch))): $(outdir)/%: $(outdir)/%.ugly - @echo 'EDIT < $< > $@'; $(edit) < '$<' | install -T -m$(if $(_is_executable),755,644) /dev/stdin '$@' - @echo 'INDENT $@'; $(call indent,$@) - + @echo 'EDIT < $< > $@'; $(libretools.edit) < '$<' | install -T -m$(if $(_is_executable),755,644) /dev/stdin '$@' + @echo 'INDENT $@'; $(call libretools.indent,$@) + +# Install rules ###################################################### $(DESTDIR)$(pkgconfdir)/% : $(outdir)/% ; install -T -Dm644 '$<' '$@' $(DESTDIR)$(pkgdocdir)/% : $(outdir)/% ; install -T -Dm644 '$<' '$@' $(DESTDIR)$(mandir)/man1/%.1: $(outdir)/%.1; install -T -Dm644 '$<' '$@' @@ -78,12 +80,12 @@ $(DESTDIR)$(mandir)/man5/%.5: $(outdir)/%.5; install -T -Dm644 '$<' '$@' $(DESTDIR)$(mandir)/man6/%.6: $(outdir)/%.6; install -T -Dm644 '$<' '$@' $(DESTDIR)$(mandir)/man7/%.7: $(outdir)/%.7; install -T -Dm644 '$<' '$@' $(DESTDIR)$(mandir)/man8/%.8: $(outdir)/%.8; install -T -Dm644 '$<' '$@' -$(DESTDIR)$(pkglibexecdir)/%: $(outdir)/% ; mkdir -p '$(@D)' && cp -T '$<' '$@' +$(DESTDIR)$(pkglibexecdir)/%: $(outdir)/% ; $(MKDIR_P) '$(@D)' && cp -T '$<' '$@' $(DESTDIR)$(bindir)/% : $(outdir)/% ; install -T -Dm755 '$<' '$@' # Repeat the last two rules again with explicit targets because # otherwise it would try to do src/xbs->/bin/xbs instead of # src/xbs/xbs->/bin/xbs -ifneq ($(filter $(notdir $(outdir)),$(libretools-files)),) -$(DESTDIR)$(pkglibexecdir)/$(notdir $(outdir)): $(DESTDIR)$(pkglibexecdir)/%: $(outdir)/% ; mkdir -p '$(@D)' && cp -T '$<' '$@' +ifneq ($(filter $(notdir $(outdir)),$(libretools.out)),) +$(DESTDIR)$(pkglibexecdir)/$(notdir $(outdir)): $(DESTDIR)$(pkglibexecdir)/%: $(outdir)/% ; $(MKDIR_P) '$(@D)' && cp -T '$<' '$@' $(DESTDIR)$(bindir)/$(notdir $(outdir)): $(DESTDIR)$(bindir)/% : $(outdir)/% ; install -T -Dm755 '$<' '$@' endif |