Makefile 914 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. include ${MAKE_HELPERS_DIRECTORY}common.mk
  11. include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
  12. PROJECT := doimage${BIN_EXT}
  13. OBJECTS := doimage.o
  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. .PHONY: all clean distclean
  21. all: ${PROJECT}
  22. ${PROJECT}: ${OBJECTS} Makefile
  23. $(s)echo " HOSTLD $@"
  24. $(q)$(host-cc) ${OBJECTS} -o $@
  25. $(s)echo
  26. $(s)echo "Built $@ successfully"
  27. $(s)echo
  28. %.o: %.c Makefile
  29. $(s)echo " HOSTCC $<"
  30. $(q)$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
  31. clean:
  32. $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
  33. distclean: clean