Rudolf Marek | f32325e | 2007-10-30 01:12:20 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for k8redump utility |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 3 | # |
Rudolf Marek | f32325e | 2007-10-30 01:12:20 +0000 | [diff] [blame] | 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) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 17 | LDFLAGS = -lpci |
Rudolf Marek | f32325e | 2007-10-30 01:12:20 +0000 | [diff] [blame] | 18 | else |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 19 | LDFLAGS = -lpci -lz -static |
Rudolf Marek | f32325e | 2007-10-30 01:12:20 +0000 | [diff] [blame] | 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 |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 36 | |
Rudolf Marek | f32325e | 2007-10-30 01:12:20 +0000 | [diff] [blame] | 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 | |