Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ##
  2. # Copyright (C) 2021 Alibaba Group Holding Limited
  3. # Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License version 2 as
  7. # published by the Free Software Foundation.
  8. ##
  9. DIR_TO_ROOT=../../..
  10. include $(DIR_TO_ROOT)/build.param
  11. TARGET_STATIC := libhal_platform.a
  12. TARGET_DYNAMIC := libhal_platform.so
  13. OUTPUT_DIR := $(DIR_TO_ROOT)/output/hal
  14. #CFLAGS = -Wall -g -O0
  15. INCLUDE += -I./opencv/
  16. SRCS = $(wildcard *.c)
  17. OBJS = $(SRCS:.c=.o)
  18. all: drivers opencv $(TARGET_STATIC) $(TARGET_DYNAMIC) #app
  19. opencv:
  20. make -C opencv
  21. app:
  22. make -C app
  23. drivers: $(TARGET_STATIC)
  24. make -C drivers
  25. $(TARGET_DYNAMIC): $(OBJS) opencv
  26. @mkdir -p $(OUTPUT_DIR)/$(SO_LIB_DIR)
  27. @echo "Linking" $@ "..."
  28. $(CC) -shared -fPIC -o $(OUTPUT_DIR)/$(SO_LIB_DIR)/$@ .obj/*.o $(CFLAGS) $(INCLUDE) \
  29. -L$(DIR_TO_ROOT)/output/common/ -L$(DIR_TO_ROOT)/output/hal/ \
  30. -lhal_common -lcamera_platform -lpthread $(LIBOPENCV_LIBS)
  31. $(TARGET_STATIC): $(OBJS)
  32. @mkdir -p $(OUTPUT_DIR)
  33. @echo "Linking" $@ "..."
  34. $(AR) -r -o $(OUTPUT_DIR)/$@ .obj/*.o
  35. $(OBJS): %.o:%.c
  36. @mkdir -p .obj
  37. @echo "Compiling" $< "..."
  38. $(CC) $(CFLAGS) $(INCLUDE) -c -o .obj/$(notdir $@) $<
  39. clean:
  40. rm -rf .obj
  41. rm -f $(OUTPUT_DIR)/$(TARGET_STATIC)
  42. rm -f $(OUTPUT_DIR)/$(SO_LIB_DIR)/$(TARGET_DYNAMIC)
  43. make -C drivers clean
  44. make -C opencv clean
  45. .PHONY: clean all drivers opencv app