#-----------------------------------------------------------------------------
#
#  TSDuck - The MPEG Transport Stream Toolkit
#  Copyright (c) 2005-2025, Thierry Lelegard
#  BSD-2-Clause license, see LICENSE.txt file or https://tsduck.io/license
#
#  List of MAKE variables.
#
#  The configuration variables can be specified on the make command line.
#  Other variables are automatically computed but can be overridden on the
#  make command line if necessary.
#
#-----------------------------------------------------------------------------

# Configuration of optional components in the project
# ---------------------------------------------------
NODEKTEC          # No Dektec device support, remove dependency to DTAPI.
NOHIDES           # No HiDes device support.
NOVATEK           # No Vatek-based device support.
NOCURL            # No HTTP support, remove dependency to libcurl.
NOPCSC            # No smartcard support, remove dependency to pcsc-lite.
NOOPENSSL         # No cryptographic support, remove dependency to openssl.
NOZLIB            # Don't use zlib, use embedded "Small Deflate" instead, remove dependency to zlib.
NOSRT             # No SRT support, remove dependency to libsrt.
NORIST            # No RIST support, remove dependency to librist.
NOJAVA            # No Java bindings.
NOPYTHON          # No Python bindings.
NOEDITLINE        # No interactive line editing, remove dependency to libedit.
NOGITHUB          # No version check, no download, no upgrade from GitHub (for distro packaging).
NOHWACCEL         # Disable hardware acceleration such as crypto instructions.
NOPCSTD           # Remove the std=c++17 flag from libtsduck's pkg-config file.
NODOC             # Do not build the documentation, install TSDuck without documentation.

# Options to define the representation of bitrates
# ------------------------------------------------
BITRATE_FLOAT     # Bitrates are 64-bit floating-point (the default).
BITRATE_INTEGER   # Bitrates are 64-bit integer.
BITRATE_FRACTION  # Bitrates are fractions of two 64-bit integers.
BITRATE_FIXED     # Bitrates are 64-bit fixed-point.
BITRATE_DECIMALS  # Number of decimal with BITRATE_FIXED. Use BITRATE_DECIMALS=1, default: 1.

# Build control
# -------------
CXXFLAGS_EXTRA    # Additional user-specified C++ compilation flags.
CPPFLAGS_EXTRA    # Additional user-specified preprocessor flags.
LDFLAGS_EXTRA     # Additional user-specified linker flags.
ARFLAGS_EXTRA     # Additional user-specified archiver flags.
LDLIBS_EXTRA      # Additional user-specified libraries.
ASSERTIONS        # Keep assertions in release mode (assertions are always on in debug mode).
DEBUG             # Compile with debug information and no optimization.
GPROF             # Compile with code profiling using gprof.
GCOV              # Compile with code coverage using gcov.
ASAN              # Compile with code sanitizing using AddressSanitizer with default optimization.
UBSAN             # Compile with code sanitizing using UndefinedBehaviorSanitizer with default optimization.
LLVM              # Force the usage is Clang/LLVM when the default compiler is GCC.
NOTEST            # Do not build unitary tests.
NOSTATIC          # Do not build the static library and the static tests.
NODEPRECATE       # Do not flag legacy methods as deprecated.
STATIC            # Build a fully static project. No possible everywhere. Limited final features.
VERBOSE           # Display full compilation commands (use "make VERBOSE=1").
V                 # Same as VERBOSE (use "make V=1").
SHELL_VERBOSE     # Debug: display all shell commands, including $(shell ...).
SYSROOT           # Installation root: Use in "make install" to build a temporary system root where TSDuck is installed.
SYSPREFIX         # Installation prefix: if not set on input, it is defined as /usr on Linux and as HomeBrew root on macOS.
LINUXBREW         # To be set on input in a Homebrew environment on Linux (aka "Linuxbrew").

# Cross compilation (limited support)
# -----------------------------------
CROSS             # If non-empty, perform a cross-compilation build.
CROSS_PREFIX      # Installation prefix all all cross-compilation environments. Default: /usr/local.
CROSS_TARGET      # Target name of the cross-compilation (e.g. arm-unknown-linux-gnueabi).
                  # If CROSS_TARGET is undefined, locate the first GCC executable as $(CROSS_PREFIX)/TARGET/bin/TARGET-gcc.
NATIVEBINDIR      # Directory of the TSDuck native build (native build required before cross-compilation).

#-----------------------------------------------------------------------------
# The following variables are generated inside make, but can be overridden on
# the command line if really necessary.
#-----------------------------------------------------------------------------

