Browse Source

Ensure apps have APPS_DIR and DEPS_DIR defined

So they can use include files and other from other apps
when they're built directly, and that they use the same
deps directory.
Loïc Hoguin 6 years ago
parent
commit
30ac929bf7
2 changed files with 21 additions and 1 deletions
  1. 6 1
      plugins/bootstrap.mk
  2. 15 0
      test/core_deps.mk

+ 6 - 1
plugins/bootstrap.mk

@@ -75,7 +75,12 @@ PROJECT = $p
 PROJECT_DESCRIPTION = New project
 PROJECT_DESCRIPTION = New project
 PROJECT_VERSION = 0.1.0
 PROJECT_VERSION = 0.1.0
 
 
-include $(call core_relpath,$(dir $(ERLANG_MK_FILENAME)),$(APPS_DIR)/app)/erlang.mk
+# Make sure we know where the applications are located.
+ROOT_DIR := $(call core_relpath,$(dir $(ERLANG_MK_FILENAME)),$(APPS_DIR)/app)
+APPS_DIR := ..
+DEPS_DIR := $(call core_relpath,$(DEPS_DIR),$(APPS_DIR)/app)
+
+include $$(ROOT_DIR)/erlang.mk
 endef
 endef
 
 
 define bs_app
 define bs_app

+ 15 - 0
test/core_deps.mk

@@ -297,6 +297,21 @@ core-deps-apps-dir-include-lib: build clean
 	$i "Distclean the application"
 	$i "Distclean the application"
 	$t $(MAKE) -C $(APP) distclean $v
 	$t $(MAKE) -C $(APP) distclean $v
 
 
+	$i "Build in a subdirectory"
+	$t $(MAKE) -C $(APP)/deep/libs/boy_app $v
+
+	$i "Check that all compiled files exist (excluding the top-level app)"
+	$t ! test -f $(APP)/$(APP).d
+	$t ! test -f $(APP)/ebin/$(APP).app
+
+	$t test -f $(APP)/deep/libs/boy_app/boy_app.d
+	$t test -f $(APP)/deep/libs/boy_app/ebin/boy_app.app
+	$t test -f $(APP)/deep/libs/boy_app/ebin/boy.beam
+
+	$t test -f $(APP)/deep/libs/girl_app/girl_app.d
+	$t test -f $(APP)/deep/libs/girl_app/ebin/girl_app.app
+	$t test -f $(APP)/deep/libs/girl_app/ebin/girl.beam
+
 core-deps-apps-new-app: build clean
 core-deps-apps-new-app: build clean
 
 
 	$i "Bootstrap a new OTP library named $(APP)"
 	$i "Bootstrap a new OTP library named $(APP)"