blob: 784786172309dcfe5ba3f9047219d8136c738ae6 [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##
Rudolf Marekf32325e2007-10-30 01:12:20 +000015
16PROGRAM = k8resdump
17
18CC = gcc
19STRIP = strip
20INSTALL = /usr/bin/install
21PREFIX = /usr/local
22#CFLAGS = -O2 -g -Wall -Werror
23CFLAGS = -Os -Wall -Werror
24OS_ARCH = $(shell uname)
25ifeq ($(OS_ARCH), SunOS)
Stefan Reinauer14e22772010-04-27 06:56:47 +000026LDFLAGS = -lpci
Rudolf Marekf32325e2007-10-30 01:12:20 +000027else
Stefan Reinauer14e22772010-04-27 06:56:47 +000028LDFLAGS = -lpci -lz -static
Rudolf Marekf32325e2007-10-30 01:12:20 +000029STRIP_ARGS = -s
30endif
31
32OBJS = k8resdump.o
33
34all: pciutils dep $(PROGRAM)
35
36$(PROGRAM): $(OBJS)
37 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
38 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
39
40clean:
41 rm -f *.o *~
42
43distclean: clean
44 rm -f $(PROGRAM) .dependencies
Stefan Reinauer14e22772010-04-27 06:56:47 +000045
Rudolf Marekf32325e2007-10-30 01:12:20 +000046dep:
47 @$(CC) -MM *.c > .dependencies
48
49pciutils:
50 @echo; echo -n "Checking for pciutils and zlib... "
51 @$(shell ( echo "#include <pci/pci.h>"; \
52 echo "struct pci_access *pacc;"; \
53 echo "int main(int argc, char **argv)"; \
54 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
55 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
56 echo "found." || ( echo "not found."; echo; \
57 echo "Please install pciutils-devel and zlib-devel."; \
58 echo "See README for more information."; echo; \
59 rm -f .test.c .test; exit 1)
60 @rm -f .test.c .test
61
62.PHONY: all clean distclean dep pciutils
63
64-include .dependencies