mb/google/skyrim: Disable cardbus support
[coreboot.git] / util / intelmetool / Makefile
bloba97f380d60f198c1ee988e3f93402e6273b25ccb
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 PROGRAM = intelmetool
5 CC ?= gcc
6 INSTALL ?= /usr/bin/env install
7 PREFIX ?= /usr/local
8 CFLAGS ?= -O0 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function
9 LDFLAGS += -lpci -lz
11 OBJS = intelmetool.o me.o me_status.o mmap.o rcba.o msr.o
13 OS_ARCH = $(shell uname)
14 ifeq ($(OS_ARCH), Darwin)
15 LDFLAGS += -framework DirectHW
16 endif
17 ifeq ($(OS_ARCH), FreeBSD)
18 CFLAGS += -I/usr/local/include
19 LDFLAGS += -L/usr/local/lib
20 LIBS = -lz
21 endif
22 ifeq ($(OS_ARCH), NetBSD)
23 CFLAGS += -I/usr/pkg/include
24 LDFLAGS += -L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib -lz -lpciutils -lpci -l$(shell uname -p)
25 endif
27 all: pciutils dep $(PROGRAM)
29 oldarc: CFLAGS += -DOLDARC
30 oldarc: all
32 $(PROGRAM): $(OBJS)
33 $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
35 clean:
36 rm -f $(PROGRAM) *.o *~ junit.xml
38 distclean: clean
39 rm -f .dependencies
41 dep:
42 @$(CC) $(CFLAGS) -MM *.c > .dependencies
44 define LIBPCI_TEST
45 /* Avoid a failing test due to libpci header symbol shadowing breakage */
46 #define index shadow_workaround_index
47 #ifdef __NetBSD__
48 #include <pciutils/pci.h>
49 #else
50 #include <pci/pci.h>
51 #endif
52 struct pci_access *pacc;
53 int main(int argc, char **argv)
55 (void) argc;
56 (void) argv;
57 pacc = pci_alloc();
58 return 0;
60 endef
61 export LIBPCI_TEST
63 pciutils:
64 @printf "\nChecking for development libraries: pci and zlib... "
65 @echo "$$LIBPCI_TEST" > .test.c
66 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) >/dev/null 2>&1 && \
67 printf "found.\n" || ( printf "not found.\n\n"; \
68 printf "For RPM based distributions like Fedora, please install pciutils-devel and zlib-devel.\n"; \
69 printf "For DEB based distributions, please install libpci-dev and zlib1g-dev.\n"; \
70 rm -f .test.c .test; exit 1)
71 @rm -rf .test.c .test .test.dSYM
73 install: $(PROGRAM)
74 mkdir -p $(DESTDIR)$(PREFIX)/sbin
75 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
77 .PHONY: all clean distclean dep pciutils oldarc
79 -include .dependencies