From: Pali Rohár Date: Sun, 26 Dec 2021 17:44:44 +0000 (+0100) Subject: Makefile: Add new option COMPAT_GETOPT X-Git-Tag: v3.8.0~83 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=8493c9f686e970ac0ecd0f69d6a8398f3bceac28;p=pciutils.git 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. --- 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)