Add legacy Makefile stuff to build RDMA tools and demos

Building the RDMA tools and demos with CMake is still WIP
pull/11/head
Paul Hindt 2022-03-09 20:21:16 -08:00
parent e4d2a3bb6b
commit bbb91161c0
7 changed files with 464 additions and 0 deletions

2
.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
*.o
_host

View File

@ -0,0 +1,34 @@
#
# Copyright (C) 2004 - 2017 AJA Video Systems, Inc.
# Proprietary and Confidential information.
# All righs reserved
#
DIR := $(strip $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))))
ifeq (,$(filter _%,$(notdir $(CURDIR))))
include $(DIR)/../../../build/targets.mk
else
include $(DIR)/../../../build/configure.mk
AJA_APP = $(A_UBER_BIN)/testrdma
VPATH = $(A_DEMOAPPS_PATH)
INCLUDES = -I$(A_DEMOAPPS_PATH)
ifdef AJA_RDMA
CPPFLAGS += -DAJA_RDMA=$(AJA_RDMA)
ifdef AJA_IGPU
CPPFLAGS += -DAJA_IGPU=$(AJA_IGPU)
endif
CUDA_INC_DIR ?= $(shell find /usr/local/cuda-* -name cuda.h 2>/dev/null|head -1|xargs dirname 2>/dev/null)
CUDA_LIB_DIR ?= $(shell find /usr/local/cuda-* -name libcudart.so 2>/dev/null|head -1|xargs dirname 2>/dev/null)
INCLUDES += -I$(CUDA_INC_DIR)
LIBDIRS += -L$(CUDA_LIB_DIR) -Xlinker -rpath=$(CUDA_LIB_DIR)
LIBS += -lcuda -lcudart
endif
SRCS = testrdma.cpp
include $(DIR)/../../../build/common.mk
endif

View File

@ -0,0 +1,138 @@
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
#
DIR := $(strip $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))))
ifeq (,$(filter _%,$(notdir $(CURDIR))))
include $(DIR)/../../../build/targets.mk
else
include $(DIR)/../../../build/configure.mk
ifeq ($(AJA_DEBUG),1)
AJA_LIB = ajantv2d
else
AJA_LIB = ajantv2
endif
AJA_LIB_PATH = $(A_UBER_LIB)/lib$(AJA_LIB).a
#AJA_LIB_PATH_SO = $(A_UBER_LIB)/lib$(AJA_LIB).so
KERNEL_INCLUDES := /lib/modules/$(shell uname -r)/build
VPATH := $(A_LIB_NTV2_SRC):$(A_LIB_NTV2_SRC_LINUX):$(A_LIB_NTV2_INC):$(A_LIB_ANC_PATH)/src:$(A_LIB_BASE_PATH):$(A_LIB_BASE_PATH)/common:$(A_LIB_BASE_PATH)/system:$(A_LIB_BASE_PATH)/system/linux:$(A_LIB_BASE_PATH)/pnp:$(A_LIB_BASE_PATH)/pnp/linux:$(A_LIB_BASE_PATH)/persistence:$(A_LIB_BASE_PATH)/network:$(KERNEL_INCLUDES):$(SRCDIR)
CPPFLAGS := -D_REENTRANT -DAJASTATIC
INCLUDES = -I$(KERNEL_INCLUDES) -I$(A_LIB_ANC_PATH)/includes
AJA_LIB_SRCS =\
ancillarydata.cpp \
ancillarydatafactory.cpp \
ancillarydata_cea608.cpp \
ancillarydata_cea608_line21.cpp \
ancillarydata_cea608_vanc.cpp \
ancillarydata_cea708.cpp \
ancillarydata_framestatusinfo524D.cpp \
ancillarydata_framestatusinfo5251.cpp \
ancillarydata_hdr_hdr10.cpp \
ancillarydata_hdr_hlg.cpp \
ancillarydata_hdr_sdr.cpp \
ancillarydata_timecode.cpp \
ancillarydata_timecode_atc.cpp \
ancillarydata_timecode_vitc.cpp \
ancillarylist.cpp \
atomic.cpp \
audioutilities.cpp \
buffer.cpp \
common.cpp \
debug.cpp \
dpx_hdr.cpp \
dpxfileio.cpp \
event.cpp \
eventimpl.cpp \
file_io.cpp \
guid.cpp \
info.cpp \
infoimpl.cpp \
ip_socket.cpp \
lock.cpp \
lockimpl.cpp \
memory.cpp \
options_popt.cpp \
performance.cpp \
pixelformat.cpp \
pnp.cpp \
pnpimpl.cpp \
process.cpp \
processimpl.cpp \
system.cpp \
systemtime.cpp \
testpatterngen.cpp \
thread.cpp \
threadimpl.cpp \
timebase.cpp \
timecode.cpp \
timecodeburn.cpp \
timer.cpp \
udp_socket.cpp \
videoutilities.cpp \
wavewriter.cpp \
ntv2audio.cpp \
ntv2anc.cpp \
ntv2autocirculate.cpp \
ntv2bitfile.cpp \
ntv2bitfilemanager.cpp \
ntv2card.cpp \
ntv2config2022.cpp \
ntv2config2110.cpp \
ntv2configts2022.cpp \
ntv2csclut.cpp \
ntv2cscmatrix.cpp \
ntv2debug.cpp \
ntv2devicefeatures.cpp \
ntv2devicescanner.cpp \
ntv2discover.cpp \
ntv2dma.cpp \
ntv2dynamicdevice.cpp \
ntv2hdmi.cpp \
ntv2hevc.cpp \
ntv2driverinterface.cpp \
ntv2enhancedcsc.cpp \
ntv2formatdescriptor.cpp \
ntv2interrupts.cpp \
ntv2konaflashprogram.cpp \
ntv2linuxdriverinterface.cpp \
ntv2mailbox.cpp \
ntv2mbcontroller.cpp \
ntv2mcsfile.cpp \
ntv2nubaccess.cpp \
ntv2nubpktcom.cpp \
ntv2publicinterface.cpp \
ntv2register.cpp \
ntv2registerexpert.cpp \
ntv2resample.cpp \
ntv2routingexpert.cpp \
ntv2rp188.cpp \
ntv2serialcontrol.cpp \
ntv2signalrouter.cpp \
ntv2spiinterface.cpp \
ntv2subscriptions.cpp \
ntv2supportlogger.cpp \
ntv2transcode.cpp \
ntv2utf8.cpp \
ntv2utils.cpp \
ntv2verticalfilter.cpp \
ntv2vpid.cpp \
ntv2vpidfromspec.cpp \
ntv2task.cpp \
ntv2testpatterngen.cpp
ifndef AJA_LIB_PATH_SO
AJA_LIB_SRCS += persistence.cpp
endif
include $(DIR)/../../../build/common.mk
endif

