Stefan Reinauer | 03646be | 2008-05-13 22:14:21 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for inteltool utility |
| 3 | # |
| 4 | # Copyright (C) 2008 by coresystems GmbH |
| 5 | # written by Stefan Reinauer <stepan@coresystems.de> |
| 6 | # |
| 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. |
| 11 | # |
| 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. |
| 16 | # |
| 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. |
| 20 | # |
| 21 | |
| 22 | PROGRAM = inteltool |
| 23 | |
| 24 | CC = gcc |
| 25 | INSTALL = /usr/bin/install |
| 26 | PREFIX = /usr/local |
| 27 | CFLAGS = -O2 -g -Wall -W |
| 28 | LDFLAGS = -lpci -lz |
| 29 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame^] | 30 | OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o |
Stefan Reinauer | 03646be | 2008-05-13 22:14:21 +0000 | [diff] [blame] | 31 | |
| 32 | all: pciutils dep $(PROGRAM) |
| 33 | |
| 34 | $(PROGRAM): $(OBJS) |
| 35 | $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) |
| 36 | |
| 37 | clean: |
Stefan Reinauer | 8b83597 | 2008-06-22 17:15:03 +0000 | [diff] [blame] | 38 | rm -f $(PROGRAM) *.o *~ |
Stefan Reinauer | 03646be | 2008-05-13 22:14:21 +0000 | [diff] [blame] | 39 | |
| 40 | distclean: clean |
Stefan Reinauer | 8b83597 | 2008-06-22 17:15:03 +0000 | [diff] [blame] | 41 | rm -f .dependencies |
Uwe Hermann | 9a6b6b5 | 2008-05-14 21:20:55 +0000 | [diff] [blame] | 42 | |
Stefan Reinauer | 03646be | 2008-05-13 22:14:21 +0000 | [diff] [blame] | 43 | dep: |
| 44 | @$(CC) -MM *.c > .dependencies |
| 45 | |
| 46 | pciutils: |
| 47 | @echo; echo -n "Checking for pciutils and zlib... " |
| 48 | @$(shell ( echo "#include <pci/pci.h>"; \ |
| 49 | echo "struct pci_access *pacc;"; \ |
| 50 | echo "int main(int argc, char **argv)"; \ |
| 51 | echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c ) |
| 52 | @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \ |
| 53 | echo "found." || ( echo "not found."; echo; \ |
| 54 | echo "Please install pciutils-devel and zlib-devel."; \ |
| 55 | echo "See README for more information."; echo; \ |
| 56 | rm -f .test.c .test; exit 1) |
| 57 | @rm -f .test.c .test |
| 58 | |
| 59 | install: $(PROGRAM) |
| 60 | $(INSTALL) $(PROGRAM) $(PREFIX)/sbin |
| 61 | mkdir -p $(PREFIX)/share/man/man8 |
| 62 | $(INSTALL) $(PROGRAM).8 $(PREFIX)/share/man/man8 |
| 63 | |
| 64 | .PHONY: all clean distclean dep pciutils |
| 65 | |
| 66 | -include .dependencies |
| 67 | |