blob: a6b389f27d543cf2f9e724ce9776606bb369d808 [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
Adam Kaufman064b1f22007-02-06 19:47:50 +000015OS_ARCH = $(shell uname)
16ifeq ($(OS_ARCH), SunOS)
17LDFLAGS = -lpci -lz
18else
Giampiero Giancipoli8c5299f2006-11-22 00:29:51 +000019LDFLAGS = -lpci -lz -static
Adam Kaufman064b1f22007-02-06 19:47:50 +000020STRIP_ARGS = -s
21endif
Ollie Lho184a4042005-11-26 21:55:36 +000022
23OBJS = flash_enable.o udelay.o jedec.o sst28sf040.o am29f040b.o mx29f002.o \
24 sst39sf020.o m29f400bt.o w49f002u.o 82802ab.o msys_doc.o pm49fl004.o \
Yinghai Luca782972007-01-22 20:21:17 +000025 sst49lf040.o sst49lfxxxc.o sst_fwhub.o layout.o lbtable.o \
26 flashchips.o flash_rom.o sharplhf00l04.o
Ollie Lho184a4042005-11-26 21:55:36 +000027
Stefan Reinauer53e96252005-12-01 16:19:24 +000028all: pciutils dep $(PROGRAM)
Ollie Lho184a4042005-11-26 21:55:36 +000029
30$(PROGRAM): $(OBJS)
31 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
Adam Kaufman064b1f22007-02-06 19:47:50 +000032 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000033
34clean:
Ollie Lho184a4042005-11-26 21:55:36 +000035 rm -f *.o *~
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000036
Ollie Lho184a4042005-11-26 21:55:36 +000037distclean: clean
38 rm -f $(PROGRAM) .dependencies
39
40dep:
41 @$(CC) -MM *.c > .dependencies
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000042
Stefan Reinauer53e96252005-12-01 16:19:24 +000043pciutils:
Ed Swierke871d1f2007-02-16 14:36:12 +000044 @echo; echo -n "Checking for pciutils and zlib... "
Stefan Reinauer53e96252005-12-01 16:19:24 +000045 @$(shell ( echo "#include <pci/pci.h>"; \
46 echo "struct pci_access *pacc;"; \
47 echo "int main(int argc, char **argv)"; \
48 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
49 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
50 echo "found." || ( echo "not found."; echo; \
Ed Swierke871d1f2007-02-16 14:36:12 +000051 echo "Please install pciutils-devel and zlib-devel."; \
Stefan Reinauer53e96252005-12-01 16:19:24 +000052 echo "See README for more information."; echo; \
53 rm -f .test.c .test; exit 1)
54 @rm -f .test.c .test
55
Uwe Hermannc113b572006-12-14 00:59:41 +000056install: $(PROGRAM)
57 $(INSTALL) flashrom $(PREFIX)/bin
58
Stefan Reinauer53e96252005-12-01 16:19:24 +000059.PHONY: all clean distclean dep pciutils
Ollie Lho184a4042005-11-26 21:55:36 +000060
61-include .dependencies
62