blob: 46f3c9f5ad8cf7f91d43c261cc47a185ddbaeeb7 [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
11#CFLAGS = -O2 -g -Wall -Werror
Stefan Reinauer8cf74b42006-03-19 22:30:42 +000012CFLAGS = -Os -Wall -Werror -DDISABLE_DOC # -DTS5300
Giampiero Giancipoli8c5299f2006-11-22 00:29:51 +000013LDFLAGS = -lpci -lz -static
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000014
Ollie Lho184a4042005-11-26 21:55:36 +000015
16OBJS = flash_enable.o udelay.o jedec.o sst28sf040.o am29f040b.o mx29f002.o \
17 sst39sf020.o m29f400bt.o w49f002u.o 82802ab.o msys_doc.o pm49fl004.o \
Ronald G. Minnich5b582f22006-02-23 17:16:44 +000018 sst49lf040.o sst_fwhub.o layout.o lbtable.o flashchips.o flash_rom.o sharplhf00l04.o
Ollie Lho184a4042005-11-26 21:55:36 +000019
Stefan Reinauer53e96252005-12-01 16:19:24 +000020all: pciutils dep $(PROGRAM)
Ollie Lho184a4042005-11-26 21:55:36 +000021
22$(PROGRAM): $(OBJS)
23 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
24 $(STRIP) -s $(PROGRAM)
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000025
26clean:
Ollie Lho184a4042005-11-26 21:55:36 +000027 rm -f *.o *~
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000028
Ollie Lho184a4042005-11-26 21:55:36 +000029distclean: clean
30 rm -f $(PROGRAM) .dependencies
31
32dep:
33 @$(CC) -MM *.c > .dependencies
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000034
Stefan Reinauer53e96252005-12-01 16:19:24 +000035pciutils:
36 @echo; echo -n "Checking for pciutils... "
37 @$(shell ( echo "#include <pci/pci.h>"; \
38 echo "struct pci_access *pacc;"; \
39 echo "int main(int argc, char **argv)"; \
40 echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
41 @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
42 echo "found." || ( echo "not found."; echo; \
43 echo "Please install pciutils and pciutils-devel."; \
44 echo "See README for more information."; echo; \
45 rm -f .test.c .test; exit 1)
46 @rm -f .test.c .test
47
48.PHONY: all clean distclean dep pciutils
Ollie Lho184a4042005-11-26 21:55:36 +000049
50-include .dependencies
51