196
build/common.mk 100644
View File

@ -0,0 +1,196 @@
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
#
CXX ?= g++
CPP := $(CXX)
ifeq ($(AJA_USE_CCACHE),1)
CXX := ccache $(CXX)
CPP := ccache $(CPP)
CC := ccache $(CC)
endif
CPPFLAGS += -DAJALinux -DAJA_LINUX -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
-pedantic -Wall -Wno-long-long -Wwrite-strings -c -pipe -fPIC -std=c++11 $(DBG)
LD = $(CXX)
LDFLAGS =
VPATH := $(VPATH):$(A_LIB_NTV2_INC):$(A_LIB_NTV2_SRC):$(A_LIB_NTV2_SRC_LINUX):$(A_UBER_LIB):$(SRCDIR)
INCLUDES:= $(INCLUDES) -I$(A_LIB_NTV2_INC) -I$(A_LIB_NTV2_SRC) -I$(A_LIB_NTV2_SRC_LINUX) -I$(A_LIBRARIES_PATH) -I$(A_LIB_BASE_PATH)
LIBDIRS := $(LIBDIRS) -L$(A_UBER_LIB)
rm_if_file_exists = @[ -f $1 ] && rm -f $1 && echo "rm -f $1" || true
rm_if_dir_exists = @[ -d $1 ] && rm -rf $1 && echo "rm -rf $1" || true
mkdir_if_not_exists = @[ -d $1 ] || mkdir -p $1 && echo "mkdir -p $1" || true
ifeq ($(AJA_DEBUG),1)
LIB_AJANTV2_FILENAME = ajantv2d
else
LIB_AJANTV2_FILENAME = ajantv2
endif
LIB_AJANTV2 = $(A_UBER_LIB)/lib$(LIB_AJANTV2_FILENAME).a
LIB_AJANTV2_SO = $(A_UBER_LIB)/lib$(LIB_AJANTV2_FILENAME).so
ifdef AJA_LIB_PATH
BUILD_AND_LINK_AGAINST_AJALIBS = 0
else ifdef AJA_LIB_PATH_SO
BUILD_AND_LINK_AGAINST_AJALIBS = 0
else
BUILD_AND_LINK_AGAINST_AJALIBS = 1
endif
ifeq ($(BUILD_AND_LINK_AGAINST_AJALIBS),1)
LIBS := $(LIBS) -l$(LIB_AJANTV2_FILENAME) -lpthread -lrt
LIB_AJANTV2_DEP := $(LIB_AJANTV2)
else
LIBS := $(LIBS) -lpthread -lrt
LIB_AJANTV2_DEP :=
endif
OBJS = $(patsubst %.cpp,%.o,$(SRCS)) $(EXTRA_OBJS)
ifdef C_SRCS
OBJS += $(patsubst %.c,%.o,$(C_SRCS))
endif
ifdef SRCS2
OBJS2 = $(patsubst %.cpp,%.o,$(SRCS2))
endif
ifdef C_SRCS2
OBJS2 += $(patsubst %.c,%.o,$(C_SRCS2))
endif
ifdef SRCS3
OBJS3 = $(patsubst %.cpp,%.o,$(SRCS3))
endif
ifdef C_SRCS3
OBJS3 += $(patsubst %.c,%.o,$(C_SRCS3))
endif
ifdef SRCS4
OBJS4 = $(patsubst %.cpp,%.o,$(SRCS4))
endif
ifdef C_SRCS4
OBJS4 += $(patsubst %.c,%.o,$(C_SRCS4))
endif
ifdef AJA_LIB_SRCS
LIBOBJS = $(patsubst %.cpp,%.o,$(AJA_LIB_SRCS))
ifdef AJA_LIB_C_SRCS
LIBOBJS += $(patsubst %.c,%.o,$(AJA_LIB_C_SRCS))
endif
endif
%.o: %.cpp
$(CPP) $(CPPFLAGS) $(INCLUDES) -o $@ $<
@$(CPP) -MM $(CPPFLAGS) $(INCLUDES) -MF $*.d $<
%.o: %.c
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
@$(CC) -MM $(CFLAGS) $(INCLUDES) -MF $*.d $<
ifeq ($(BUILD_AND_LINK_AGAINST_AJALIBS),1)
all: $(LIB_AJANTV2) $(AJA_APP) $(AJA_APP2) $(AJA_APP3) $(AJA_APP4) $(AJA_QT_APP)
else
all: $(AJA_APP) $(AJA_APP2) $(AJA_APP3) $(AJA_APP4) $(AJA_QT_APP) $(AJA_LIB_PATH) $(AJA_LIB_PATH_SO)
endif
-include $(patsubst %.cpp,%.d,$(SRCS))
ifdef SRCS2
-include $(patsubst %.cpp,%.d,$(SRCS2))
endif
ifdef SRCS3
-include $(patsubst %.cpp,%.d,$(SRCS3))
endif
ifdef SRCS4
-include $(patsubst %.cpp,%.d,$(SRCS4))
endif
ifdef AJA_LIB_SRCS
-include $(patsubst %.cpp,%.d,$(AJA_LIB_SRCS))
endif
ifeq ($(BUILD_AND_LINK_AGAINST_AJALIBS),1)
.PHONY : $(LIB_AJANTV2)
$(LIB_AJANTV2): $(SDK_SRCS)
$(MAKE) -C $(A_LIB_NTV2_PATH)/build
endif
$(AJA_APP): $(OBJS) $(LIB_AJANTV2_DEP)
$(call mkdir_if_not_exists,$(A_UBER_BIN))
$(LD) $(LDFLAGS) $(LIBDIRS) $(OBJS) -o $(AJA_APP) $(LIBS)
ifdef AJA_APP2
$(AJA_APP2): $(OBJS2) $(LIB_AJANTV2_DEP)
$(call mkdir_if_not_exists,$(A_UBER_BIN))
$(LD) $(LDFLAGS) $(LIBDIRS) $(OBJS2) -o $(AJA_APP2) $(LIBS)
endif
ifdef AJA_APP3
$(AJA_APP3): $(OBJS3) $(LIB_AJANTV2_DEP)
$(call mkdir_if_not_exists,$(A_UBER_BIN))
$(LD) $(LDFLAGS) $(LIBDIRS) $(OBJS3) -o $(AJA_APP3) $(LIBS)
endif
ifdef AJA_APP4
$(AJA_APP4): $(OBJS4) $(LIB_AJANTV2_DEP)
$(call mkdir_if_not_exists,$(A_UBER_BIN))
$(LD) $(LDFLAGS) $(LIBDIRS) $(OBJS4) -o $(AJA_APP4) $(LIBS)
endif
ifdef AJA_LIB_PATH
.PHONY : $(AJA_LIB_PATH)
$(AJA_LIB_PATH): $(LIBOBJS)
$(call mkdir_if_not_exists,$(A_UBER_LIB))
ar crs $@ $(LIBOBJS)
endif
ifdef AJA_LIB_PATH_SO
.PHONY : $(AJA_LIB_PATH_SO)
$(AJA_LIB_PATH_SO): $(LIBOBJS)
$(call mkdir_if_not_exists,$(A_UBER_LIB))
$(CXX) $(LDFLAGS) -shared -Wl,-soname,lib$(AJA_LIB).so -o $@ $(LIBOBJS) $(LIBS)
endif
ifdef AJA_QT_APP
.PHONY: $(AJA_QT_APP)
$(AJA_QT_APP):
$(call mkdir_if_not_exists,$(OBJDIR))
cd $(OBJDIR) && $(QMAKE) $(QT_PRO_FILE) && $(MAKE)
endif
.PHONY: clean
clean:
ifdef AJA_APP
$(call rm_if_file_exists,$(AJA_APP))
endif
ifdef AJA_APP2
$(call rm_if_file_exists,$(AJA_APP2))
endif
ifdef AJA_APP3
$(call rm_if_file_exists,$(AJA_APP3))
endif
ifdef AJA_APP4
$(call rm_if_file_exists,$(AJA_APP4))
endif
ifdef AJA_QT_APP
$(call rm_if_file_exists,$(AJA_QT_APP))
endif
ifdef AJA_LIB_PATH
$(call rm_if_file_exists,$(AJA_LIB_PATH))
endif
ifdef AJA_LIB_PATH_SO
$(call rm_if_file_exists,$(AJA_LIB_PATH_SO))
endif
ifeq ($(BUILD_AND_LINK_AGAINST_AJALIBS),1)
$(call rm_if_file_exists,$(LIB_AJANTV2_SO))
$(call rm_if_file_exists,$(LIB_AJANTV2))
$(call rm_if_dir_exists,"$(A_LIB_NTV2_PATH)/build/$(OBJDIR)")
endif
$(call rm_if_dir_exists,"`pwd`")

