inteltool/Makefile: Separate CPPFLAGS from CFLAGS

Separate the required CPPFLAGS from environment overridable CFLAGS.

Change-Id: I0c1c0a1cebc7f7971634bf57d4a2370939c43fda
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/20175
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Hannah Williams <hannah.williams@intel.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Nico Huber 2017-06-13 12:51:54 +02:00 committed by Patrick Georgi
parent be3aa04f21
commit cce508fed2
1 changed files with 10 additions and 7 deletions

View File

@ -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,7 +79,8 @@ 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 && \
@$(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"; \