Makefile 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #
  2. # Copyright (c) 2018-2024, Arm Limited. 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. include ${MAKE_HELPERS_DIRECTORY}common.mk
  10. include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
  11. SPTOOL ?= sptool${BIN_EXT}
  12. PROJECT := $(notdir ${SPTOOL})
  13. OBJECTS := sptool.o
  14. override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
  15. HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
  16. ifeq (${DEBUG},1)
  17. HOSTCCFLAGS += -g -O0 -DDEBUG
  18. else
  19. HOSTCCFLAGS += -O2
  20. endif
  21. INCLUDE_PATHS := -I../../include/tools_share
  22. .PHONY: all clean distclean
  23. all: ${PROJECT}
  24. ${PROJECT}: ${OBJECTS} Makefile
  25. $(s)echo " HOSTLD $@"
  26. $(q)$(host-cc) ${OBJECTS} -o $@ ${LDLIBS}
  27. $(s)echo
  28. $(s)echo "Built $@ successfully"
  29. $(s)echo
  30. %.o: %.c Makefile
  31. $(s)echo " HOSTCC $<"
  32. $(q)$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
  33. clean:
  34. $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})