aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenoitc <[email protected]>2016-04-03 23:46:20 +0200
committerLoïc Hoguin <[email protected]>2017-05-15 19:10:46 +0200
commit9292409f21393ec539cdf40720d26b43914f6018 (patch)
treedcac806b43259fed1067098c162ce77087bd55c6
parent724521b68c19f107437db9fa2ee8def6ff604e0a (diff)
downloaderlang.mk-9292409f21393ec539cdf40720d26b43914f6018.tar.gz
erlang.mk-9292409f21393ec539cdf40720d26b43914f6018.tar.bz2
erlang.mk-9292409f21393ec539cdf40720d26b43914f6018.zip
Add WITHOUT variable to exclude components on build
This allows to ignore lines from the default build.config if needed. For example to not include packages run make WITHOUT=index
-rw-r--r--Makefile11
-rw-r--r--core/core.mk8
-rw-r--r--doc/src/guide/getting_started.asciidoc11
-rw-r--r--doc/src/guide/updating.asciidoc7
4 files changed, 35 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 7c8d54b..6d6ff23 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,16 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+WITHOUT ?=
+
BUILD_CONFIG_FILE ?= $(CURDIR)/build.config
+ifeq ($(WITHOUT),)
BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE))
+else
+empty := $(subst ,, )
+BUILD_EXCLUDE = "^$(subst $(empty),\|^,$(WITHOUT))"
+BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE)|grep -v $(BUILD_EXCLUDE))
+endif
ERLANG_MK = erlang.mk
ERLANG_MK_VERSION = $(shell git describe --tags --dirty)
@@ -23,7 +31,8 @@ ERLANG_MK_VERSION = $(shell git describe --tags --dirty)
all:
export LC_COLLATE=C; \
awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \
- | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' > $(ERLANG_MK)
+ | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' \
+ | sed 's:^ERLANG_MK_WITHOUT = .*:ERLANG_MK_WITHOUT = $(WITHOUT):' > $(ERLANG_MK)
ifdef p
# Remove p from the list of variables since that conflicts with bootstrapping.
diff --git a/core/core.mk b/core/core.mk
index 278e20f..89cfa25 100644
--- a/core/core.mk
+++ b/core/core.mk
@@ -29,6 +29,9 @@ ifeq ($(MAKE_VERSION),3.82)
$(warning Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html)
endif
+# Ignored plugins
+ERLANG_MK_WITHOUT = ""
+
# Core configuration.
PROJECT ?= $(notdir $(CURDIR))
@@ -184,13 +187,16 @@ ERLANG_MK_COMMIT ?=
ERLANG_MK_BUILD_CONFIG ?= build.config
ERLANG_MK_BUILD_DIR ?= .erlang.mk.build
+WITHOUT ?= $(ERLANG_MK_WITHOUT)
+WITHOUT := $(strip $(WITHOUT))
+
erlang-mk:
git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR)
ifdef ERLANG_MK_COMMIT
cd $(ERLANG_MK_BUILD_DIR) && git checkout $(ERLANG_MK_COMMIT)
endif
if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR)/build.config; fi
- $(MAKE) -C $(ERLANG_MK_BUILD_DIR)
+ $(MAKE) -C $(ERLANG_MK_BUILD_DIR) WITHOUT='$(WITHOUT)'
cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk
rm -rf $(ERLANG_MK_BUILD_DIR)
diff --git a/doc/src/guide/getting_started.asciidoc b/doc/src/guide/getting_started.asciidoc
index ca1391d..5d7d804 100644
--- a/doc/src/guide/getting_started.asciidoc
+++ b/doc/src/guide/getting_started.asciidoc
@@ -78,6 +78,17 @@ to bootstrap. This operation is done only once. Consult the
xref:updating[Updating Erlang.mk] chapter for more
information.
+[NOTE]
+----
+By default the file contains a package index. To filter it, run the command
+above with the `WITHOUT=index` argument.
+
+[source,bash]
+$ make -f erlang.mk bootstrap WITHOUT=index
+
+This command will generate the file without the index.
+----
+
Of course, the generated project can now be compiled:
[source,bash]
diff --git a/doc/src/guide/updating.asciidoc b/doc/src/guide/updating.asciidoc
index 61d913d..3c72749 100644
--- a/doc/src/guide/updating.asciidoc
+++ b/doc/src/guide/updating.asciidoc
@@ -61,3 +61,10 @@ You can also name the file differently or put it in a separate folder
by modifying the value for `ERLANG_MK_BUILD_CONFIG`. You can also
tell Erlang.mk to use a different temporary directory by changing
the `ERLANG_MK_BUILD_DIR` variable.
+
+Alternatively you can filter out a plugin in the build config by using the
+`WITHOUT` variable the first time you generate the file. For example this
+commande will filter the index plugin:
+
+[source,bash]
+$ make -f erlang.mk WITHOUT=index