Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. export MAKEFILE_NAME := $(notdir $(realpath $(lastword $(MAKEFILE_LIST))))
  2. export MAKEFILE_PATH := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
  3. export MAKEFILE_SUBDIR := $(MAKEFILE_PATH)$(MAKEFILE_NAME).d
  4. export MAKEFILE_CONFIG := $(MAKEFILE_SUBDIR)/$(MAKEFILE_NAME).config
  5. export MAKEFILE_DIRS := $(MAKEFILE_SUBDIR)/$(MAKEFILE_NAME).dirs
  6. export MAKEFILE_RULES := $(MAKEFILE_SUBDIR)/$(MAKEFILE_NAME).rules
  7. export MAKEFILE_MASTER := $(MAKEFILE_SUBDIR)/$(MAKEFILE_NAME).master
  8. $(info ========================================================================)
  9. $(info *** Main IFS make file started $(MAKEFILE_PATH)$(MAKEFILE_NAME))
  10. $(info ========================================================================)
  11. include $(MAKEFILE_DIRS)
  12. comp_tmp := $(IFS_COMPONENTS)
  13. define dep_sequence
  14. ifneq (,$(word 2,$(comp_tmp)))
  15. $(word 2,$(comp_tmp)):$(word 1,$(comp_tmp))
  16. comp_tmp := $$(wordlist 2,$$(words $$(comp_tmp)),$$(comp_tmp))
  17. endif
  18. endef
  19. .PHONY: master lib clean realclean dep-clean $(IFS_COMPONENTS)
  20. lib dep-clean: $(IFS_COMPONENTS)
  21. clean realclean: $(IFS_COMPONENTS) master
  22. master: lib
  23. $(foreach ,$(IFS_COMPONENTS),$(eval $(dep_sequence)))
  24. $(IFS_COMPONENTS):
  25. @echo "========================================================================"
  26. @echo "*** Making component $@: $(MAKECMDGOALS)"
  27. @echo "========================================================================"
  28. @echo -n "--> "
  29. $(MAKE) -C $(MAKEFILE_PATH)$@ -f $(MAKEFILE_NAME) $(MAKECMDGOALS)
  30. master:
  31. @echo "========================================================================"
  32. @echo "*** Making IFS master: $(MAKECMDGOALS)"
  33. @echo "========================================================================"
  34. @echo -n "--> "
  35. $(MAKE) -C $(MAKEFILE_PATH) -f $(MAKEFILE_MASTER) $(MAKECMDGOALS)