core_makedep.mk 1.5 KB

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