Makefile 897 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # Copyright (c) 2017-2018, 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. PROJECT := stm32image${BIN_EXT}
  10. OBJECTS := stm32image.o
  11. V := 0
  12. HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
  13. ifeq (${DEBUG},1)
  14. HOSTCCFLAGS += -g -O0 -DDEBUG
  15. else
  16. HOSTCCFLAGS += -O2
  17. endif
  18. ifeq (${V},0)
  19. Q := @
  20. else
  21. Q :=
  22. endif
  23. HOSTCC := gcc
  24. .PHONY: all clean distclean
  25. all: ${PROJECT}
  26. ${PROJECT}: ${OBJECTS} Makefile
  27. @echo " HOSTLD $@"
  28. ${Q}${HOSTCC} ${OBJECTS} -o $@
  29. @${ECHO_BLANK_LINE}
  30. @echo "Built $@ successfully"
  31. @${ECHO_BLANK_LINE}
  32. %.o: %.c Makefile
  33. @echo " HOSTCC $<"
  34. ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@
  35. clean:
  36. $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
  37. distclean: clean