Makefile 950 B

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