Makefile 1010 B

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