correctly mark code segments as code in SELF
[coreboot.git] / util / k8resdump / Makefile
1 ##
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
17 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18 ##
19
20 PROGRAM = k8resdump
21
22 CC      = gcc
23 STRIP   = strip
24 INSTALL = /usr/bin/install
25 PREFIX  = /usr/local
26 #CFLAGS  = -O2 -g -Wall -Werror
27 CFLAGS  = -Os -Wall -Werror
28 OS_ARCH = $(shell uname)
29 ifeq ($(OS_ARCH), SunOS)
30 LDFLAGS = -lpci
31 else
32 LDFLAGS = -lpci -lz -static
33 STRIP_ARGS = -s
34 endif
35
36 OBJS = k8resdump.o
37
38 all: pciutils dep $(PROGRAM)
39
40 $(PROGRAM): $(OBJS)
41         $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
42         $(STRIP) $(STRIP_ARGS) $(PROGRAM)
43
44 clean:
45         rm -f *.o *~
46
47 distclean: clean
48         rm -f $(PROGRAM) .dependencies
49
50 dep:
51         @$(CC) -MM *.c > .dependencies
52
53 pciutils:
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