Makefile 899 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # Copyright (C) 2019 Remi Pommarel <repk@triplefau.lt>
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. # https://spdx.org/licenses
  6. #
  7. MAKE_HELPERS_DIRECTORY := ../../make_helpers/
  8. include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
  9. include ${MAKE_HELPERS_DIRECTORY}build_env.mk
  10. PROJECT := doimage${BIN_EXT}
  11. OBJECTS := doimage.o
  12. V := 0
  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. ifeq (${V},0)
  20. Q := @
  21. else
  22. Q :=
  23. endif
  24. HOSTCC := gcc
  25. .PHONY: all clean distclean
  26. all: ${PROJECT}
  27. ${PROJECT}: ${OBJECTS} Makefile
  28. @echo " HOSTLD $@"
  29. ${Q}${HOSTCC} ${OBJECTS} -o $@
  30. @${ECHO_BLANK_LINE}
  31. @echo "Built $@ successfully"
  32. @${ECHO_BLANK_LINE}
  33. %.o: %.c Makefile
  34. @echo " HOSTCC $<"
  35. ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@
  36. clean:
  37. $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
  38. distclean: clean