Makefile 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #
  2. # Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. MAKE_HELPERS_DIRECTORY := ../../make_helpers/
  7. include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
  8. include ${MAKE_HELPERS_DIRECTORY}build_env.mk
  9. include ${MAKE_HELPERS_DIRECTORY}common.mk
  10. include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
  11. PROJECT := stm32image${BIN_EXT}
  12. OBJECTS := stm32image.o
  13. HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
  14. ifeq (${DEBUG},1)
  15. HOSTCCFLAGS += -g -O0 -DDEBUG
  16. else
  17. HOSTCCFLAGS += -O2
  18. endif
  19. .PHONY: all clean distclean
  20. all: ${PROJECT}
  21. ${PROJECT}: ${OBJECTS} Makefile
  22. $(s)echo " HOSTLD $@"
  23. $(q)$(host-cc) ${OBJECTS} -o $@
  24. $(s)echo
  25. $(s)echo "Built $@ successfully"
  26. $(s)echo
  27. %.o: %.c Makefile
  28. $(s)echo " HOSTCC $<"
  29. $(q)$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
  30. clean:
  31. $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
  32. distclean: clean