southbridge/ricoh,ti: Remove trailing whitespace in debug output
[coreboot.git] / util / viatool / Makefile
blob5124a73dc3bc6cad1853d327ca07c2fe17fc1413
2 # Makefile for viatool utility
4 # Copyright (C) 2008 by coresystems GmbH
5 # written by Stefan Reinauer <stepan@coresystems.de>
6 # Copyright (C) 2013 Alexandru Gagniuc
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 PROGRAM = viatool
25 CC ?= gcc
26 INSTALL ?= /usr/bin/install
27 PREFIX ?= /usr/local
28 CFLAGS ?= -O2 -g -Wall -W -I$(shell pwd)
29 LDFLAGS += -lpci -lz
31 SRCS = viatool.c \
32 cpu.c \
33 quirks/quirks.c \
34 quirks/vx900_quirks.c
36 OBJS = $(sort ${SRCS:.c=.o})
38 OS_ARCH = $(shell uname)
39 ifeq ($(OS_ARCH), Darwin)
40 LDFLAGS += -framework DirectHW
41 endif
42 ifeq ($(OS_ARCH), FreeBSD)
43 CFLAGS += -I/usr/local/include
44 LDFLAGS += -L/usr/local/lib
45 LIBS = -lz
46 endif
48 all: pciutils dep $(PROGRAM)
50 $(PROGRAM): $(OBJS)
51 $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
53 clean:
54 # Remove build results
55 rm -f $(PROGRAM) $(OBJS)
56 # Remove backup files created by some editors
57 find ./ |grep *~ |xargs rm -f
59 distclean: clean
60 rm -f .dependencies
62 dep:
63 @$(CC) $(CFLAGS) -MM *.c > .dependencies
65 define LIBPCI_TEST
66 /* Avoid a failing test due to libpci header symbol shadowing breakage */
67 #define index shadow_workaround_index
68 #include <pci/pci.h>
69 struct pci_access *pacc;
70 int main(int argc, char **argv)
72 (void) argc;
73 (void) argv;
74 pacc = pci_alloc();
75 return 0;
77 endef
78 export LIBPCI_TEST
80 pciutils:
81 @printf "\nChecking for pciutils and zlib... "
82 @echo "$$LIBPCI_TEST" > .test.c
83 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) >/dev/null 2>&1 && \
84 printf "found.\n" || ( printf "not found.\n\n"; \
85 printf "Please install pciutils-devel and zlib-devel.\n"; \
86 printf "See README for more information.\n\n"; \
87 rm -f .test.c .test; exit 1)
88 @rm -rf .test.c .test .test.dSYM
90 install: $(PROGRAM)
91 mkdir -p $(DESTDIR)$(PREFIX)/sbin
92 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
93 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
94 $(INSTALL) $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
96 .PHONY: all clean distclean dep pciutils
98 -include .dependencies