Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ARTIFACT = wolfCrypt
  2. #Build architecture/variant string, possible values: x86, armv7le, etc...
  3. PLATFORM ?= armv7le
  4. #Build profile, possible values: release, debug, profile, coverage
  5. BUILD_PROFILE ?= debug
  6. CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
  7. OUTPUT_DIR = build/$(CONFIG_NAME)
  8. TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
  9. #Compiler definitions
  10. CC ?= qcc -Vgcc_nto$(PLATFORM)
  11. CXX ?= q++ -Vgcc_nto$(PLATFORM)_cxx
  12. LD = $(CC)
  13. INCLUDES += -I../../../ -I../../../wolfssl/wolfcrypt/port/caam/
  14. CCFLAGS += -O2 -Wall
  15. # For debugging print outs build with WOLFSSL_CAAM_PRINT defined
  16. # CCFLAGS += -DWOLFSSL_CAAM_PRINT -O2 -Wall
  17. # Setting base address for hardware
  18. # For IMX6UL devices
  19. # CCFLAGS += -DWOLFSSL_CAAM_IMX6UL
  20. # For IMX6Q devices
  21. CCFLAGS += -DWOLFSSL_CAAM_IMX6Q
  22. #Compiler flags for build profiles
  23. CCFLAGS_release += -O2
  24. CCFLAGS_debug += -g -O0 -fno-builtin
  25. CCFLAGS_coverage += -g -O0 -ftest-coverage -fprofile-arcs -nopipe -Wc,-auxbase-strip,$@
  26. LDFLAGS_coverage += -ftest-coverage -fprofile-arcs
  27. CCFLAGS_profile += -g -O0 -finstrument-functions
  28. LIBS_profile += -lprofilingS
  29. #Generic compiler flags (which include build type flags)
  30. CCFLAGS_all += -Wall -fmessage-length=0
  31. CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE))
  32. LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))
  33. LIBS_all += $(LIBS_$(BUILD_PROFILE))
  34. DEPS = -Wp,-MMD,$(OUTPUT_DIR)/$(notdir $(@:%.o=%.d)),-MT,$(OUTPUT_DIR)/$(notdir $@)
  35. SRCS = ../../../wolfcrypt/src/port/caam/caam_error.c \
  36. ../../../wolfcrypt/src/port/caam/caam_driver.c \
  37. ../../../wolfcrypt/src/port/caam/caam_qnx.c
  38. #Object files list
  39. OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS))))
  40. #Compiling rule
  41. $(OUTPUT_DIR)/%.o: %.c
  42. @mkdir -p $(dir $(OUTPUT_DIR)/$(notdir $@))
  43. $(CC) -c $(DEPS) -o $(OUTPUT_DIR)/$(notdir $@) $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $<
  44. #Linking rule
  45. $(TARGET):$(OBJS)
  46. $(LD) -o $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(foreach f, $(OBJS), $(OUTPUT_DIR)/$(notdir $(f))) $(LIBS_all) $(LIBS)
  47. #Rules section for default compilation and linking
  48. all: $(TARGET)
  49. clean:
  50. rm -fr $(OUTPUT_DIR)
  51. rebuild: clean all
  52. #Inclusion of dependencies (object files to source and includes)
  53. -include $(OBJS:%.o=%.d)