plugin_shell.mk 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Shell plugin.
  2. SHELL_TARGETS = $(call list_targets,shell)
  3. .PHONY: shell $(C_SRC_TARGETS)
  4. shell: $(SHELL_TARGETS)
  5. shell-compile: init
  6. $i "Bootstrap a new OTP application named $(APP)"
  7. $t mkdir $(APP)/
  8. $t cp ../erlang.mk $(APP)/
  9. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  10. $i "Ensure our application is recompiled before the shell runs"
  11. $t perl -ni.bak -e 'print;if ($$.==1) {print "shell:: app\n"}' $(APP)/Makefile
  12. $i "Run the shell"
  13. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
  14. $i "Check that all compiled files exist"
  15. $t test -f $(APP)/$(APP).d
  16. $t test -f $(APP)/ebin/$(APP).app
  17. $t test -f $(APP)/ebin/$(APP)_app.beam
  18. $t test -f $(APP)/ebin/$(APP)_sup.beam
  19. shell-default: init
  20. $i "Bootstrap a new OTP library named $(APP)"
  21. $t mkdir $(APP)/
  22. $t cp ../erlang.mk $(APP)/
  23. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  24. $i "Run the shell"
  25. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
  26. #shell-kjell: init
  27. #
  28. # $i "Bootstrap a new OTP library named $(APP)"
  29. # $t mkdir $(APP)/
  30. # $t cp ../erlang.mk $(APP)/
  31. # $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  32. #
  33. # $i "Add Kjell to the list of shell dependencies and set as default shell"
  34. # $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = kjell\nSHELL_ERL = \$$(DEPS_DIR)/kjell/bin/kjell\n"}' $(APP)/Makefile
  35. #
  36. # $i "Run the shell"
  37. # $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
  38. shell-test-dir: init
  39. $i "Bootstrap a new OTP library named $(APP)"
  40. $t mkdir $(APP)/
  41. $t cp ../erlang.mk $(APP)/
  42. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  43. $i "Generate a module in TEST_DIR"
  44. $t mkdir $(APP)/test
  45. $t printf "%s\n" \
  46. "-module(foo)." > $(APP)/test/foo.erl
  47. $i "Build the test files"
  48. $t $(MAKE) -C $(APP) test-build $v
  49. $i "Check that the module is visible"
  50. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'foo:module_info()' -eval 'halt()'" $v