Makefile 1.2 KB

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