From ff4c4cf32f993059889d85578e4802f372e768f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 21:09:58 -0400 Subject: move everything into build-aux --- build-aux/Makefile.README.txt | 164 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 build-aux/Makefile.README.txt (limited to 'build-aux') diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt new file mode 100644 index 0000000..935af5f --- /dev/null +++ b/build-aux/Makefile.README.txt @@ -0,0 +1,164 @@ +Luke's AutoMake +=============== + +Yo, this document is incomplete. It describes the magical +automake.{head,tail}.mk Makefiles and how to use them, kinda. + +I wrote a "clone" of automake. I say clone, because it works +differently. Yeah, I need a new name for it. + +High-level overview +------------------- + +Now, what this does for you is: + +It makes it _easy_ to write non-recursive Makefiles--and ones that are +similar to plain recursive Makefiles, at that! (search for the paper +"Recursive Make Considered Harmful") As harmful as recursive make is, +it's historically been difficult to to write non-recursive Makefiles. +This makes it easy. + +It also makes it easy to follow the GNU standards for your makefiles: +it takes care of this entire table of .PHONY targets for you: + +| this | and this | are aliases for this | +|------+------------------+--------------------------------------------------------| +| all | build | $(outdir)/build | +| | install | $(outdir)/install | +| | uninstall | $(outdir)/uninstall | +| | mostlyclean | $(outdir)/mostlyclean | +| | clean | $(outdir)/clean | +| | distclean | $(outdir)/distclean | +| | maintainer-clean | $(outdir)/maintainer-clean | +| | check | $(outdir)/check (not implemented for you) | +| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | + +(You are still responsible for implementing the `$(outdir)/check` +target in each of your Makefiles.) + +What you have to do is: + +In each source directory, you write a `Makefile`, very similarly to if +you were writing for plain GNU Make, with + + topoutdir ?= ... + topsrcdir ?= ... + include $(topsrcdir)/automake.head.mk + + # your makefile + + include $(topsrcdir)/automake.tail.mk + +And in the top-level source directory, Write your own helper makefiles +that get included: + - `common.once.head.mk`: before parsing any of your Makefiles + - `common.each.head.mk`: before parsing each of your Makefiles + - `common.each.tail.mk`: after parsing each of your Makefiles + - `common.each.tail.mk`: after parsing all of your Makefiles + +The `common.*.mk` makefiles are nice for including generic pattern +rules and variables that aren't specific to a directory. + +You're probably thinking that this sounds too good to be true! +Unfortunately, there are two major deviations from writing a plain +recursive Makefile: + + 1. all targets and prerequisites (including .PHONY targets!) need to + be prefixed with + `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. + * sub-gotcha: this means that if a pattern rule has a + prerequisite that may be in srcdir or outdir, then it must be + specified twice, once for each case. + 2. if a prerequisite is in a directory "owned" by another Makefile, + you must filter the pathname through `am_path`: + `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain + a `..` segment; if you need to refer to a sibling directory, do it + relative to `$(topoutdir)` or `$(topsrcdir)`. + +Telling automake about your program +----------------------------------- + +You tell automake what to do for you by setting some variables. They +are all prefixed with `am_`; this prefix may be changed by editing the +`_am` variable at the top of `automake.head.mk`. + +The exception to this is the `am_path` variable, which is a macro that +is used to make a list of filenames relative to the appropriate +directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't +nescessarily equal to `.`. See above. + +There are several commands that generate files; simply record the list +of files that each command generates as the following variable +variables: + +| Variable | Create Command | Delete Command | Description | Relative to | +|--------------+----------------+-----------------------------+-----------------------------------+-------------| +| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | +| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | +| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | +| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | +| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | + +In addition, there are two more variables that control not how files +are created, but how they are deleted: + +| Variable | Affected command | Description | Relative to | +|----------------+------------------+------------------------------------------------+-------------| +| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | +| | | files in `$(am_out_files)`. (Example: `*.o`) | | +|----------------+------------------+------------------------------------------------+-------------| +| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | +| | | _not_ be deleted. (otherwise, `mostlyclean` | | +| | | is the same as `clean`) | | + +Finally, there are two variables that express the relationships +between directories: + +| Variable | Description | +|------------+---------------------------------------------------------| +| am_subdirs | A list of other directories (containing Makefiles) that | +| | may be considered "children" of this | +| | directory/Makefile; building a phony target in this | +| | directory should also build it in the subdirectory. | +| | They are not necesarily actually subdirectories of this | +| | directory in the filesystem. | +|------------+---------------------------------------------------------| +| am_depdirs | A list of other directories (containing Makefiles) that | +| | contain or generate files that are dependencies of | +| | targets in this directory. They are not necesarily | +| | actually subdirectories of this directory in the | +| | filesystem. Except for files that are dependencies of | +| | files in this directory, things in the dependency | +| | directory will not be built. | + +Tips, notes +----------- + +I like to have the first (non-comment) line in a Makefile be: + + include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk + +(adjusting the number of `../` sequences as nescessary). Then, my +(user-editable) `config.mk` is of the form: + + ifeq ($(topsrcdir),) + topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) + topsrcdir := $(topoutdir) + + # your configuration + + endif + +If the package has a `./configure` script, then I have it modifiy +topsrcdir as necessary, as well as modifying whatever other parts of +the configuration. All of the configuration lives in `config.mk`; +`./configure` doesn't modify any `Makefile`s, it just generates +`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to +`$(outdir)/Makefile`. + +---- +Copyright (C) 2016 Luke Shumaker + +This documentation file is placed into the public domain. If that is +not possible in your legal system, I grant you permission to use it in +absolutely every way that I can legally grant to you. -- cgit v1.2.2 From 9c11591c59f467be3ca7c2a511ae22de8f5fb2fd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 00:57:02 -0400 Subject: strip out stuff from gnuconf --- build-aux/Makefile.each.tail/11-gnu.mk | 59 ------------ build-aux/Makefile.each.tail/11-gnustuff.mk | 59 ++++++++++++ build-aux/Makefile.once.head/11-gnu.mk | 143 ---------------------------- build-aux/Makefile.once.head/11-gnustuff.mk | 30 ++++++ build-aux/Makefile.once.tail/11-gnu.mk | 17 ---- build-aux/Makefile.once.tail/11-gnustuff.mk | 17 ++++ 6 files changed, 106 insertions(+), 219 deletions(-) delete mode 100644 build-aux/Makefile.each.tail/11-gnu.mk create mode 100644 build-aux/Makefile.each.tail/11-gnustuff.mk delete mode 100644 build-aux/Makefile.once.head/11-gnu.mk create mode 100644 build-aux/Makefile.once.head/11-gnustuff.mk delete mode 100644 build-aux/Makefile.once.tail/11-gnu.mk create mode 100644 build-aux/Makefile.once.tail/11-gnustuff.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/11-gnu.mk b/build-aux/Makefile.each.tail/11-gnu.mk deleted file mode 100644 index c7cb1cb..0000000 --- a/build-aux/Makefile.each.tail/11-gnu.mk +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 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 . - -# 7.2.6: Standard Targets for Users -# --------------------------------- - -std.gen_files += $(foreach f,$(gnu.info_docs), $f.info ) -std.sys_files += $(foreach f,$(gnu.info_docs), $(infodir)/$f.info ) - -$(foreach d,$(gnu.program_dirs),$(eval $(call _gnu.install_program,$d))) -$(foreach d,$(gnu.data_dirs) ,$(eval $(call _gnu.install_data,$d))) - -#all: std -#install: std -$(outdir)/install-html: $(foreach f,$(gnu.info_docs), $(DESTDIR)$(htmldir)/$f.html ) -$(outdir)/install-dvi : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) -$(outdir)/install-pdf : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) -$(outdir)/install-ps : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(psdir)/$f.ps ) -#uninstall: std -$(outdir)/install-strip: install - $(STRIP) $(filter $(addsuffix /%,$(gnu.program_dirs)),$(std.sys_files/$(@D))) -#clean: std -#distclean: std -#mostlyclean: std -#maintainer-clean: std -TAGS: TODO -$(outdir)/info: $(addsuffix .info,$(gnu.info_docs)) -$(outdir)/dvi : $(addsuffix .dvi ,$(gnu.info_docs)) -$(outdir)/html: $(addsuffix .html,$(gnu.info_docs)) -$(outdir)/pdf : $(addsuffix .pdf ,$(gnu.info_docs)) -$(outdir)/ps : $(addsuffix .ps ,$(gnu.info_docs)) -#dist:dist -check: TODO -installcheck: TODO -#installdirs: std - -$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< -$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< -#installdirs: std diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk new file mode 100644 index 0000000..fe76eb8 --- /dev/null +++ b/build-aux/Makefile.each.tail/11-gnustuff.mk @@ -0,0 +1,59 @@ +# Copyright (C) 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 . + +# 7.2.6: Standard Targets for Users +# --------------------------------- + +std.gen_files += $(foreach f,$(gnustuff.info_docs), $f.info ) +std.sys_files += $(foreach f,$(gnustuff.info_docs), $(infodir)/$f.info ) + +$(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d))) +$(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) + +#all: std +#install: std +$(outdir)/install-html: $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(htmldir)/$f.html ) +$(outdir)/install-dvi : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) +$(outdir)/install-pdf : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) +$(outdir)/install-ps : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(psdir)/$f.ps ) +#uninstall: std +$(outdir)/install-strip: install + $(STRIP) $(filter $(addsuffix /%,$(gnustuff.program_dirs)),$(std.sys_files/$(@D))) +#clean: std +#distclean: std +#mostlyclean: std +#maintainer-clean: std +TAGS: TODO +$(outdir)/info: $(addsuffix .info,$(gnustuff.info_docs)) +$(outdir)/dvi : $(addsuffix .dvi ,$(gnustuff.info_docs)) +$(outdir)/html: $(addsuffix .html,$(gnustuff.info_docs)) +$(outdir)/pdf : $(addsuffix .pdf ,$(gnustuff.info_docs)) +$(outdir)/ps : $(addsuffix .ps ,$(gnustuff.info_docs)) +#dist:dist +check: TODO +installcheck: TODO +#installdirs: std + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< +$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< +#installdirs: std diff --git a/build-aux/Makefile.once.head/11-gnu.mk b/build-aux/Makefile.once.head/11-gnu.mk deleted file mode 100644 index b704a57..0000000 --- a/build-aux/Makefile.once.head/11-gnu.mk +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (C) 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 . - -# 7.2.2: Utilities in Makefiles -# ----------------------------- - -# It's ok to hard-code these commands in rules, but who wants to -# memorize the list of what's ok? -AWK ?= awk -CAT ?= cat -CMP ?= cmp -CP ?= cp -DIFF ?= diff -ECHO ?= echo -EGREP ?= egrep -EXPR ?= expr -FALSE ?= false -GREP ?= grep -INSTALL_INFO ?= install-info -LN ?= ln -LS ?= ls -MKDIR ?= mkdir -MV ?= mv -PRINTF ?= printf -PWD ?= pwd -RM ?= rm -RMDIR ?= rmdir -SED ?= sed -SLEEP ?= sleep -SORT ?= sort -TAR ?= tar -TEST ?= test -TOUCH ?= touch -TR ?= tr -TRUE ?= true - -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- - -INSTALL ?= install -INSTALL_PROGRAM ?= $(INSTALL) -INSTALL_DATA ?= ${INSTALL} -m 644 - -# These aren't specified in the standards, but we use them -STRIP ?= strip -MAKEINFO ?= makeinfo -TEXI2DVI ?= texi2dvi -TEXI2HTML ?= makeinfo --html -TEXI2PDF ?= texi2pdf -TEXI2PS ?= makeinfo --ps -MKDIR_P ?= mkdir -p - -# 7.2.5 Variables for Installation Directories -# -------------------------------------------- - -# Root for the installation -prefix ?= /usr/local -exec_prefix ?= $(prefix) -# Executable programs -bindir ?= $(exec_prefix)/bin -sbindir ?= $(exec_prefix)/sbin -libexecdir ?= $(exec_prefix)/libexec -gnu.program_dirs += $(bindir) $(sbindir) $(libexecdir) -# Data files -datarootdir ?= $(prefix)/share -datadir ?= $(datarootdir) -sysconfdir ?= $(prefix)/etc -sharedstatedir ?= $(prefix)/com -localstatedir ?= $(prefix)/var -runstatedir ?= $(localstatedir)/run -gnu.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) -# Specific types of files -includedir ?= $(prefix)/include -oldincludedir ?= /usr/include -docdir ?= $(datarootdir)/doc/$(PACKAGE) -infodir ?= $(datarootdir)/info -htmldir ?= $(docdir) -dvidir ?= $(docdir) -pdfdir ?= $(docdir) -psdir ?= $(docdir) -libdir ?= $(exec_prefix)/lib -lispdir ?= $(datarootdir)/emacs/site-lisp -localedir ?= $(datarootdir)/locale -gnu.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) - -mandir ?= $(datarootdir)/man -man1dir ?= $(mandir)/man1 -man2dir ?= $(mandir)/man2 -man3dir ?= $(mandir)/man3 -man4dir ?= $(mandir)/man4 -man5dir ?= $(mandir)/man5 -man6dir ?= $(mandir)/man6 -man7dir ?= $(mandir)/man7 -man8dir ?= $(mandir)/man8 -gnu.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) - -manext ?= .1 -man1ext ?= .1 -man2ext ?= .2 -man3ext ?= .3 -man4ext ?= .4 -man5ext ?= .5 -man6ext ?= .6 -man7ext ?= .7 -man8ext ?= .8 - -# srcdir is handled for us by the core - -# Other initialization -gnu.info_docs ?= -std.dirlocal += gnu.info_docs - -define _gnu.install_program -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -endef - -define _gnu.install_data -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -endef - -gnu.dirs += $(gnu.program_dirs) $(gnu.data_dirs) diff --git a/build-aux/Makefile.once.head/11-gnustuff.mk b/build-aux/Makefile.once.head/11-gnustuff.mk new file mode 100644 index 0000000..d91832d --- /dev/null +++ b/build-aux/Makefile.once.head/11-gnustuff.mk @@ -0,0 +1,30 @@ +# Copyright (C) 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 . + +STRIP ?= strip +TEXI2HTML ?= makeinfo --html +TEXI2PDF ?= texi2pdf +TEXI2PS ?= texi2dvi --ps +MKDIR_P ?= mkdir -p + +gnustuff.program_dirs += $(bindir) $(sbindir) $(libexecdir) +gnustuff.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) +gnustuff.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) +gnustuff.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) + +gnustuff.info_docs ?= +std.dirlocal += gnustuff.info_docs + +gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) diff --git a/build-aux/Makefile.once.tail/11-gnu.mk b/build-aux/Makefile.once.tail/11-gnu.mk deleted file mode 100644 index df5f192..0000000 --- a/build-aux/Makefile.once.tail/11-gnu.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 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 . - -$(gnu.dirs): - $(MKDIR_P) $@ diff --git a/build-aux/Makefile.once.tail/11-gnustuff.mk b/build-aux/Makefile.once.tail/11-gnustuff.mk new file mode 100644 index 0000000..df5f192 --- /dev/null +++ b/build-aux/Makefile.once.tail/11-gnustuff.mk @@ -0,0 +1,17 @@ +# Copyright (C) 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 . + +$(gnu.dirs): + $(MKDIR_P) $@ -- cgit v1.2.2 From 081f7d3c73c212ddb239c81ce27940771da593f8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 11:16:48 -0400 Subject: add install rule, add missing at.phony definitions --- build-aux/Makefile.each.tail/11-gnustuff.mk | 3 ++- build-aux/Makefile.once.head/11-gnustuff.mk | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk index fe76eb8..790efad 100644 --- a/build-aux/Makefile.each.tail/11-gnustuff.mk +++ b/build-aux/Makefile.each.tail/11-gnustuff.mk @@ -23,7 +23,8 @@ $(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d) $(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) #all: std -#install: std +install: + $(foreach f,$(gnustuff.info_docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) $(outdir)/install-html: $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(htmldir)/$f.html ) $(outdir)/install-dvi : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) $(outdir)/install-pdf : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) diff --git a/build-aux/Makefile.once.head/11-gnustuff.mk b/build-aux/Makefile.once.head/11-gnustuff.mk index d91832d..800f6d2 100644 --- a/build-aux/Makefile.once.head/11-gnustuff.mk +++ b/build-aux/Makefile.once.head/11-gnustuff.mk @@ -28,3 +28,7 @@ gnustuff.info_docs ?= std.dirlocal += gnustuff.info_docs gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) + +at.phony += install-html install-dvi install-pdf install-ps +at.phony += info html dvi pdf ps +at.phony += install-strip -- cgit v1.2.2 From c8c1b794b51ef20646cb6d30702cb79dee3248ea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 20:26:00 -0400 Subject: Turn the master branch into just a README --- build-aux/Makefile.README.txt | 164 ------------------------------------------ 1 file changed, 164 deletions(-) delete mode 100644 build-aux/Makefile.README.txt (limited to 'build-aux') diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt deleted file mode 100644 index 935af5f..0000000 --- a/build-aux/Makefile.README.txt +++ /dev/null @@ -1,164 +0,0 @@ -Luke's AutoMake -=============== - -Yo, this document is incomplete. It describes the magical -automake.{head,tail}.mk Makefiles and how to use them, kinda. - -I wrote a "clone" of automake. I say clone, because it works -differently. Yeah, I need a new name for it. - -High-level overview -------------------- - -Now, what this does for you is: - -It makes it _easy_ to write non-recursive Makefiles--and ones that are -similar to plain recursive Makefiles, at that! (search for the paper -"Recursive Make Considered Harmful") As harmful as recursive make is, -it's historically been difficult to to write non-recursive Makefiles. -This makes it easy. - -It also makes it easy to follow the GNU standards for your makefiles: -it takes care of this entire table of .PHONY targets for you: - -| this | and this | are aliases for this | -|------+------------------+--------------------------------------------------------| -| all | build | $(outdir)/build | -| | install | $(outdir)/install | -| | uninstall | $(outdir)/uninstall | -| | mostlyclean | $(outdir)/mostlyclean | -| | clean | $(outdir)/clean | -| | distclean | $(outdir)/distclean | -| | maintainer-clean | $(outdir)/maintainer-clean | -| | check | $(outdir)/check (not implemented for you) | -| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | - -(You are still responsible for implementing the `$(outdir)/check` -target in each of your Makefiles.) - -What you have to do is: - -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with - - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/automake.head.mk - - # your makefile - - include $(topsrcdir)/automake.tail.mk - -And in the top-level source directory, Write your own helper makefiles -that get included: - - `common.once.head.mk`: before parsing any of your Makefiles - - `common.each.head.mk`: before parsing each of your Makefiles - - `common.each.tail.mk`: after parsing each of your Makefiles - - `common.each.tail.mk`: after parsing all of your Makefiles - -The `common.*.mk` makefiles are nice for including generic pattern -rules and variables that aren't specific to a directory. - -You're probably thinking that this sounds too good to be true! -Unfortunately, there are two major deviations from writing a plain -recursive Makefile: - - 1. all targets and prerequisites (including .PHONY targets!) need to - be prefixed with - `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. - * sub-gotcha: this means that if a pattern rule has a - prerequisite that may be in srcdir or outdir, then it must be - specified twice, once for each case. - 2. if a prerequisite is in a directory "owned" by another Makefile, - you must filter the pathname through `am_path`: - `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain - a `..` segment; if you need to refer to a sibling directory, do it - relative to `$(topoutdir)` or `$(topsrcdir)`. - -Telling automake about your program ------------------------------------ - -You tell automake what to do for you by setting some variables. They -are all prefixed with `am_`; this prefix may be changed by editing the -`_am` variable at the top of `automake.head.mk`. - -The exception to this is the `am_path` variable, which is a macro that -is used to make a list of filenames relative to the appropriate -directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't -nescessarily equal to `.`. See above. - -There are several commands that generate files; simply record the list -of files that each command generates as the following variable -variables: - -| Variable | Create Command | Delete Command | Description | Relative to | -|--------------+----------------+-----------------------------+-----------------------------------+-------------| -| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | - -In addition, there are two more variables that control not how files -are created, but how they are deleted: - -| Variable | Affected command | Description | Relative to | -|----------------+------------------+------------------------------------------------+-------------| -| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(am_out_files)`. (Example: `*.o`) | | -|----------------+------------------+------------------------------------------------+-------------| -| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | - -Finally, there are two variables that express the relationships -between directories: - -| Variable | Description | -|------------+---------------------------------------------------------| -| am_subdirs | A list of other directories (containing Makefiles) that | -| | may be considered "children" of this | -| | directory/Makefile; building a phony target in this | -| | directory should also build it in the subdirectory. | -| | They are not necesarily actually subdirectories of this | -| | directory in the filesystem. | -|------------+---------------------------------------------------------| -| am_depdirs | A list of other directories (containing Makefiles) that | -| | contain or generate files that are dependencies of | -| | targets in this directory. They are not necesarily | -| | actually subdirectories of this directory in the | -| | filesystem. Except for files that are dependencies of | -| | files in this directory, things in the dependency | -| | directory will not be built. | - -Tips, notes ------------ - -I like to have the first (non-comment) line in a Makefile be: - - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk - -(adjusting the number of `../` sequences as nescessary). Then, my -(user-editable) `config.mk` is of the form: - - ifeq ($(topsrcdir),) - topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - topsrcdir := $(topoutdir) - - # your configuration - - endif - -If the package has a `./configure` script, then I have it modifiy -topsrcdir as necessary, as well as modifying whatever other parts of -the configuration. All of the configuration lives in `config.mk`; -`./configure` doesn't modify any `Makefile`s, it just generates -`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to -`$(outdir)/Makefile`. - ----- -Copyright (C) 2016 Luke Shumaker - -This documentation file is placed into the public domain. If that is -not possible in your legal system, I grant you permission to use it in -absolutely every way that I can legally grant to you. -- cgit v1.2.2 From 28708b49282ed15ac69df4e16a2d6eccc219fa82 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 17 Jun 2016 16:02:13 -0400 Subject: fixup --- build-aux/Makefile.each.tail/10-std.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 5150a71..693f39d 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -12,6 +12,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + # Add some more defaults to the *_files variables std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) @@ -38,7 +39,13 @@ _std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_file _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 +$(addprefix $(outdir)/,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) +# separate uninstall to support GNU Coding Standards' NORMAL_UNINSTALL +$(addprefix $(outdir)/,uninstall): %: %-hook + $(NORMAL_UNINSTALL) $(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) -- cgit v1.2.2 From 8b45c2af3c6f9654d133bfbb62969367a65d38ad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 17 Jun 2016 16:02:51 -0400 Subject: fixup --- build-aux/Makefile.once.head/00-gnuconf.mk | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk index 79ecc34..83cb110 100644 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ b/build-aux/Makefile.once.head/00-gnuconf.mk @@ -16,7 +16,7 @@ # This file is based on ยง7.2 "Makefile Conventions" of the release of # the GNU Coding Standards dated April 13, 2016. -gnuconf.pkgname ?= $(PACKAGE) +gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) ifeq ($(gnuconf.pkgname),) $(error gnuconf.pkgname must be set) endif @@ -64,7 +64,7 @@ CCFLAGS ?= $(CFLAGS) FLEX ?= flex FLEXFLAGS ?= INSTALL ?= install -INSTALLFLAGS ?= +#INSTALLFLAGS ?= LD ?= ld LDFLAGS ?= LDCONFIG ?= ldconfig #TODO @@ -92,14 +92,14 @@ CHMOD ?= chmod CHOWN ?= chown MKNOD ?= mknod -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= ${INSTALL} -m 644 -# 7.2.5 Variables for Installation Directories -# -------------------------------------------- +# 7.2.5: Variables for Installation Directories +# --------------------------------------------- # Root for the installation prefix ?= /usr/local @@ -147,3 +147,14 @@ man5ext ?= .5 man6ext ?= .6 man7ext ?= .7 man8ext ?= .8 + +# 7.2.7: Install Command Categories +# --------------------------------- + +PRE_INSTALL ?= +POST_INSTALL ?= +NORMAL_INSTALL ?= + +PRE_UNINSTALL ?= +POST_UNINSTALL ?= +NORMAL_UNINSTALL ?= -- cgit v1.2.2