diff --git a/util/inteltool/Makefile b/util/inteltool/Makefile index b51f5a2ad8..e36560d6e1 100644 --- a/util/inteltool/Makefile +++ b/util/inteltool/Makefile @@ -22,9 +22,11 @@ top ?= $(abspath ../..) CC ?= gcc INSTALL ?= /usr/bin/install PREFIX ?= /usr/local -CFLAGS ?= -O2 -g -Wall -W -I$(top)/src/commonlib/include +CFLAGS ?= -O2 -g -Wall -W LDFLAGS += -lpci -lz +CPPFLAGS += -I$(top)/src/commonlib/include + OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o amb.o ivy_memory.o spi.o gfx.o ahci.o OS_ARCH = $(shell uname) @@ -32,19 +34,19 @@ ifeq ($(OS_ARCH), Darwin) LDFLAGS += -framework DirectHW endif ifeq ($(OS_ARCH), FreeBSD) -CFLAGS += -I/usr/local/include +CPPFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib LIBS = -lz endif ifeq ($(OS_ARCH), NetBSD) -CFLAGS += -I/usr/pkg/include +CPPFLAGS += -I/usr/pkg/include LDFLAGS += -L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib -lz -lpciutils -lpci -l$(shell uname -p) endif all: pciutils dep $(PROGRAM) $(PROGRAM): $(OBJS) - $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS) clean: rm -f $(PROGRAM) *.o *~ junit.xml @@ -53,7 +55,7 @@ distclean: clean rm -f .dependencies dep: - @$(CC) $(CFLAGS) -MM *.c > .dependencies + @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies define LIBPCI_TEST /* Avoid a failing test due to libpci header symbol shadowing breakage */ @@ -77,8 +79,9 @@ export LIBPCI_TEST pciutils: @printf "\nChecking for pciutils and zlib... " @echo "$$LIBPCI_TEST" > .test.c - @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) >/dev/null 2>&1 && \ - printf "found.\n" || ( printf "not found.\n\n"; \ + @$(CC) $(CFLAGS) $(CPPFLAGS) .test.c -o .test $(LDFLAGS) \ + >/dev/null 2>&1 && \ + printf "found.\n" || ( printf "not found.\n\n"; \ printf "Please install pciutils-devel and zlib-devel.\n"; \ printf "See README for more information.\n\n"; \ rm -f .test.c .test; exit 1)