16
build/internal.mk 100644
View File

@ -0,0 +1,16 @@
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2004 - 2022 AJA Video Systems, Inc.
#
# makefile fragment for internal stuff that gets -indlude ed into the
# main, root level make. The idea here is that we can hide the
# existence of things that we don't distribute to OEMs by includeing
# this into the main make.
#SUBDIRS += ajaclasses
CLEANDIRS := $(SUBDIRS)
#SUBDIRS += asdcplib

51
build/qt.mk 100644
View File

@ -0,0 +1,51 @@
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2004 - 2022 AJA Video Systems, Inc.
#
# Sniff around the system for QT5 and make sure we use it
#
# Using the QT5 qmake to gin up the qMakefile (see the Makefiles in
# the qt<app name> directories for more info) will do the right thing,
# so make sure that we do that.
QMAKE = $(shell command -v qmake 2>&1)
# check that any found system level qmake actually works
QRET := $(shell $(QMAKE) -v 1>&2 2>/dev/null; echo $$?)
ifneq (0, $(QRET))
QMAKE = $(shell echo "")
endif
# look for qmake in $PATH
ifeq (,$(QMAKE))
QMAKE = $(shell command -v qmake-qt5 2>&1)
endif
# look for official Qt (online install version) qmake in $HOME, uses highest numbered 5.x.x version
ifeq (,$(QMAKE))
QMAKE = $(shell find $(HOME) -path "$(HOME)/Qt/5.*/gcc_64/bin/qmake" 2>/dev/null | sort -r | head -n 1)
endif
# look for official Qt (stand-alone install version) qmake in $HOME, uses highest numbered 5.x.x version
ifeq (,$(QMAKE))
QMAKE = $(shell find $(HOME) -path "$(HOME)/Qt5.*/5.*/gcc_64/bin/qmake" 2>/dev/null | sort -r | head -n 1)
endif
# look for official Qt qmake in /opt, uses highest numbered 5.x.x version
ifeq (,$(QMAKE))
QMAKE = $(shell find /opt -path "/opt/Qt5.*/5.*/gcc_64/bin/qmake" 2>/dev/null | sort -r | head -n 1)
endif
# WTF? qmake -v outputs to stderr??
QMAKE_V := $(shell $(QMAKE) -v 2>&1)
QMAKE_5 := $(findstring 5.,$(QMAKE_V))
ifneq (,$(QMAKE_5))
else
$(error FATAL ERROR: I cannot find qmake version 5 in your PATH. QT applications in this SDK require version 5. Please install one and ensure that qmake is in your PATH.)
endif
export QMAKE
#.PHONY: test
#test:
# @echo QMAKE: $(QMAKE)
# @echo QMAKE_V: "$(QMAKE_V)"
# @echo QMAKE_5: $(QMAKE_5)

27
build/targets.mk 100644
View File

@ -0,0 +1,27 @@
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
#
#
# Here's the idea behind this makefile approach
# http://make.paulandlesley.org/multi-arch.html
#
DIR := $(strip $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))))
SUFFIXES:
include $(DIR)/configure.mk
MAKETARGET = $(MAKE) -C $@ -f $(CURDIR)/Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS)
.PHONY: $(OBJDIR)
$(OBJDIR):
@mkdir -p $@
+@$(MAKETARGET)
Makefile : ;
%.mk :: ;
% :: $(OBJDIR) ;