summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-03-04 13:22:40 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-03-04 13:22:40 -0500
commited29df6355d6b1871aa60fec63c929ffe81fe62d (patch)
treee48c4a83f675ec13f4cfb0242fa4a3da36524661
parentd06e79cb18849df48e3e2b431c8b5fe6a32d3b6c (diff)
parent37ef1295bf8885876df8de989569a2233f97583f (diff)
Merge remote-tracking branch 'automake/master'
-rw-r--r--automake.head.mk11
-rw-r--r--automake.txt40
-rw-r--r--config.mk.in3
3 files changed, 29 insertions, 25 deletions
diff --git a/automake.head.mk b/automake.head.mk
index c79da83..37d3b07 100644
--- a/automake.head.mk
+++ b/automake.head.mk
@@ -30,13 +30,10 @@ am_path = $(foreach p,$1,$(call _am_relto,$p))
all: build
.PHONY: all
-## Set topoutdir, outdir, and srcdir (assumes that topsrcdir is
-## already set, and that $(topoutdir)/config.mk has been included)
-ifeq ($(topoutdir),)
-topoutdir := $(call _am_path,$(dir $(lastword $(filter %/config.mk config.mk,$(MAKEFILE_LIST)))))
-endif
- outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
- srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)))
+## Set outdir and srcdir (assumes that topoutdir and topsrcdir are
+## already set)
+outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
+srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)))
_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile)
diff --git a/automake.txt b/automake.txt
index c9834d3..935af5f 100644
--- a/automake.txt
+++ b/automake.txt
@@ -41,25 +41,14 @@ 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
- # adjust the number of `../` segments as appropriate
- include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+ topoutdir ?= ...
+ topsrcdir ?= ...
include $(topsrcdir)/automake.head.mk
# your makefile
include $(topsrcdir)/automake.tail.mk
-And in the top-level output directory, you write a `config.mk` with:
-
- ifeq ($(topsrcdir),)
- # have your ./configure script adjust topsrcdir if doing an
- # out-of-tree build
- topsrcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
-
- # your configuration
-
- endif
-
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
@@ -145,10 +134,27 @@ between directories:
Tips, notes
-----------
-If you have a `./configure` script, don't have it modify the
-`Makefile`s; have everything you need modified be in
-`$(topoutdir)/config.mk` and have it generate that; then have it copy
-(or (sym?)link?) every `$(srcdir)/Makefile` into `$(outdir)/Makefile`.
+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
diff --git a/config.mk.in b/config.mk.in
index ca8fa7f..0a8d70c 100644
--- a/config.mk.in
+++ b/config.mk.in
@@ -1,5 +1,6 @@
ifeq ($(topsrcdir),)
-topsrcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+topsrcdir := $(topoutdir)
PACKAGE = rvs
VERSION = 0.10