2 ## Makefile for k8resdump utility
4 ## (C) 2005 coresystems GmbH
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.
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.
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
24 INSTALL = /usr/bin/install
26 #CFLAGS = -O2 -g -Wall -Werror
27 CFLAGS = -Os -Wall -Werror
28 OS_ARCH = $(shell uname)
29 ifeq ($(OS_ARCH), SunOS)
32 LDFLAGS = -lpci -lz -static
38 all: pciutils dep $(PROGRAM)
41 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
42 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
48 rm -f $(PROGRAM) .dependencies
51 @$(CC) -MM *.c > .dependencies
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)
66 .PHONY: all clean distclean dep pciutils
68 -include .dependencies