7cf039036e3ba69938fb2249fea412f0e25f3d65
[coreboot.git] / util / k8resdump / Makefile
1 #
2 # Makefile for k8redump utility
3
4 # Original from Stefan Reinauer <stepan@openbios.org>
5 #
6
7 PROGRAM = k8resdump
8
9 CC      = gcc
10 STRIP   = strip
11 INSTALL = /usr/bin/install
12 PREFIX  = /usr/local
13 #CFLAGS  = -O2 -g -Wall -Werror
14 CFLAGS  = -Os -Wall -Werror
15 OS_ARCH = $(shell uname)
16 ifeq ($(OS_ARCH), SunOS)
17 LDFLAGS = -lpci 
18 else
19 LDFLAGS = -lpci -lz -static 
20 STRIP_ARGS = -s
21 endif
22
23 OBJS = k8resdump.o
24
25 all: pciutils dep $(PROGRAM)
26
27 $(PROGRAM): $(OBJS)
28         $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
29         $(STRIP) $(STRIP_ARGS) $(PROGRAM)
30
31 clean:
32         rm -f *.o *~
33
34 distclean: clean
35         rm -f $(PROGRAM) .dependencies
36         
37 dep:
38         @$(CC) -MM *.c > .dependencies
39
40 pciutils:
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