Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ################################################################################
  2. # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a
  5. # copy of this software and associated documentation files (the "Software"),
  6. # to deal in the Software without restriction, including without limitation
  7. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. # and/or sell copies of the Software, and to permit persons to whom the
  9. # Software is furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. # DEALINGS IN THE SOFTWARE.
  21. ################################################################################
  22. CUDA_VER?=
  23. ifeq ($(CUDA_VER),)
  24. $(error "CUDA_VER is not set run: export CUDA_VER=11.1")
  25. endif
  26. APP:= deepstream-test5-analytics
  27. TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
  28. NVDS_VERSION:=5.1
  29. LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
  30. APP_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/bin/
  31. ifeq ($(TARGET_DEVICE),aarch64)
  32. CFLAGS:= -DPLATFORM_TEGRA
  33. endif
  34. SRCS:= deepstream_test5_app_main.c
  35. SRCS+= ../deepstream-test5/deepstream_utc.c
  36. SRCS+= ../deepstream-app/deepstream_app.c ../deepstream-app/deepstream_app_config_parser.c
  37. SRCS+= $(wildcard ../../apps-common/src/*.c)
  38. INCS= $(wildcard *.h)
  39. INC_DIR=../deepstream-test5
  40. PKGS:= gstreamer-1.0 gstreamer-video-1.0 x11 json-glib-1.0
  41. OBJS:= $(SRCS:.c=.o)
  42. OBJS+= deepstream_nvdsanalytics_meta.o
  43. CFLAGS+= -I../../apps-common/includes -I./includes -I../../../includes -I../deepstream-app/ -DDS_VERSION_MINOR=1 -DDS_VERSION_MAJOR=5
  44. CFLAGS+= -I$(INC_DIR)
  45. CFLAGS+= -I/usr/local/cuda-$(CUDA_VER)/include
  46. LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta -lnvdsgst_helper -lnvdsgst_smartrecord -lnvds_utils -lnvds_msgbroker -lm \
  47. -lgstrtspserver-1.0 -ldl -Wl,-rpath,$(LIB_INSTALL_DIR)
  48. LIBS+= -L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart
  49. CFLAGS+= `pkg-config --cflags $(PKGS)`
  50. LIBS+= `pkg-config --libs $(PKGS)`
  51. all: $(APP)
  52. deepstream_nvdsanalytics_meta.o: deepstream_nvdsanalytics_meta.cpp $(INCS) Makefile
  53. $(CXX) -c -o $@ -Wall -Werror $(CFLAGS) $<
  54. %.o: %.c $(INCS) Makefile
  55. $(CC) -c -o $@ $(CFLAGS) $<
  56. $(APP): $(OBJS) Makefile
  57. $(CXX) -o $(APP) $(OBJS) $(LIBS)
  58. install: $(APP)
  59. cp -rv $(APP) $(APP_INSTALL_DIR)
  60. clean:
  61. rm -rf $(OBJS) $(APP)