aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/deps.mk36
-rw-r--r--core/erlc.mk9
-rw-r--r--doc/src/guide/app.asciidoc7
-rw-r--r--index/couch.mk7
-rw-r--r--index/jamdb_sybase.mk7
-rw-r--r--index/octopus.mk7
-rw-r--r--index/opencouch.mk7
-rw-r--r--plugins/bootstrap.mk2
-rw-r--r--plugins/c_src.mk2
-rw-r--r--plugins/erlydtl.mk4
-rw-r--r--test/Makefile2
-rw-r--r--test/core_app.mk48
-rw-r--r--test/core_deps.mk7
13 files changed, 111 insertions, 34 deletions
diff --git a/core/deps.mk b/core/deps.mk
index c70e751..7d991b0 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -21,8 +21,13 @@ export DEPS_DIR
REBAR_DEPS_DIR = $(DEPS_DIR)
export REBAR_DEPS_DIR
+dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name))
+dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
+ $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
+dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
+
ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d)))
-ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)))
+ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(foreach dep,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)),$(call dep_name,$(dep))))
ifeq ($(filter $(APPS_DIR) $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
ifeq ($(ERL_LIBS),)
@@ -546,26 +551,23 @@ define dep_fetch
fail))
endef
-dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name))
-dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
- $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
-dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
-
define dep_target
-$(DEPS_DIR)/$(1):
- $(verbose) if test -d $(APPS_DIR)/$1; then \
- echo "Error: Dependency $1 conflicts with application found in $(APPS_DIR)/$1."; \
+$(DEPS_DIR)/$(call dep_name,$1):
+ $(eval DEP_NAME := $(call dep_name,$1))
+ $(eval DEP_STR := $(if $(filter-out $1,$(DEP_NAME)),$1,"$1 ($(DEP_NAME))"))
+ $(verbose) if test -d $(APPS_DIR)/$(DEP_NAME); then \
+ echo "Error: Dependency" $(DEP_STR) "conflicts with application found in $(APPS_DIR)/$(DEP_NAME)."; \
exit 17; \
fi
$(verbose) mkdir -p $(DEPS_DIR)
- $(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$(1))),$(1))
- $(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
- echo " AUTO " $(1); \
- cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \
+ $(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$1)),$1)
+ $(verbose) if [ -f $(DEPS_DIR)/$(DEP_NAME)/configure.ac -o -f $(DEPS_DIR)/$(DEP_NAME)/configure.in ]; then \
+ echo " AUTO " $(DEP_STR); \
+ cd $(DEPS_DIR)/$(DEP_NAME) && autoreconf -Wall -vif -I m4; \
fi
- - $(verbose) if [ -f $(DEPS_DIR)/$(1)/configure ]; then \
- echo " CONF " $(1); \
- cd $(DEPS_DIR)/$(1) && ./configure; \
+ - $(verbose) if [ -f $(DEPS_DIR)/$(DEP_NAME)/configure ]; then \
+ echo " CONF " $(DEP_STR); \
+ cd $(DEPS_DIR)/$(DEP_NAME) && ./configure; \
fi
ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
$(verbose) if [ "$(1)" = "amqp_client" -a "$(RABBITMQ_CLIENT_PATCH)" ]; then \
@@ -584,7 +586,7 @@ ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
git clone https://github.com/rabbitmq/rabbitmq-codegen.git $(DEPS_DIR)/rabbitmq-codegen; \
fi \
else \
- $(call dep_autopatch,$(1)) \
+ $(call dep_autopatch,$(DEP_NAME)) \
fi
endif
endef
diff --git a/core/erlc.mk b/core/erlc.mk
index a8ab8fe..02524b4 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -183,6 +183,10 @@ $(PROJECT).d:: $(ERL_FILES) $(call core_find,include/,*.hrl)
$(makedep_verbose) $(call erlang,$(call makedep.erl,$@))
endif
+# Rebuild everything when the Makefile changes.
+$(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):: $(MAKEFILE_LIST)
+ @touch $@
+
-include $(PROJECT).d
ebin/$(PROJECT).app:: ebin/
@@ -195,8 +199,9 @@ define compile_erl
-pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),$(COMPILE_FIRST_PATHS) $(1))
endef
-ebin/$(PROJECT).app:: $(ERL_FILES) $(CORE_FILES)
- $(if $(strip $?),$(call compile_erl,$?))
+ebin/$(PROJECT).app:: $(ERL_FILES) $(CORE_FILES) $(wildcard src/$(PROJECT).app.src)
+ $(eval FILES_TO_COMPILE := $(filter-out src/$(PROJECT).app.src,$?))
+ $(if $(strip $(FILES_TO_COMPILE)),$(call compile_erl,$(FILES_TO_COMPILE)))
$(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true))
$(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename \
$(filter-out $(ERLC_EXCLUDE_PATHS),$(ERL_FILES) $(CORE_FILES) $(BEAM_FILES)))))))
diff --git a/doc/src/guide/app.asciidoc b/doc/src/guide/app.asciidoc
index 5c097f6..1320577 100644
--- a/doc/src/guide/app.asciidoc
+++ b/doc/src/guide/app.asciidoc
@@ -123,9 +123,10 @@ your situation.
Current version of the project.
`PROJECT_REGISTERED`::
List of the names of all registered processes.
-`OTP_DEPS`::
+`LOCAL_DEPS`::
List of Erlang/OTP applications this project depends on,
- excluding `erts`, `kernel` and `stdlib`.
+ excluding `erts`, `kernel` and `stdlib`, or list of
+ dependencies local to this repository (in `APPS_DIR`).
`DEPS`::
List of applications this project depends on that need
to be fetched by Erlang.mk.
@@ -140,7 +141,7 @@ PROJECT_DESCRIPTION = Small, fast, modular HTTP server.
PROJECT_VERSION = 2.0.0-pre.2
PROJECT_REGISTERED = cowboy_clock
-OTP_DEPS = crypto
+LOCAL_DEPS = crypto
DEPS = cowlib ranch
----
diff --git a/index/couch.mk b/index/couch.mk
deleted file mode 100644
index e1993cb..0000000
--- a/index/couch.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-PACKAGES += couch
-pkg_couch_name = couch
-pkg_couch_description = A embeddable document oriented database compatible with Apache CouchDB
-pkg_couch_homepage = https://github.com/benoitc/opencouch
-pkg_couch_fetch = git
-pkg_couch_repo = https://github.com/benoitc/opencouch
-pkg_couch_commit = master
diff --git a/index/jamdb_sybase.mk b/index/jamdb_sybase.mk
new file mode 100644
index 0000000..727d896
--- /dev/null
+++ b/index/jamdb_sybase.mk
@@ -0,0 +1,7 @@
+PACKAGES += jamdb_sybase
+pkg_jamdb_sybase_name = jamdb_sybase
+pkg_jamdb_sybase_description = Erlang driver for SAP Sybase ASE
+pkg_jamdb_sybase_homepage = https://github.com/erlangbureau/jamdb_sybase
+pkg_jamdb_sybase_fetch = git
+pkg_jamdb_sybase_repo = https://github.com/erlangbureau/jamdb_sybase
+pkg_jamdb_sybase_commit = 0.6.0
diff --git a/index/octopus.mk b/index/octopus.mk
new file mode 100644
index 0000000..cb644ec
--- /dev/null
+++ b/index/octopus.mk
@@ -0,0 +1,7 @@
+PACKAGES += octopus
+pkg_octopus_name = octopus
+pkg_octopus_description = Small and flexible pool manager written in Erlang
+pkg_octopus_homepage = https://github.com/erlangbureau/octopus
+pkg_octopus_fetch = git
+pkg_octopus_repo = https://github.com/erlangbureau/octopus
+pkg_octopus_commit = 1.0.0
diff --git a/index/opencouch.mk b/index/opencouch.mk
new file mode 100644
index 0000000..6bbc27f
--- /dev/null
+++ b/index/opencouch.mk
@@ -0,0 +1,7 @@
+PACKAGES += opencouch
+pkg_opencouch_name = couch
+pkg_opencouch_description = A embeddable document oriented database compatible with Apache CouchDB
+pkg_opencouch_homepage = https://github.com/benoitc/opencouch
+pkg_opencouch_fetch = git
+pkg_opencouch_repo = https://github.com/benoitc/opencouch
+pkg_opencouch_commit = master
diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk
index 019e697..dbd115f 100644
--- a/plugins/bootstrap.mk
+++ b/plugins/bootstrap.mk
@@ -429,7 +429,7 @@ ifdef LEGACY
endif
new:
-ifeq ($(wildcard src/),)
+ifeq ($(wildcard src/)$(in),)
$(error Error: src/ directory does not exist)
endif
ifndef t
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index efe7bfe..a74d945 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -60,7 +60,7 @@ clean::
else
ifeq ($(SOURCES),)
-SOURCES := $(sort $(call core_find,$(C_SRC_DIR)/,*.c *.C *.cc *.cpp))
+SOURCES := $(sort $(foreach pat,*.c *.C *.cc *.cpp,$(call core_find,$(C_SRC_DIR)/,$(pat))))
endif
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
diff --git a/plugins/erlydtl.mk b/plugins/erlydtl.mk
index dea6366..072da50 100644
--- a/plugins/erlydtl.mk
+++ b/plugins/erlydtl.mk
@@ -42,6 +42,10 @@ else
BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(notdir $(DTL_FILES))))
endif
+# Rebuild templates when the Makefile changes.
+$(DTL_FILES): $(MAKEFILE_LIST)
+ @touch $@
+
ebin/$(PROJECT).app:: $(DTL_FILES)
$(if $(strip $?),\
$(dtl_verbose) $(call erlang,$(call erlydtl_compile.erl,$?,-pa ebin/ $(DEPS_DIR)/erlydtl/ebin/)))
diff --git a/test/Makefile b/test/Makefile
index dc11ccd..04b31af 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -192,7 +192,7 @@ pkg-$1: clean build
$(eval @ = pkg-$1)
# Get the real application's name.
- $(eval APP_NAME = `sed '2!d;s/pkg_$1_name = //' ../index/$1.mk`)
+ $(eval APP_NAME := $(shell sed '2!d;s/pkg_$1_name = //' ../index/$1.mk))
$i "Bootstrap a new OTP library in packages/$1_pkg"
$t mkdir -p packages/$1_pkg/
diff --git a/test/core_app.mk b/test/core_app.mk
index f95d593..14720df 100644
--- a/test/core_app.mk
+++ b/test/core_app.mk
@@ -1,6 +1,6 @@
# Core: Building applications.
-CORE_APP_CASES = asn1 auto-git-id erlc-exclude erlc-opts erlc-opts-filter error generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive mib no-app no-makedep pt pt-erlc-opts xrl xrl-include yrl yrl-include
+CORE_APP_CASES = appsrc-change asn1 auto-git-id erlc-exclude erlc-opts erlc-opts-filter error generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive makefile-change mib no-app no-makedep pt pt-erlc-opts xrl xrl-include yrl yrl-include
CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES))
CORE_APP_CLEAN_TARGETS = $(addprefix clean-,$(CORE_APP_TARGETS))
@@ -13,6 +13,27 @@ $(CORE_APP_CLEAN_TARGETS):
core-app: $(CORE_APP_TARGETS)
+ifdef LEGACY
+core-app-appsrc-change: build clean-core-app-appsrc-change
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Touch the .app.src file; check that only the .app file gets rebuilt"
+ $t printf "%s\n" $(APP)/ebin/$(APP).app > $(APP)/EXPECT
+ $t $(SLEEP)
+ $t touch $(APP)/src/$(APP).app.src
+ $t $(SLEEP)
+ $t $(MAKE) -C $(APP) $v
+ $t find $(APP) -type f -newer $(APP)/src/$(APP).app.src | sort | diff $(APP)/EXPECT -
+ $t rm $(APP)/EXPECT
+endif
+
core-app-asn1: build clean-core-app-asn1
$i "Bootstrap a new OTP library named $(APP)"
@@ -738,6 +759,31 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
+core-app-makefile-change: build clean-core-app-makefile-change
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Touch the Makefile; check that all files get rebuilt"
+ $t printf "%s\n" \
+ $(APP)/$(APP).d \
+ $(APP)/ebin/$(APP).app \
+ $(APP)/ebin/$(APP)_app.beam \
+ $(APP)/ebin/$(APP)_sup.beam \
+ $(APP)/src/$(APP)_app.erl \
+ $(APP)/src/$(APP)_sup.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
+ $t touch $(APP)/Makefile
+ $t $(SLEEP)
+ $t $(MAKE) -C $(APP) $v
+ $t find $(APP) -type f -newer $(APP)/Makefile | sort | diff $(APP)/EXPECT -
+ $t rm $(APP)/EXPECT
+
core-app-mib: build clean-core-app-mib
$i "Bootstrap a new OTP library named $(APP)"
diff --git a/test/core_deps.mk b/test/core_deps.mk
index aef7adb..e2e5be7 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -342,6 +342,9 @@ core-deps-apps-only: build clean-core-deps-apps-only
$i "Create a new application my_app"
$t $(MAKE) -C $(APP) new-app in=my_app $v
+ $i "Create a module my_server from gen_server template in my_app"
+ $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
+
$i "Add Cowlib to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
@@ -353,12 +356,13 @@ core-deps-apps-only: build clean-core-deps-apps-only
$t test -f $(APP)/apps/my_app/ebin/my_app.app
$t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
$t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_server.beam
$t test -d $(APP)/deps/cowlib/
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
ok = application:load(my_app), \
- {ok, Mods = [my_app_app, my_app_sup]} = application:get_key(my_app, modules), \
+ {ok, Mods = [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
@@ -373,6 +377,7 @@ core-deps-apps-only: build clean-core-deps-apps-only
$t test ! -e $(APP)/apps/my_app/ebin/my_app.app
$t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
$t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
+ $t test ! -e $(APP)/apps/my_app/ebin/my_server.beam
$i "Distclean the application"
$t $(MAKE) -C $(APP) distclean $v