############################################################################### # # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LGPL-2.1-or-later # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License, version 2.1, as published by the Free Software Foundation. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program. If not, see # . # ############################################################################### SO_NAME := libnvv4lconvert.so DEST_DIR ?= /usr/lib/aarch64-linux-gnu/nvidia SRCS := libv4lconvert.c tinyjpeg.c sn9c10x.c sn9c20x.c pac207.c mr97310a.c \ flip.c crop.c jidctflt.c spca561-decompress.c \ rgbyuv.c sn9c2028-decomp.c spca501.c sq905c.c bayer.c hm12.c \ stv0680.c cpia1.c se401.c jpgl.c jpeg.c jl2005bcd.c helper.c \ $(wildcard processing/*.c) \ $(wildcard control/*.c) INCLUDES += -I./ -I../include -I./control -I./processing OBJS := $(SRCS:.c=.o) CFLAGS := -fPIC MACHINE = $(shell uname -m) ifeq ($(MACHINE),x86_64) CFLAGS += -DLIBV4L2_PLUGIN_DIR_PATH_X86 DEST_DIR ?= /opt/nvidia/deepstream/deepstream-4.0/lib SYM_LINK_DIR := $(DEST_DIR) else DEST_DIR ?= /usr/lib/$(MACHINE)-linux-gnu/nvidia SYM_LINK_DIR := $(shell realpath $(DEST_DIR)/..) endif LIBS = -lrt LDFLAGS := -Wl,-soname,libv4lconvert.so.0 all: $(SO_NAME) %.o: %.c $(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@ $(SO_NAME): $(OBJS) $(CC) -shared -o $(SO_NAME) $(OBJS) $(LIBS) $(LDFLAGS) .PHONY: install install: $(SO_NAME) cp -vp $(SO_NAME) $(DEST_DIR) if [ "$(MACHINE)" = "aarch64" ]; then \ ln -sf nvidia/$(SO_NAME) $(SYM_LINK_DIR)/libv4lconvert.so.0.0.999999 ; \ else \ ln -sf $(SO_NAME) $(SYM_LINK_DIR)/libv4lconvert.so.0.0.999999 ; \ fi ln -sf libv4lconvert.so.0.0.999999 \ $(SYM_LINK_DIR)/libv4lconvert.so ln -sf libv4lconvert.so.0.0.999999 \ ${SYM_LINK_DIR}/libv4lconvert.so.0 .PHONY: clean clean: rm -rf $(OBJS) $(SO_NAME)