entry.mk 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Entry point of build system.
  2. #
  3. # Do a sanity check on the given action(s) and processes them sequentially.
  4. # Sequential processing is needed because for example "clean" and "all" cannot
  5. # run in parallel. Some actions might be able to run in parallel, but that is
  6. # an optimization we can do later, if it is really worth it.
  7. # All actions we want to expose to the user.
  8. USER_ACTIONS:=\
  9. 3rdparty all app bindist clean createsubs dist install probe run \
  10. staticbindist
  11. # Mark all actions as logical targets.
  12. .PHONY: $(USER_ACTIONS)
  13. # Reject unknown actions.
  14. UNKNOWN_ACTIONS:=$(filter-out $(USER_ACTIONS),$(MAKECMDGOALS))
  15. ifneq ($(UNKNOWN_ACTIONS),)
  16. ifeq ($(words $(UNKNOWN_ACTIONS)),1)
  17. $(error Unknown action: $(UNKNOWN_ACTIONS))
  18. else
  19. $(error Unknown actions: $(UNKNOWN_ACTIONS))
  20. endif
  21. endif
  22. ifeq ($(MAKECMDGOALS),)
  23. # Make default action explicit.
  24. MAKECMDGOALS:=all
  25. .PHONY: default
  26. default: all
  27. endif
  28. ifeq ($(words $(MAKECMDGOALS)),1)
  29. # Single action, run it in this Make process.
  30. include build/main.mk
  31. else
  32. # Multiple actions are given, process them sequentially.
  33. # If the same action is given more than once, some warnings will be displayed,
  34. # but they will all be executed.
  35. ACTION_COUNTER:=$(MAKECMDGOALS:%=x)
  36. include build/entry-seq.mk
  37. $(MAKECMDGOALS): sequence-$(words $(MAKECMDGOALS))
  38. @true
  39. endif