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
|
2008-12-03 22:24:40 +01:00
|
|
|
CFLAGS = -Os -Wall -Werror
|
2009-01-26 02:16:09 +01:00
|
|
|
LDFLAGS =
|
|
|
|
|
2007-02-06 20:47:50 +01:00
|
|
|
OS_ARCH = $(shell uname)
|
2009-01-26 02:16:09 +01:00
|
|
|
ifneq ($(OS_ARCH), SunOS)
|
2007-02-06 20:47:50 +01:00
|
|
|
STRIP_ARGS = -s
|
|
|
|
endif
|
2008-05-22 15:22:45 +02:00
|
|
|
ifeq ($(OS_ARCH), FreeBSD)
|
|
|
|
CFLAGS += -I/usr/local/include
|
|
|
|
LDFLAGS += -L/usr/local/lib
|
|
|
|
endif
|
2005-11-26 22:55:36 +01:00
|
|
|
|
2009-01-26 02:16:09 +01:00
|
|
|
LDFLAGS += -lpci -lz
|
|
|
|
|
2008-06-21 06:39:17 +02:00
|
|
|
OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \
|
2008-04-28 19:51:09 +02:00
|
|
|
sst28sf040.o am29f040b.o mx29f002.o sst39sf020.o m29f400bt.o \
|
2008-09-26 15:19:02 +02:00
|
|
|
w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o \
|
2009-01-26 02:10:48 +01:00
|
|
|
sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \
|
2008-05-16 14:55:55 +02:00
|
|
|
flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \
|
2008-11-28 22:36:51 +01:00
|
|
|
ichspi.o w39v040c.o sb600spi.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:
|
2008-07-02 05:03:58 +02:00
|
|
|
rm -f $(PROGRAM) *.o
|
2005-11-26 22:55:36 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2008-06-22 04:00:39 +02:00
|
|
|
rm -f .dependencies
|
|
|
|
|
2005-11-26 22:55:36 +01:00
|
|
|
dep:
|
|
|
|
@$(CC) -MM *.c > .dependencies
|
|
|
|
|
2005-12-01 17:19:24 +01:00
|
|
|
pciutils:
|
2009-01-26 00:59:30 +01:00
|
|
|
@echo; printf "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)
|
2008-06-22 04:00:39 +02:00
|
|
|
$(INSTALL) $(PROGRAM) $(PREFIX)/sbin
|
2007-10-17 01:36:34 +02:00
|
|
|
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
|