core_makedep.mk 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Core: COMPILE_FIRST dependencies generation.
  2. CORE_MAKEDEP_CASES = behavior import
  3. CORE_MAKEDEP_TARGETS = $(addprefix core-makedep-,$(CORE_MAKEDEP_CASES))
  4. .PHONY: core-makedep $(CORE_MAKEDEP_TARGETS)
  5. core-makedep: $(CORE_MAKEDEP_TARGETS)
  6. core-makedep-behavior: build clean
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. $t mkdir $(APP)/src/core
  12. $i "Generate related .erl files"
  13. $t printf "%s\n" "-module(human)." "-callback live() -> 'ok'." > $(APP)/src/core/human.erl
  14. $t printf "%s\n" "-module(boy)." "-behavior(human)." "-export([live/0])." "live() -> ok." > $(APP)/src/boy.erl
  15. $t $(MAKE) -C $(APP) $v
  16. $i "Check that all compiled files exist"
  17. $t test -f $(APP)/$(APP).d
  18. $t test -f $(APP)/ebin/$(APP).app
  19. $t test -f $(APP)/ebin/boy.beam
  20. $t test -f $(APP)/ebin/human.beam
  21. core-makedep-import: build clean
  22. $i "Bootstrap a new OTP library named $(APP)"
  23. $t mkdir $(APP)/
  24. $t cp ../erlang.mk $(APP)/
  25. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  26. $t mkdir $(APP)/src/core
  27. $i "Generate related .erl files"
  28. $t printf "%s\n" "-module(human)." "-export([live/0])." "live() -> ok." > $(APP)/src/core/human.erl
  29. $t printf "%s\n" "-module(boy)." "-import(human,[live/0])." > $(APP)/src/boy.erl
  30. $t $(MAKE) -C $(APP) $v
  31. $i "Check that all compiled files exist"
  32. $t test -f $(APP)/$(APP).d
  33. $t test -f $(APP)/ebin/$(APP).app
  34. $t test -f $(APP)/ebin/boy.beam
  35. $t test -f $(APP)/ebin/human.beam
  36. $i "Confirm the file was added by makedep"
  37. $t grep COMPILE_FIRST $(APP)/$(APP).d | grep -q core/human