# Compilation flags and other build commands
# ------------------------------------------
CC                           # C compiler command.
CXX                          # C++ compiler command.
GCC                          # GCC command, even when CXX is not gcc.
CPP                          # C/C++ preprocessor command.
LD                           # Linker command.
AR                           # Library archive command.
STRIP                        # Binary strip command.
CPPFLAGS                     # Complete preprocessor flags.
CXXFLAGS                     # Complete C++ compilation flags.
LDFLAGS                      # Complete C++ compilation flags.
SOFLAGS                      # Complete options when creating shared object libraries.
ARFLAGS                      # Complete library archive command flags.
GCC_VERSION                  # Full GCC version.
GCC_MAJOR                    # GCC major version.
LLVM_VERSION                 # Full clang version.
LLVM_MAJOR                   # Clang major version.
USE_GCC                      # Non-empty when the C++ compiler is gcc.
USE_LLVM                     # Non-empty when the C++ compiler is clang (LLVM).
ASCIIDOCTOR                  # Asciidoctor HTML generator.
ASCIIDOCTOR_PDF              # Asciidoctor PDF generator.

# Java environment:
JAVAC                        # Java compiler command.
JAVAC_FLAGS                  # Java compilation flags.
CXXFLAGS_JAVA                # C++ compilation options for JNI.

# Partial C++ compilation flags (included in CXXFLAGS):
CXXFLAGS_CROSS               # For cross-compilation.
CXXFLAGS_DEBUG               # For debug mode.
CXXFLAGS_FPIC                # For position-independent code.
CXXFLAGS_FULLSPEED           # For full speed code optimization.
CXXFLAGS_GCOV                # For code coverage using gcov.
CXXFLAGS_GPROF               # For code profiling using gprof.
CXXFLAGS_INCLUDES            # Preprocessing options (includes and macros).
CXXFLAGS_M32                 # For 32-bit cross-compilation.
CXXFLAGS_OPTIMIZE            # For standard code optimization.
CXXFLAGS_OPTSIZE             # For code size optimization.
CXXFLAGS_PTHREAD             # Pthread options.
CXXFLAGS_SECURITY            # Security-oriented options.
CXXFLAGS_STANDARD            # Specifies the standard level of C++ language.
CXXFLAGS_TARGET              # Specify target CPU.
CXXFLAGS_WARNINGS            # Specify warnings.
CXXFLAGS_NO_WARNINGS         # Excluded warnings.

# Partial linker flags (included in LDFLAGS):
LDFLAGS_CROSS                # For cross-compilation.
LDFLAGS_DEBUG                # For debug mode.
LDFLAGS_GCOV                 # For code coverage using gcov.
LDFLAGS_GPROF                # For code profiling using gprof.
LDFLAGS_M32                  # For 32-bit cross-compilation.
LDFLAGS_PTHREAD              # Pthread options.
LDFLAGS_LINKER               # System linker specific options.
LDLIBS                       # Specify external libraries.
LDLIBS_PCSC                  # Libraries for PCSC.

# Partial archiver flags (included in LDFLAGS):
ARFLAGS_ADD                  # ar flags to add a module in the archive.

# Additional flags when building libtscore and libtsduck (or using the static libraries):
LIBTSCORE_CXXFLAGS_INCLUDES  # C++ compilation flags for libtscore.
LIBTSCORE_LDLIBS             # Additional libraries for libtscore.
LIBTSDUCK_CXXFLAGS_INCLUDES  # C++ compilation flags for libtsduck.
LIBTSDUCK_LDLIBS             # Additional libraries for libtsduck.
APPS_CXXFLAGS_INCLUDES       # C++ compilation flags for applications and plugins.

# Partial flags (included in LIBTSDUCK_*):
CXXFLAGS_CURL                # Compilation options for libcurl.
LDLIBS_CURL                  # Libraries for libcurl.

# Third-party libraries (if not installed at system level):
DTAPI_OBJECT                 # Dektec API object file (precompiled by Dektec).
DTAPI_HEADER                 # Dektec API header file.
VATEK_CFLAGS                 # C++ compilation flags for VATek library.
VATEK_LDLIBS                 # Linker flags for VATek library.

