From 8493c9f686e970ac0ecd0f69d6a8398f3bceac28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 26 Dec 2021 18:44:44 +0100 Subject: [PATCH] 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. --- Makefile | 10 ++++++++-- 1 file 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) -- 2.39.2