Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 1 | # |
| 2 | # Makefile for flash_rom |
| 3 | # |
| 4 | # redone by Stefan Reinauer <stepan@openbios.org> |
| 5 | # |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 6 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 7 | PROGRAM = flashrom |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 8 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 9 | CC = gcc |
| 10 | STRIP = strip |
Uwe Hermann | c113b57 | 2006-12-14 00:59:41 +0000 | [diff] [blame] | 11 | INSTALL = /usr/bin/install |
| 12 | PREFIX = /usr/local |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 13 | #CFLAGS = -O2 -g -Wall -Werror |
Stefan Reinauer | 8cf74b4 | 2006-03-19 22:30:42 +0000 | [diff] [blame] | 14 | CFLAGS = -Os -Wall -Werror -DDISABLE_DOC # -DTS5300 |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 15 | OS_ARCH = $(shell uname) |
| 16 | ifeq ($(OS_ARCH), SunOS) |
| 17 | LDFLAGS = -lpci -lz |
| 18 | else |
Giampiero Giancipoli | 8c5299f | 2006-11-22 00:29:51 +0000 | [diff] [blame] | 19 | LDFLAGS = -lpci -lz -static |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 20 | STRIP_ARGS = -s |
| 21 | endif |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 22 | |
| 23 | OBJS = 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 Lu | ca78297 | 2007-01-22 20:21:17 +0000 | [diff] [blame] | 25 | sst49lf040.o sst49lfxxxc.o sst_fwhub.o layout.o lbtable.o \ |
| 26 | flashchips.o flash_rom.o sharplhf00l04.o |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 27 | |
Stefan Reinauer | 53e9625 | 2005-12-01 16:19:24 +0000 | [diff] [blame] | 28 | all: pciutils dep $(PROGRAM) |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 29 | |
| 30 | $(PROGRAM): $(OBJS) |
| 31 | $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 32 | $(STRIP) $(STRIP_ARGS) $(PROGRAM) |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 33 | |
| 34 | clean: |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 35 | rm -f *.o *~ |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 36 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 37 | distclean: clean |
| 38 | rm -f $(PROGRAM) .dependencies |
| 39 | |
| 40 | dep: |
| 41 | @$(CC) -MM *.c > .dependencies |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 42 | |
Stefan Reinauer | 53e9625 | 2005-12-01 16:19:24 +0000 | [diff] [blame] | 43 | pciutils: |
| 44 | @echo; echo -n "Checking for pciutils... " |
| 45 | @$(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; \ |
| 51 | echo "Please install pciutils and pciutils-devel."; \ |
| 52 | echo "See README for more information."; echo; \ |
| 53 | rm -f .test.c .test; exit 1) |
| 54 | @rm -f .test.c .test |
| 55 | |
Uwe Hermann | c113b57 | 2006-12-14 00:59:41 +0000 | [diff] [blame] | 56 | install: $(PROGRAM) |
| 57 | $(INSTALL) flashrom $(PREFIX)/bin |
| 58 | |
Stefan Reinauer | 53e9625 | 2005-12-01 16:19:24 +0000 | [diff] [blame] | 59 | .PHONY: all clean distclean dep pciutils |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 60 | |
| 61 | -include .dependencies |
| 62 | |