2005-11-26 22:55:36 +01:00
|
|
|
#
|
2007-04-12 01:31:45 +02:00
|
|
|
# Makefile for flashrom utility
|
2005-11-26 22:55:36 +01:00
|
|
|
#
|
|
|
|
# redone by Stefan Reinauer <stepan@openbios.org>
|
|
|
|
#
|
2003-10-25 19:01:29 +02:00
|
|
|
|
2005-11-26 22:55:36 +01:00
|
|
|
PROGRAM = flashrom
|
2003-10-25 19:01:29 +02:00
|
|
|
|
2005-11-26 22:55:36 +01:00
|
|
|
CC = gcc
|
|
|
|
STRIP = strip
|
2006-12-14 01:59:41 +01:00
|
|
|
INSTALL = /usr/bin/install
|
|
|
|
PREFIX = /usr/local
|
2005-11-26 22:55:36 +01:00
|
|
|
#CFLAGS = -O2 -g -Wall -Werror
|
2006-03-19 23:30:42 +01:00
|
|
|
CFLAGS = -Os -Wall -Werror -DDISABLE_DOC # -DTS5300
|
2007-02-06 20:47:50 +01:00
|
|
|
OS_ARCH = $(shell uname)
|
|
|
|
ifeq ($(OS_ARCH), SunOS)
|
|
|
|
LDFLAGS = -lpci -lz
|
|
|
|
else
|
2008-04-28 19:51:09 +02:00
|
|
|
LDFLAGS = -lpci -lz
|
2007-02-06 20:47:50 +01:00
|
|
|
STRIP_ARGS = -s
|
|
|
|
endif
|
2005-11-26 22:55:36 +01:00
|
|
|
|
2008-04-28 19:51:09 +02:00
|
|
|
OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.c \
|
|
|
|
sst28sf040.o am29f040b.o mx29f002.o sst39sf020.o m29f400bt.o \
|
|
|
|
w49f002u.o 82802ab.o msys_doc.o pm49fl004.o sst49lf040.o \
|
|
|
|
sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o \
|
2008-05-14 01:03:12 +02:00
|
|
|
flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o
|
2005-11-26 22:55:36 +01:00
|
|
|
|
2005-12-01 17:19:24 +01:00
|
|
|
all: pciutils dep $(PROGRAM)
|
2005-11-26 22:55:36 +01:00
|
|
|
|
2008-01-21 16:24:22 +01:00
|
|
|
# Set the flashrom version string from the highest revision number
|
|
|
|
# of the checked out flashrom files.
|
|
|
|
SVNDEF := -D'FLASHROM_VERSION="$(shell svnversion -cn . \
|
|
|
|
| sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
|
|
|
|
|
2005-11-26 22:55:36 +01:00
|
|
|
$(PROGRAM): $(OBJS)
|
|
|
|
$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
|
2007-02-06 20:47:50 +01:00
|
|
|
$(STRIP) $(STRIP_ARGS) $(PROGRAM)
|
2003-10-25 19:01:29 +02:00
|
|
|
|
2008-02-15 00:22:20 +01:00
|
|
|
flashrom.o: flashrom.c
|
|
|
|
$(CC) -c $(CFLAGS) $(SVNDEF) $(CPPFLAGS) $< -o $@
|
|
|
|
|
2003-10-25 19:01:29 +02:00
|
|
|
clean:
|
2005-11-26 22:55:36 +01:00
|
|
|
rm -f *.o *~
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f $(PROGRAM) .dependencies
|
|
|
|
|
|
|
|
dep:
|
|
|
|
@$(CC) -MM *.c > .dependencies
|
|
|
|
|
2005-12-01 17:19:24 +01:00
|
|
|
pciutils:
|
2007-02-16 15:36:12 +01:00
|
|
|
@echo; echo -n "Checking for pciutils and zlib... "
|
2005-12-01 17:19:24 +01:00
|
|
|
@$(shell ( echo "#include <pci/pci.h>"; \
|
|
|
|
echo "struct pci_access *pacc;"; \
|
|
|
|
echo "int main(int argc, char **argv)"; \
|
|
|
|
echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )
|
|
|
|
@$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \
|
|
|
|
echo "found." || ( echo "not found."; echo; \
|
2007-02-16 15:36:12 +01:00
|
|
|
echo "Please install pciutils-devel and zlib-devel."; \
|
2005-12-01 17:19:24 +01:00
|
|
|
echo "See README for more information."; echo; \
|
|
|
|
rm -f .test.c .test; exit 1)
|
|
|
|
@rm -f .test.c .test
|
|
|
|
|
2006-12-14 01:59:41 +01:00
|
|
|
install: $(PROGRAM)
|
2007-10-17 01:36:34 +02:00
|
|
|
$(INSTALL) flashrom $(PREFIX)/sbin
|
|
|
|
mkdir -p $(PREFIX)/share/man/man8
|
|
|
|
$(INSTALL) $(PROGRAM).8 $(PREFIX)/share/man/man8
|
2006-12-14 01:59:41 +01:00
|
|
|
|
2005-12-01 17:19:24 +01:00
|
|
|
.PHONY: all clean distclean dep pciutils
|
2005-11-26 22:55:36 +01:00
|
|
|
|
|
|
|
-include .dependencies
|
|
|
|
|