blob: 944dbe6cf7c917fc943ac1baa30aedada00fcdaf [file] [log] [blame]
Rudolf Marekf32325e2007-10-30 01:12:20 +00001#
2# Makefile for k8redump utility
Stefan Reinauer14e22772010-04-27 06:56:47 +00003#
Rudolf Marekf32325e2007-10-30 01:12:20 +00004# Original from Stefan Reinauer <stepan@openbios.org>
5#
6
7PROGRAM = k8resdump
8
9CC = gcc
10STRIP = strip
11INSTALL = /usr/bin/install
12PREFIX = /usr/local
13#CFLAGS = -O2 -g -Wall -Werror
14CFLAGS = -Os -Wall -Werror
15OS_ARCH = $(shell uname)
16ifeq ($(OS_ARCH), SunOS)
Stefan Reinauer14e22772010-04-27 06:56:47 +000017LDFLAGS = -lpci
Rudolf Marekf32325e2007-10-30 01:12:20 +000018else
Stefan Reinauer14e22772010-04-27 06:56:47 +000019LDFLAGS = -lpci -lz -static
Rudolf Marekf32325e2007-10-30 01:12:20 +000020STRIP_ARGS = -s
21endif
22
23OBJS = k8resdump.o
24
25all: pciutils dep $(PROGRAM)
26
27$(PROGRAM): $(OBJS)
28 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
29 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
30
31clean:
32 rm -f *.o *~
33
34distclean: clean
35 rm -f $(PROGRAM) .dependencies
Stefan Reinauer14e22772010-04-27 06:56:47 +000036
Rudolf Marekf32325e2007-10-30 01:12:20 +000037dep:
38 @$(CC) -MM *.c > .dependencies
39
40pciutils:
41 @echo; echo -n "Checking for pciutils and zlib... "
42 @$(shell ( echo "#include <pci/pci.h>"; \
43 echo "struct pci_access *pacc;"; \
44 echo "int main(int argc, char **argv)"; \
45 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
46 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
47 echo "found." || ( echo "not found."; echo; \
48 echo "Please install pciutils-devel and zlib-devel."; \
49 echo "See README for more information."; echo; \
50 rm -f .test.c .test; exit 1)
51 @rm -f .test.c .test
52
53.PHONY: all clean distclean dep pciutils
54
55-include .dependencies
56