blob: debbe9bcde40e71dc87f95e6d08d7ab5dda9b8ae [file] [log] [blame]
Ollie Lho184a4042005-11-26 21:55:36 +00001#
2# Makefile for flash_rom
3#
4# redone by Stefan Reinauer <stepan@openbios.org>
5#
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +00006
Ollie Lho184a4042005-11-26 21:55:36 +00007PROGRAM = flashrom
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +00008
Ollie Lho184a4042005-11-26 21:55:36 +00009CC = gcc
10STRIP = strip
Uwe Hermannc113b572006-12-14 00:59:41 +000011INSTALL = /usr/bin/install
12PREFIX = /usr/local
Ollie Lho184a4042005-11-26 21:55:36 +000013#CFLAGS = -O2 -g -Wall -Werror
Stefan Reinauer8cf74b42006-03-19 22:30:42 +000014CFLAGS = -Os -Wall -Werror -DDISABLE_DOC # -DTS5300
Giampiero Giancipoli8c5299f2006-11-22 00:29:51 +000015LDFLAGS = -lpci -lz -static
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000016
Ollie Lho184a4042005-11-26 21:55:36 +000017
18OBJS = 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 \
Yinghai Luca782972007-01-22 20:21:17 +000020 sst49lf040.o sst49lfxxxc.o sst_fwhub.o layout.o lbtable.o \
21 flashchips.o flash_rom.o sharplhf00l04.o
Ollie Lho184a4042005-11-26 21:55:36 +000022
Stefan Reinauer53e96252005-12-01 16:19:24 +000023all: pciutils dep $(PROGRAM)
Ollie Lho184a4042005-11-26 21:55:36 +000024
25$(PROGRAM): $(OBJS)
26 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
27 $(STRIP) -s $(PROGRAM)
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000028
29clean:
Ollie Lho184a4042005-11-26 21:55:36 +000030 rm -f *.o *~
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000031
Ollie Lho184a4042005-11-26 21:55:36 +000032distclean: clean
33 rm -f $(PROGRAM) .dependencies
34
35dep:
36 @$(CC) -MM *.c > .dependencies
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000037
Stefan Reinauer53e96252005-12-01 16:19:24 +000038pciutils:
39 @echo; echo -n "Checking for pciutils... "
40 @$(shell ( echo "#include <pci/pci.h>"; \
41 echo "struct pci_access *pacc;"; \
42 echo "int main(int argc, char **argv)"; \
43 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
44 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
45 echo "found." || ( echo "not found."; echo; \
46 echo "Please install pciutils and pciutils-devel."; \
47 echo "See README for more information."; echo; \
48 rm -f .test.c .test; exit 1)
49 @rm -f .test.c .test
50
Uwe Hermannc113b572006-12-14 00:59:41 +000051install: $(PROGRAM)
52 $(INSTALL) flashrom $(PREFIX)/bin
53
Stefan Reinauer53e96252005-12-01 16:19:24 +000054.PHONY: all clean distclean dep pciutils
Ollie Lho184a4042005-11-26 21:55:36 +000055
56-include .dependencies
57