aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/asciidoc.mk8
-rw-r--r--plugins/bootstrap.mk9
-rw-r--r--plugins/c_src.mk1
-rw-r--r--plugins/ct.mk16
-rw-r--r--plugins/edoc.mk6
-rw-r--r--plugins/escript.mk4
-rw-r--r--plugins/eunit.mk5
7 files changed, 33 insertions, 16 deletions
diff --git a/plugins/asciidoc.mk b/plugins/asciidoc.mk
index baf4d3b..ab7fa4b 100644
--- a/plugins/asciidoc.mk
+++ b/plugins/asciidoc.mk
@@ -8,12 +8,12 @@ MAN_SECTIONS ?= 3 7
docs:: asciidoc
-asciidoc: distclean-asciidoc doc-deps asciidoc-guide asciidoc-manual
+asciidoc: asciidoc-guide asciidoc-manual
ifeq ($(wildcard doc/src/guide/book.asciidoc),)
asciidoc-guide:
else
-asciidoc-guide:
+asciidoc-guide: distclean-asciidoc doc-deps
a2x -v -f pdf doc/src/guide/book.asciidoc && mv doc/src/guide/book.pdf doc/guide.pdf
a2x -v -f chunked doc/src/guide/book.asciidoc && mv doc/src/guide/book.chunked/ doc/html/
endif
@@ -21,7 +21,7 @@ endif
ifeq ($(wildcard doc/src/manual/*.asciidoc),)
asciidoc-manual:
else
-asciidoc-manual:
+asciidoc-manual: distclean-asciidoc doc-deps
for f in doc/src/manual/*.asciidoc ; do \
a2x -v -f manpage $$f ; \
done
@@ -36,7 +36,7 @@ install-docs:: install-asciidoc
install-asciidoc: asciidoc-manual
for s in $(MAN_SECTIONS); do \
mkdir -p $(MAN_INSTALL_PATH)/man$$s/ ; \
- install -g 0 -o 0 -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \
+ install -g `id -u` -o `id -g` -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \
done
endif
diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk
index 4aa1052..d608d28 100644
--- a/plugins/bootstrap.mk
+++ b/plugins/bootstrap.mk
@@ -11,8 +11,8 @@ help::
" bootstrap Generate a skeleton of an OTP application" \
" bootstrap-lib Generate a skeleton of an OTP library" \
" bootstrap-rel Generate the files needed to build a release" \
- " new-app n=NAME Create a new local OTP application NAME" \
- " new-lib n=NAME Create a new local OTP library NAME" \
+ " new-app in=NAME Create a new local OTP application NAME" \
+ " new-lib in=NAME Create a new local OTP library NAME" \
" new t=TPL n=NAME Generate a module NAME based on the template TPL" \
" new t=T n=N in=APP Generate a module NAME based on the template TPL in APP" \
" list-templates List available templates"
@@ -172,6 +172,11 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
endef
+define tpl_module
+-module($(n)).
+-export([]).
+endef
+
define tpl_cowboy_http
-module($(n)).
-behaviour(cowboy_http_handler).
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index 87fd32f..518ba9e 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -30,6 +30,7 @@ ifeq ($(PLATFORM),msys2)
# We hardcode the compiler used on MSYS2. The default CC=cc does
# not produce working code. The "gcc" MSYS2 package also doesn't.
CC = /mingw64/bin/gcc
+ export CC
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -finline-functions -Wall
else ifeq ($(PLATFORM),darwin)
diff --git a/plugins/ct.mk b/plugins/ct.mk
index 2d45032..4d0c020 100644
--- a/plugins/ct.mk
+++ b/plugins/ct.mk
@@ -31,7 +31,7 @@ help::
CT_RUN = ct_run \
-no_auto_compile \
-noinput \
- -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(TEST_DIR) \
+ -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(APPS_DIR)/*/ebin $(TEST_DIR) \
-dir $(TEST_DIR) \
-logdir $(CURDIR)/logs
@@ -40,12 +40,18 @@ ct: $(if $(IS_APP),,apps-ct)
else
ct: test-build $(if $(IS_APP),,apps-ct)
$(verbose) mkdir -p $(CURDIR)/logs/
- $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
+ $(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
endif
ifneq ($(ALL_APPS_DIRS),)
-apps-ct:
- $(verbose) for app in $(ALL_APPS_DIRS); do $(MAKE) -C $$app ct IS_APP=1; done
+define ct_app_target
+apps-ct-$1:
+ $(MAKE) -C $1 ct IS_APP=1
+endef
+
+$(foreach app,$(ALL_APPS_DIRS),$(eval $(call ct_app_target,$(app))))
+
+apps-ct: test-build $(addprefix apps-ct-,$(ALL_APPS_DIRS))
endif
ifndef t
@@ -62,7 +68,7 @@ endif
define ct_suite_target
ct-$(1): test-build
$(verbose) mkdir -p $(CURDIR)/logs/
- $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS)
+ $(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS)
endef
$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test))))
diff --git a/plugins/edoc.mk b/plugins/edoc.mk
index 6f0a82d..7b4331b 100644
--- a/plugins/edoc.mk
+++ b/plugins/edoc.mk
@@ -9,13 +9,15 @@ EDOC_OPTS ?=
# Core targets.
-docs:: distclean-edoc edoc
+ifneq ($(wildcard doc/overview.edoc),)
+docs:: edoc
+endif
distclean:: distclean-edoc
# Plugin-specific targets.
-edoc: doc-deps
+edoc: distclean-edoc doc-deps
$(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
distclean-edoc:
diff --git a/plugins/escript.mk b/plugins/escript.mk
index 42133eb..16f8ba6 100644
--- a/plugins/escript.mk
+++ b/plugins/escript.mk
@@ -6,6 +6,8 @@
# Configuration.
ESCRIPT_NAME ?= $(PROJECT)
+ESCRIPT_FILE ?= $(ESCRIPT_NAME)
+
ESCRIPT_COMMENT ?= This is an -*- erlang -*- file
ESCRIPT_BEAMS ?= "ebin/*", "deps/*/ebin/*"
@@ -51,7 +53,7 @@ define ESCRIPT_RAW
' ]),'\
' file:change_mode(Escript, 8#755)'\
'end,'\
-'Ez("$(ESCRIPT_NAME)"),'\
+'Ez("$(ESCRIPT_FILE)"),'\
'halt().'
endef
diff --git a/plugins/eunit.mk b/plugins/eunit.mk
index f6afa34..a2e22ff 100644
--- a/plugins/eunit.mk
+++ b/plugins/eunit.mk
@@ -52,8 +52,9 @@ eunit: test-build
$(gen_verbose) $(call erlang,$(call eunit.erl,fun $(t)/0),$(EUNIT_ERL_OPTS))
endif
else
-EUNIT_EBIN_MODS = $(notdir $(basename $(call core_find,ebin/,*.beam)))
-EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.beam)))
+EUNIT_EBIN_MODS = $(notdir $(basename $(ERL_FILES) $(BEAM_FILES)))
+EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.erl)))
+
EUNIT_MODS = $(foreach mod,$(EUNIT_EBIN_MODS) $(filter-out \
$(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(EUNIT_TEST_MODS)),'$(mod)')