aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-12-26 18:44:44 +0100
committerMartin Mareš <mj@ucw.cz>2021-12-26 22:51:59 +0100
commit8493c9f686e970ac0ecd0f69d6a8398f3bceac28 (patch)
tree4908f02e7af9b24bb45b756546769114517f2e6d
parentec1fe05c4811a1946ab42979e714a6515aef792a (diff)
downloadpciutils-8493c9f686e970ac0ecd0f69d6a8398f3bceac28.tar.gz
Makefile: Add new option COMPAT_GETOPT
This new option controls if compat/getopt.c should be compiled and linked into lspci and setpci binaries. Useful for ancient platforms. For example it is required to set COMPAT_GETOPT=yes for all versions of MinGW32 with CRTDLL (as this MinGW32 variant does not have linkable getopt() implementation). And also for MinGW32 with MSVCRT older than 3.0.
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0ce56f6..18d0288 100644
--- a/Makefile
+++ b/Makefile
@@ -69,8 +69,13 @@ force:
lib/config.h lib/config.mk:
cd lib && ./configure
-lspci$(EXEEXT): lspci.o ls-vpd.o ls-caps.o ls-caps-vendor.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
-setpci$(EXEEXT): setpci.o common.o lib/$(PCILIB)
+COMMON=common.o
+ifeq ($(COMPAT_GETOPT),yes)
+COMMON+=compat/getopt.o
+endif
+
+lspci$(EXEEXT): lspci.o ls-vpd.o ls-caps.o ls-caps-vendor.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o $(COMMON) lib/$(PCILIB)
+setpci$(EXEEXT): setpci.o $(COMMON) lib/$(PCILIB)
LSPCIINC=lspci.h pciutils.h $(PCIINC)
lspci.o: lspci.c $(LSPCIINC)
@@ -83,6 +88,7 @@ ls-map.o: ls-map.c $(LSPCIINC)
setpci.o: setpci.c pciutils.h $(PCIINC)
common.o: common.c pciutils.h $(PCIINC)
+compat/getopt.o: compat/getopt.c
lspci$(EXEEXT): LDLIBS+=$(LIBKMOD_LIBS)
ls-kernel.o: CFLAGS+=$(LIBKMOD_CFLAGS)