blob: a1d4dfa682fb233f6ef85a0d1b3ea497ff528e87 [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
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +000019INSTALL = /usr/bin/env install
Rudolf Marekf32325e2007-10-30 01:12:20 +000020PREFIX = /usr/local
21#CFLAGS = -O2 -g -Wall -Werror
22CFLAGS = -Os -Wall -Werror
23OS_ARCH = $(shell uname)
24ifeq ($(OS_ARCH), SunOS)
Stefan Reinauer14e22772010-04-27 06:56:47 +000025LDFLAGS = -lpci
Rudolf Marekf32325e2007-10-30 01:12:20 +000026else
Stefan Reinauer14e22772010-04-27 06:56:47 +000027LDFLAGS = -lpci -lz -static
Rudolf Marekf32325e2007-10-30 01:12:20 +000028endif
29
30OBJS = k8resdump.o
31
32all: pciutils dep $(PROGRAM)
33
34$(PROGRAM): $(OBJS)
35 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
Rudolf Marekf32325e2007-10-30 01:12:20 +000036
37clean:
38 rm -f *.o *~
39
40distclean: clean
41 rm -f $(PROGRAM) .dependencies
Stefan Reinauer14e22772010-04-27 06:56:47 +000042
Rudolf Marekf32325e2007-10-30 01:12:20 +000043dep:
44 @$(CC) -MM *.c > .dependencies
45
46pciutils:
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.PHONY: all clean distclean dep pciutils
60
61-include .dependencies