soc/intel/common/block/itss: Route PCI INT pin to PIRQ using PIR
[coreboot2.git] / util / inteltool / Makefile
blobe6e122bc4500b1488f9e88670190841202466e4a
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 PROGRAM = inteltool
5 top ?= $(abspath ../..)
7 CC ?= gcc
8 INSTALL ?= /usr/bin/env install
9 PREFIX ?= /usr/local
10 CFLAGS ?= -O2 -g -Wall -Wextra -Wmissing-prototypes
11 LDFLAGS += -lpci -lz
13 CPPFLAGS += -I$(top)/util/inteltool
14 CPPFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include
15 CPPFLAGS += -I$(top)/src/arch/x86/include
18 OBJS = inteltool.o pcr.o cpu.o gpio.o gpio_groups.o rootcmplx.o powermgt.o \
19 memory.o pcie.o amb.o ivy_memory.o spi.o gfx.o ahci.o lpc.o iobp.o
21 OS_ARCH = $(shell uname)
22 ifeq ($(OS_ARCH), Darwin)
23 LDFLAGS += -framework DirectHW
24 endif
25 ifeq ($(OS_ARCH), FreeBSD)
26 CPPFLAGS += -I/usr/local/include
27 LDFLAGS += -L/usr/local/lib
28 LIBS = -lz
29 endif
30 ifeq ($(OS_ARCH), NetBSD)
31 CPPFLAGS += -I/usr/pkg/include
32 LDFLAGS += -L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib -lz -lpciutils -lpci -l$(shell uname -p)
33 endif
35 all: pciutils dep $(PROGRAM)
37 $(PROGRAM): $(OBJS)
38 $(CC) $(CFLAGS) $(CPPFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
40 clean:
41 rm -f $(PROGRAM) *.o *~ junit.xml .dependencies
43 distclean: clean
44 rm -f .dependencies
46 dep:
47 @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies
49 define LIBPCI_TEST
50 /* Avoid a failing test due to libpci header symbol shadowing breakage */
51 #define index shadow_workaround_index
52 #ifdef __NetBSD__
53 #include <pciutils/pci.h>
54 #else
55 #include <pci/pci.h>
56 #endif
57 struct pci_access *pacc;
58 int main(int argc, char **argv)
60 (void) argc;
61 (void) argv;
62 pacc = pci_alloc();
63 return 0;
65 endef
66 export LIBPCI_TEST
68 pciutils:
69 @printf "\nChecking for pciutils and zlib... "
70 @echo "$$LIBPCI_TEST" > .test.c
71 @$(CC) $(CFLAGS) $(CPPFLAGS) .test.c -o .test $(LDFLAGS) \
72 >/dev/null 2>&1 && \
73 printf "found.\n" || ( printf "not found.\n\n"; \
74 printf "Please install pciutils-devel and zlib-devel.\n"; \
75 printf "See README for more information.\n\n"; \
76 rm -f .test.c .test; exit 1)
77 @rm -rf .test.c .test .test.dSYM
79 install: $(PROGRAM)
80 $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin
81 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
82 $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/man/man8
83 $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
85 .PHONY: all clean distclean dep pciutils
87 -include .dependencies