]> mj.ucw.cz Git - pciutils.git/commitdiff
Makefile: Add new option COMPAT_GETOPT
authorPali Rohár <pali@kernel.org>
Sun, 26 Dec 2021 17:44:44 +0000 (18:44 +0100)
committerMartin Mareš <mj@ucw.cz>
Sun, 26 Dec 2021 21:51:59 +0000 (22:51 +0100)
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

index 0ce56f6ce5e1ec85072dbe2e3cd4f1a676c2cd65..18d02881b2187d6168259adce82a07c339484159 100644 (file)
--- 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)