Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # Copyright 2018-2020 NXP
  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_1 := create_pbl${BIN_EXT}
  12. OBJECTS_1 := create_pbl.o
  13. PROJECT_2 := byte_swap${BIN_EXT}
  14. OBJECTS_2 := byte_swap.o
  15. V ?= 0
  16. override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
  17. CFLAGS := -Wall -Werror -pedantic -std=c99
  18. ifeq (${DEBUG},1)
  19. CFLAGS += -g -O0 -DDEBUG
  20. else
  21. CFLAGS += -O2
  22. endif
  23. LDLIBS :=
  24. ifeq (${V},0)
  25. Q := @
  26. else
  27. Q :=
  28. endif
  29. INCLUDE_PATHS :=
  30. .PHONY: all clean distclean
  31. all: create_pbl byte_swap
  32. ${PROJECT_1}: ${OBJECTS_1} Makefile
  33. @echo " LD $@"
  34. ${Q}$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS}
  35. @${ECHO_BLANK_LINE}
  36. @echo "Built $@ successfully"
  37. @${ECHO_BLANK_LINE}
  38. ${PROJECT_2}: ${OBJECTS_2} Makefile
  39. @echo " LD $@"
  40. ${Q}$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS}
  41. @${ECHO_BLANK_LINE}
  42. @echo "Built $@ successfully"
  43. @${ECHO_BLANK_LINE}
  44. %.o: %.c %.h Makefile
  45. @echo " CC $<"
  46. ${Q}$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
  47. clean:
  48. $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1})
  49. $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2})