2 # Makefile for inteltool utility
4 # Copyright (C) 2008 by coresystems GmbH
5 # written by Stefan Reinauer <stepan@coresystems.de>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 INSTALL = /usr/bin/install
27 CFLAGS = -O2 -g -Wall -W
30 OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o
32 OS_ARCH = $(shell uname)
33 ifeq ($(OS_ARCH), Darwin)
34 LDFLAGS = -framework DirectIO -lpci -lz
37 all: pciutils dep $(PROGRAM)
40 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
43 rm -f $(PROGRAM) *.o *~
49 @$(CC) $(CFLAGS) -MM *.c > .dependencies
52 @printf "\nChecking for pciutils and zlib... "
53 @$(shell ( printf "#include <pci/pci.h>\n"; \
54 printf "struct pci_access *pacc;\n"; \
55 printf "int main(int argc, char **argv)\n"; \
56 printf "{ pacc = pci_alloc(); return 0; }\n"; ) > .test.c )
57 @$(CC) $(CFLAGS) $(LDFLAGS) .test.c -o .test &>/dev/null && \
58 printf "found.\n" || ( printf "not found.\n\n"; \
59 printf "Please install pciutils-devel and zlib-devel.\n"; \
60 printf "See README for more information.\n\n"; \
61 rm -f .test.c .test; exit 1)
62 @rm -rf .test.c .test .test.dSYM
65 mkdir -p $(DESTDIR)$(PREFIX)/sbin
66 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
67 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
68 $(INSTALL) $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
70 .PHONY: all clean distclean dep pciutils
72 -include .dependencies