Add an install target to the flashrom Makefile which installs flashrom
[coreboot.git] / util / flashrom / Makefile
1 #
2 # Makefile for flash_rom
3
4 # redone by Stefan Reinauer <stepan@openbios.org>
5 #
6
7 PROGRAM = flashrom
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 -DDISABLE_DOC # -DTS5300
15 LDFLAGS = -lpci -lz -static 
16
17
18 OBJS  = flash_enable.o udelay.o jedec.o sst28sf040.o am29f040b.o mx29f002.o  \
19         sst39sf020.o m29f400bt.o w49f002u.o 82802ab.o msys_doc.o pm49fl004.o \
20         sst49lf040.o sst_fwhub.o layout.o lbtable.o flashchips.o flash_rom.o sharplhf00l04.o
21
22 all: pciutils dep $(PROGRAM)
23
24 $(PROGRAM): $(OBJS)
25         $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
26         $(STRIP) -s $(PROGRAM)
27
28 clean:
29         rm -f *.o *~
30
31 distclean: clean
32         rm -f $(PROGRAM) .dependencies
33         
34 dep:
35         @$(CC) -MM *.c > .dependencies
36
37 pciutils:
38         @echo; echo -n "Checking for pciutils... "
39         @$(shell ( echo "#include <pci/pci.h>";            \
40                    echo "struct pci_access *pacc;";        \
41                    echo "int main(int argc, char **argv)"; \
42                    echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
43         @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null &&     \
44                 echo "found." || ( echo "not found."; echo;             \
45                 echo "Please install pciutils and pciutils-devel.";     \
46                 echo "See README for more information."; echo;          \
47                 rm -f .test.c .test; exit 1)
48         @rm -f .test.c .test
49
50 install: $(PROGRAM)
51         $(INSTALL) flashrom $(PREFIX)/bin
52
53 .PHONY: all clean distclean dep pciutils
54
55 -include .dependencies
56