blob: e69164fe1de3c528c108a7a8585970e52901bb62 [file] [log] [blame]
Stefan Reinauer6559f432010-12-17 00:13:54 +00001##
2## Makefile for k8resdump utility
3##
4## (C) 2005 coresystems GmbH
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; version 2 of the License.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010017## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer6559f432010-12-17 00:13:54 +000018##
Rudolf Marekf32325e2007-10-30 01:12:20 +000019
20PROGRAM = k8resdump
21
22CC = gcc
23STRIP = strip
24INSTALL = /usr/bin/install
25PREFIX = /usr/local
26#CFLAGS = -O2 -g -Wall -Werror
27CFLAGS = -Os -Wall -Werror
28OS_ARCH = $(shell uname)
29ifeq ($(OS_ARCH), SunOS)
Stefan Reinauer14e22772010-04-27 06:56:47 +000030LDFLAGS = -lpci
Rudolf Marekf32325e2007-10-30 01:12:20 +000031else
Stefan Reinauer14e22772010-04-27 06:56:47 +000032LDFLAGS = -lpci -lz -static
Rudolf Marekf32325e2007-10-30 01:12:20 +000033STRIP_ARGS = -s
34endif
35
36OBJS = k8resdump.o
37
38all: pciutils dep $(PROGRAM)
39
40$(PROGRAM): $(OBJS)
41 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
42 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
43
44clean:
45 rm -f *.o *~
46
47distclean: clean
48 rm -f $(PROGRAM) .dependencies
Stefan Reinauer14e22772010-04-27 06:56:47 +000049
Rudolf Marekf32325e2007-10-30 01:12:20 +000050dep:
51 @$(CC) -MM *.c > .dependencies
52
53pciutils:
54 @echo; echo -n "Checking for pciutils and zlib... "
55 @$(shell ( echo "#include <pci/pci.h>"; \
56 echo "struct pci_access *pacc;"; \
57 echo "int main(int argc, char **argv)"; \
58 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
59 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
60 echo "found." || ( echo "not found."; echo; \
61 echo "Please install pciutils-devel and zlib-devel."; \
62 echo "See README for more information."; echo; \
63 rm -f .test.c .test; exit 1)
64 @rm -f .test.c .test
65
66.PHONY: all clean distclean dep pciutils
67
68-include .dependencies
69