summaryrefslogtreecommitdiff
path: root/src/common-utils/src.mk
diff options
context:
space:
mode:
Diffstat (limited to 'src/common-utils/src.mk')
-rw-r--r--src/common-utils/src.mk13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common-utils/src.mk b/src/common-utils/src.mk
index 6dbed7a..bb1e1d3 100644
--- a/src/common-utils/src.mk
+++ b/src/common-utils/src.mk
@@ -1,5 +1,8 @@
# makefile fragment included by nvidia-xconfig, nvidia-settings, and nvidia-installer
+# the including makefile should set this if the relevant program uses pciaccess
+COMMON_UTILS_PCIACCESS ?=
+
COMMON_UTILS_SRC += nvgetopt.c
COMMON_UTILS_SRC += common-utils.c
COMMON_UTILS_SRC += msg.c
@@ -9,6 +12,16 @@ COMMON_UTILS_EXTRA_DIST += common-utils.h
COMMON_UTILS_EXTRA_DIST += msg.h
COMMON_UTILS_EXTRA_DIST += src.mk
+# only build nvpci-utils.c for programs that actually use libpciaccess, to
+# prevent other programs from needing to set the right CFLAGS/LDFLAGS for code
+# they won't use. Otherwise, just package it in the source tarball.
+ifneq ($(COMMON_UTILS_PCIACCESS),)
+ COMMON_UTILS_SRC += nvpci-utils.c
+else
+ COMMON_UTILS_EXTRA_DIST += nvpci-utils.c
+endif
+COMMON_UTILS_EXTRA_DIST += nvpci-utils.h
+
# gen-manpage-opts-helper.c is listed in EXTRA_DIST, rather than SRC,
# because it is not compiled into the utilities themselves, but used
# when building the utility's gen-manpage-opts