Browse Source

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
benoitc 9 years ago
parent
commit
9292409f21
4 changed files with 35 additions and 2 deletions
  1. 10 1
      Makefile
  2. 7 1
      core/core.mk
  3. 11 0
      doc/src/guide/getting_started.asciidoc
  4. 7 0
      doc/src/guide/updating.asciidoc

+ 10 - 1
Makefile

@@ -12,8 +12,16 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 
+WITHOUT ?=
+
 BUILD_CONFIG_FILE ?= $(CURDIR)/build.config
 BUILD_CONFIG_FILE ?= $(CURDIR)/build.config
+ifeq ($(WITHOUT),)
 BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE))
 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 = erlang.mk
 ERLANG_MK_VERSION = $(shell git describe --tags --dirty)
 ERLANG_MK_VERSION = $(shell git describe --tags --dirty)
@@ -23,7 +31,8 @@ ERLANG_MK_VERSION = $(shell git describe --tags --dirty)
 all:
 all:
 	export LC_COLLATE=C; \
 	export LC_COLLATE=C; \
 	awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \
 	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
 ifdef p
 # Remove p from the list of variables since that conflicts with bootstrapping.
 # Remove p from the list of variables since that conflicts with bootstrapping.

+ 7 - 1
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)
 $(warning Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html)
 endif
 endif
 
 
+# Ignored plugins
+ERLANG_MK_WITHOUT = ""
+
 # Core configuration.
 # Core configuration.
 
 
 PROJECT ?= $(notdir $(CURDIR))
 PROJECT ?= $(notdir $(CURDIR))
@@ -184,13 +187,16 @@ ERLANG_MK_COMMIT ?=
 ERLANG_MK_BUILD_CONFIG ?= build.config
 ERLANG_MK_BUILD_CONFIG ?= build.config
 ERLANG_MK_BUILD_DIR ?= .erlang.mk.build
 ERLANG_MK_BUILD_DIR ?= .erlang.mk.build
 
 
+WITHOUT ?= $(ERLANG_MK_WITHOUT)
+WITHOUT := $(strip $(WITHOUT))
+
 erlang-mk:
 erlang-mk:
 	git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR)
 	git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR)
 ifdef ERLANG_MK_COMMIT
 ifdef ERLANG_MK_COMMIT
 	cd $(ERLANG_MK_BUILD_DIR) && git checkout $(ERLANG_MK_COMMIT)
 	cd $(ERLANG_MK_BUILD_DIR) && git checkout $(ERLANG_MK_COMMIT)
 endif
 endif
 	if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR)/build.config; fi
 	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
 	cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk
 	rm -rf $(ERLANG_MK_BUILD_DIR)
 	rm -rf $(ERLANG_MK_BUILD_DIR)
 
 

+ 11 - 0
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
 xref:updating[Updating Erlang.mk] chapter for more
 information.
 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:
 Of course, the generated project can now be compiled:
 
 
 [source,bash]
 [source,bash]

+ 7 - 0
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
 by modifying the value for `ERLANG_MK_BUILD_CONFIG`. You can also
 tell Erlang.mk to use a different temporary directory by changing
 tell Erlang.mk to use a different temporary directory by changing
 the `ERLANG_MK_BUILD_DIR` variable.
 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