# Operating system description
# ----------------------------
LOCAL_OS       # Local operating system ("uname -s" in lowercase).
LOCAL_ARCH     # Local CPU architecture ("uname -m").
MAIN_ARCH      # CPU architecture family.
HOSTNAME       # Build system hostname (without domain name).
CPU_COUNT      # Number of logical CPU.
CORE_COUNT     # Number of physical cores.
LINUX          # Not empty on Linux system.
MACOS          # Not empty on macOS system.
FREEBSD        # Not empty on FreeBSD system.
NETBSD         # Not empty on NetBSD system.
OPENBSD        # Not empty on OpenBSD system.
DRAGONFLYBSD   # Not empty on DragonflyBSD system.
BSD            # Not empty on any BSD system.
SO_SUFFIX      # Shared object files suffix (.dylib, .so).
LANGUAGE       # Forced to English for predictible output.
LC_ALL         # Forced to English for predictible output.
LANG           # Forced to English for predictible output.
ALTDEVROOT     # Alternative root for development tools and library; can be Homebrew root or /usr if no other value is suitable.
BASHCOMP_DIR   # Directory for bash completion scripts.
BASHCOMP_AUTO  # If non-empty, automatic bash completions based on command name, create links for each command if necessary.
ETCDIR         # System configuration directory; /etc if $(SYSPREFIX) is /usr, $(SYSPREFIX)/etc otherwise.
UDEVDIR        # Directory for system-defined udev rules.
USELIB64       # Non-empty on x86_64 distro using /usr/lib64 instead of /usr/lib.
USRLIBDIR      # Library directory; $(SYSPREFIX)/lib or $(SYSPREFIX)/lib64.

# Common shell commands which may need alternatives
# -------------------------------------------------
SED                 # sed (or GNU sed if different).
GREP                # grep (or GNU grep if different).
FGREP               # fgrep (or GNU fgrep if different).
CHMOD               # chmod (or GNU chmod if different).
DATE                # date (or GNU date if different).
REALPATH            # realpath (or GNU realpath if different).
TAR                 # tar (or GNU tar if different).
BASE64              # base64 with options specifying continuous stream and input file.
XDGOPEN             # open (or xdg-open if not set as alternative)
SUDO                # sudo or empty if already running as root.
PYTHON              # Python command, at least Python 3.
PYTHON_VERSION      # Full Python version.
PYTHON_MAJOR        # Python major version.

# Structure of the TSDuck project directory tree
# ----------------------------------------------
ROOTDIR             # Root directory of the project.
SCRIPTSDIR          # Directory containing build scripts.
SRCROOT             # Root of all source files.
LIBTSCOREDIR        # Source directory for the TSCore library.
LIBTSDUCKDIR        # Source directory for the TSDuck library.
TSTOOLSDIR          # Source directory for all command line tools.
TSPLUGINSDIR        # Source directory for all external plugins.
LOCAL_OSDIR         # Name of subdirectory which contains system specific code in source tree.
OTHER_OS            # List of subdirectory for other operating systems (don't use here).
BINROOT             # Root of all generated files.
BINDIR              # Directory for all binary files; include architecture and host name.
BINDIR_SUFFIX       # Fixed suffix to add to BINDIR; ignored if BINDIR is defined as input variable.
OBJDIR              # Subdirectory of BINDIR where object files are stored;
                    # named objs-$(CURDIR) for each source directory where make is executed.
TOPLEVEL_CURDIR     # Value of CURDIR at the top-level invocation of make.
TOPLEVEL_BINDIR     # Value of BINDIR at the top-level invocation of make (typically on command line).
STATIC_LIBTSCORE    # Generated static library for TSCore library.
SHARED_LIBTSCORE    # Generated shared library for TSCore library.
STATIC_LIBTSDUCK    # Generated static library for TSDuck library.
SHARED_LIBTSDUCK    # Generated shared library for TSDuck library.
INSTALLERDIR        # Output directory for binary packages and installers.
GET_TSDUCK_VERSION  # Shell command to get TSDuck version (see get-version-from-sources.py).
ALL_INCLUDES        # List of all source directories with headers (excluding other OS).
LIBTSCORE_INCLUDES  # List of source directories in libtscore with public headers.
LIBTSDUCK_INCLUDES  # List of source directories in libtsduck with public headers.
TSPLUGINS           # List of plugins to compile.
TSTOOLS             # List of command line tools to compile.
NO_TSPLUGINS        # List of obsolete plugins to remove.
NO_TSTOOLS          # List of obsolete command line tools to remove.

# Make control
# ------------
LOG                 # Command prefix, e.g. "$(call LOG,[CXX] $<) $(CXX) ...".
MAKEFLAGS           # Make options, as generated by make, do not override on command line.
MAKEOVERRIDES       # List of overridden make variables.
MAKEFLAGS_SMP       # Explicit make parallel options, e.g. "-j8" for 8 processors.
JAVA_DONE           # Java options already set, don't do it again.
PRECONFIG_DONE      # Parsing of tsPreConfiguration.h already done, don't do it again.
CURL_DONE           # Libcurl options already set, don't do it again.
SRT_DONE            # SRT options already set, don't do it again.
RIST_DONE           # RIST options already set, don't do it again.
DTAPI_DONE          # Dektec DTAPI options already set, don't do it again.
PCSC_DONE           # PCSC options already set, don't do it again.
