blob: 9eaf8d337e53294f8c06424478a005b56a150379 [file] [log] [blame]
Ollie Lho184a4042005-11-26 21:55:36 +00001#
Uwe Hermannf78cff12009-06-12 14:05:25 +00002# This file is part of the flashrom project.
3#
4# Copyright (C) 2005 coresystems GmbH <stepan@coresystems.de>
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +00005# Copyright (C) 2009,2010,2012 Carl-Daniel Hailfinger
Uwe Hermannf78cff12009-06-12 14:05:25 +00006#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; version 2 of the License.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Ollie Lho184a4042005-11-26 21:55:36 +000019#
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000020
Ollie Lho184a4042005-11-26 21:55:36 +000021PROGRAM = flashrom
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000022
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000023###############################################################################
24# Defaults for the toolchain.
25
26# If you want to cross-compile, just run e.g.
27# make CC=i586-pc-msdosdjgpp-gcc
28# You may have to specify STRIP/AR/RANLIB as well.
Carl-Daniel Hailfingerb7bce8a2012-08-14 21:36:11 +000029#
30# Note for anyone editing this Makefile: gnumake will happily ignore any
31# changes in this Makefile to variables set on the command line.
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +000032STRIP ?= strip
Christian Ruppertdb9d9f42009-05-14 14:17:07 +000033INSTALL = install
Paul Fox05dfbe62009-06-16 21:08:06 +000034DIFF = diff
Christian Ruppertdb9d9f42009-05-14 14:17:07 +000035PREFIX ?= /usr/local
Uwe Hermann56b2cb02009-05-21 15:59:58 +000036MANDIR ?= $(PREFIX)/share/man
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +000037CFLAGS ?= -Os -Wall -Wshadow
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +000038EXPORTDIR ?= .
Patrick Georgi97bc95c2011-03-08 07:17:44 +000039RANLIB ?= ranlib
Stefan Taunerbe62d3f2015-01-10 09:32:44 +000040
Stefan Taunerfd0d4132012-09-25 21:24:55 +000041# The following parameter changes the default programmer that will be used if there is no -p/--programmer
42# argument given when running flashrom. The predefined setting does not enable any default so that every
43# user has to declare the programmer he wants to use on every run. The rationale for this to be not set
44# (to e.g. the internal programmer) is that forgetting to specify this when working with another programmer
45# easily puts the system attached to the default programmer at risk (e.g. you want to flash coreboot to another
46# system attached to an external programmer while the default programmer is set to the internal programmer, and
47# you forget to use the -p parameter. This would (try to) overwrite the existing firmware of the computer
48# running flashrom). Please do not enable this without thinking about the possible consequences. Possible
49# values are those specified in enum programmer in programmer.h (which depend on other CONFIG_* options
50# evaluated below, namely those that enable/disable the various programmers).
51# Compilation will fail for unspecified values.
52CONFIG_DEFAULT_PROGRAMMER ?= PROGRAMMER_INVALID
Stefan Tauner265fcac2014-06-02 00:12:23 +000053# The following adds a default parameter for the default programmer set above (only).
54CONFIG_DEFAULT_PROGRAMMER_ARGS ?= ''
55# Example: compiling with
56# make CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_SERPROG CONFIG_DEFAULT_PROGRAMMER_ARGS="dev=/dev/ttyUSB0:1500000"
57# would make executing './flashrom' (almost) equivialent to './flashrom -p serprog:dev=/dev/ttyUSB0:1500000'.
Christian Ruppertdb9d9f42009-05-14 14:17:07 +000058
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000059# If your compiler spits out excessive warnings, run make WARNERROR=no
60# You shouldn't have to change this flag.
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +000061WARNERROR ?= yes
62
63ifeq ($(WARNERROR), yes)
64CFLAGS += -Werror
65endif
66
Stefan Taunere37735a2015-01-26 22:03:35 +000067ifdef LIBS_BASE
Stefan Taunerbe62d3f2015-01-10 09:32:44 +000068CPPFLAGS += -I$(LIBS_BASE)/include
Stefan Taunere37735a2015-01-26 22:03:35 +000069LDFLAGS += -L$(LIBS_BASE)/lib -Wl,-rpath -Wl,$(LIBS_BASE)/lib
70PKG_CONFIG_LIBDIR ?= $(LIBS_BASE)/lib/pkgconfig
71endif
Stefan Taunerbe62d3f2015-01-10 09:32:44 +000072
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000073###############################################################################
Stefan Tauner037cd842013-08-25 00:10:56 +000074# General OS-specific settings.
75# 1. Prepare for later by gathering information about host and target OS
76# 2. Set compiler flags and parameters according to OSes
77# 3. Likewise verify user-supplied CONFIG_* variables.
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000078
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000079# HOST_OS is only used to work around local toolchain issues.
Stefan Tauner037cd842013-08-25 00:10:56 +000080HOST_OS ?= $(shell uname)
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000081ifeq ($(HOST_OS), MINGW32_NT-5.1)
82# Explicitly set CC = gcc on MinGW, otherwise: "cc: command not found".
83CC = gcc
84endif
85ifneq ($(HOST_OS), SunOS)
Adam Kaufman064b1f22007-02-06 19:47:50 +000086STRIP_ARGS = -s
87endif
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000088
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000089# Determine the destination OS.
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000090# IMPORTANT: The following line must be placed before TARGET_OS is ever used
91# (of course), but should come after any lines setting CC because the line
92# below uses CC itself.
93override TARGET_OS := $(strip $(shell LC_ALL=C $(CC) $(CPPFLAGS) -E os.h 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
94
95ifeq ($(TARGET_OS), Darwin)
Stefan Reinauer2fea3f32010-01-21 20:26:30 +000096CPPFLAGS += -I/opt/local/include -I/usr/local/include
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000097LDFLAGS += -L/opt/local/lib -L/usr/local/lib
Stefan Reinauerf79edb92009-01-26 01:23:31 +000098endif
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000099
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000100ifeq ($(TARGET_OS), FreeBSD)
Stefan Reinauer2fea3f32010-01-21 20:26:30 +0000101CPPFLAGS += -I/usr/local/include
Andriy Gapon65c1b862008-05-22 13:22:45 +0000102LDFLAGS += -L/usr/local/lib
103endif
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000104
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000105ifeq ($(TARGET_OS), OpenBSD)
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +0000106CPPFLAGS += -I/usr/local/include
107LDFLAGS += -L/usr/local/lib
108endif
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000109
Stefan Taunerc65b8552013-09-12 15:48:39 +0000110ifeq ($(TARGET_OS), NetBSD)
111CPPFLAGS += -I/usr/pkg/include
112LDFLAGS += -L/usr/pkg/lib
113endif
114
115ifeq ($(TARGET_OS), DragonFlyBSD)
Stefan Tauner8d21ff12015-01-10 09:33:06 +0000116CPPFLAGS += -I/usr/local/include
117LDFLAGS += -L/usr/local/lib
Stefan Taunerc65b8552013-09-12 15:48:39 +0000118endif
119
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000120ifeq ($(TARGET_OS), DOS)
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000121EXEC_SUFFIX := .exe
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000122# DJGPP has odd uint*_t definitions which cause lots of format string warnings.
Carl-Daniel Hailfingerb7bce8a2012-08-14 21:36:11 +0000123CFLAGS += -Wno-format
Stefan Tauner449abe22013-09-11 23:34:57 +0000124LIBS += -lgetopt
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000125# Bus Pirate, Serprog and PonyProg are not supported under DOS (missing serial support).
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000126ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
127UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
128else
129override CONFIG_BUSPIRATE_SPI = no
130endif
131ifeq ($(CONFIG_SERPROG), yes)
132UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
133else
134override CONFIG_SERPROG = no
135endif
Stefan Taunerd94d25d2012-07-28 03:17:15 +0000136ifeq ($(CONFIG_PONY_SPI), yes)
137UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes
138else
139override CONFIG_PONY_SPI = no
140endif
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000141# Dediprog and FT2232 are not supported under DOS (missing USB support).
142ifeq ($(CONFIG_DEDIPROG), yes)
143UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
144else
145override CONFIG_DEDIPROG = no
146endif
147ifeq ($(CONFIG_FT2232_SPI), yes)
148UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
149else
150override CONFIG_FT2232_SPI = no
151endif
James Lairdc60de0e2013-03-27 13:00:23 +0000152ifeq ($(CONFIG_USBBLASTER_SPI), yes)
153UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes
154else
155override CONFIG_USBBLASTER_SPI = no
156endif
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +0000157endif
Ollie Lho184a4042005-11-26 21:55:36 +0000158
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000159# FIXME: Should we check for Cygwin/MSVC as well?
160ifeq ($(TARGET_OS), MinGW)
161EXEC_SUFFIX := .exe
Uwe Hermannd5e85d62011-07-03 19:44:12 +0000162# MinGW doesn't have the ffs() function, but we can use gcc's __builtin_ffs().
Carl-Daniel Hailfingera8da2242012-08-15 23:06:32 +0000163FLASHROM_CFLAGS += -Dffs=__builtin_ffs
Carl-Daniel Hailfinger11990da2013-07-13 23:21:05 +0000164# Some functions provided by Microsoft do not work as described in C99 specifications. This macro fixes that
165# for MinGW. See http://sourceforge.net/apps/trac/mingw-w64/wiki/printf%20and%20scanf%20family */
166FLASHROM_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
Uwe Hermannd5e85d62011-07-03 19:44:12 +0000167# libusb-win32/libftdi stuff is usually installed in /usr/local.
168CPPFLAGS += -I/usr/local/include
169LDFLAGS += -L/usr/local/lib
Uwe Hermannd5e85d62011-07-03 19:44:12 +0000170# For now we disable all PCI-based programmers on Windows/MinGW (no libpci).
171ifeq ($(CONFIG_INTERNAL), yes)
172UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
173else
174override CONFIG_INTERNAL = no
175endif
176ifeq ($(CONFIG_RAYER_SPI), yes)
177UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
178else
179override CONFIG_RAYER_SPI = no
180endif
181ifeq ($(CONFIG_NIC3COM), yes)
182UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
183else
184override CONFIG_NIC3COM = no
185endif
186ifeq ($(CONFIG_GFXNVIDIA), yes)
187UNSUPPORTED_FEATURES += CONFIG_GFXNVIDIA=yes
188else
189override CONFIG_GFXNVIDIA = no
190endif
191ifeq ($(CONFIG_SATASII), yes)
192UNSUPPORTED_FEATURES += CONFIG_SATASII=yes
193else
194override CONFIG_SATASII = no
195endif
196ifeq ($(CONFIG_ATAHPT), yes)
197UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
198else
199override CONFIG_ATAHPT = no
200endif
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000201ifeq ($(CONFIG_ATAVIA), yes)
202UNSUPPORTED_FEATURES += CONFIG_ATAVIA=yes
203else
204override CONFIG_ATAVIA = no
205endif
Kyösti Mälkki72d42f82014-06-01 23:48:31 +0000206ifeq ($(CONFIG_IT8212), yes)
207UNSUPPORTED_FEATURES += CONFIG_IT8212=yes
208else
209override CONFIG_IT8212 = no
210endif
Uwe Hermannd5e85d62011-07-03 19:44:12 +0000211ifeq ($(CONFIG_DRKAISER), yes)
212UNSUPPORTED_FEATURES += CONFIG_DRKAISER=yes
213else
214override CONFIG_DRKAISER = no
215endif
216ifeq ($(CONFIG_NICREALTEK), yes)
217UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
218else
219override CONFIG_NICREALTEK = no
220endif
221ifeq ($(CONFIG_NICNATSEMI), yes)
222UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
223else
224override CONFIG_NICNATSEMI = no
225endif
226ifeq ($(CONFIG_NICINTEL), yes)
227UNSUPPORTED_FEATURES += CONFIG_NICINTEL=yes
228else
229override CONFIG_NICINTEL = no
230endif
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000231ifeq ($(CONFIG_NICINTEL_EEPROM), yes)
232UNSUPPORTED_FEATURES += CONFIG_NICINTEL_EEPROM=yes
233else
234override CONFIG_NICINTEL_EEPROM = no
235endif
Uwe Hermannd5e85d62011-07-03 19:44:12 +0000236ifeq ($(CONFIG_NICINTEL_SPI), yes)
237UNSUPPORTED_FEATURES += CONFIG_NICINTEL_SPI=yes
238else
239override CONFIG_NICINTEL_SPI = no
240endif
241ifeq ($(CONFIG_OGP_SPI), yes)
242UNSUPPORTED_FEATURES += CONFIG_OGP_SPI=yes
243else
244override CONFIG_OGP_SPI = no
245endif
246ifeq ($(CONFIG_SATAMV), yes)
247UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
248else
249override CONFIG_SATAMV = no
250endif
251endif
252
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000253ifeq ($(TARGET_OS), libpayload)
Stefan Tauner8e19b042013-08-28 09:55:04 +0000254ifeq ($(MAKECMDGOALS),)
255.DEFAULT_GOAL := libflashrom.a
256$(info Setting default goal to libflashrom.a)
257endif
Carl-Daniel Hailfingera8da2242012-08-15 23:06:32 +0000258FLASHROM_CFLAGS += -DSTANDALONE
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000259ifeq ($(CONFIG_DUMMY), yes)
260UNSUPPORTED_FEATURES += CONFIG_DUMMY=yes
261else
262override CONFIG_DUMMY = no
263endif
Carl-Daniel Hailfinger11990da2013-07-13 23:21:05 +0000264# Bus Pirate, Serprog and PonyProg are not supported with libpayload (missing serial support).
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000265ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
266UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
267else
268override CONFIG_BUSPIRATE_SPI = no
269endif
270ifeq ($(CONFIG_SERPROG), yes)
271UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
272else
273override CONFIG_SERPROG = no
274endif
Carl-Daniel Hailfinger11990da2013-07-13 23:21:05 +0000275ifeq ($(CONFIG_PONY_SPI), yes)
276UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes
277else
278override CONFIG_PONY_SPI = no
279endif
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000280# Dediprog and FT2232 are not supported with libpayload (missing libusb support)
281ifeq ($(CONFIG_DEDIPROG), yes)
282UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
283else
284override CONFIG_DEDIPROG = no
285endif
286ifeq ($(CONFIG_FT2232_SPI), yes)
287UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
288else
289override CONFIG_FT2232_SPI = no
290endif
James Lairdc60de0e2013-03-27 13:00:23 +0000291ifeq ($(CONFIG_USBBLASTER_SPI), yes)
292UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes
293else
294override CONFIG_USBBLASTER_SPI = no
295endif
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000296endif
297
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000298ifneq ($(TARGET_OS), Linux)
299ifeq ($(CONFIG_LINUX_SPI), yes)
300UNSUPPORTED_FEATURES += CONFIG_LINUX_SPI=yes
301else
302override CONFIG_LINUX_SPI = no
303endif
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000304ifeq ($(CONFIG_MSTARDDC_SPI), yes)
305UNSUPPORTED_FEATURES += CONFIG_MSTARDDC_SPI=yes
306else
307override CONFIG_MSTARDDC_SPI = no
308endif
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000309endif
310
Stefan Tauner037cd842013-08-25 00:10:56 +0000311###############################################################################
312# General architecture-specific settings.
313# Like above for the OS, below we verify user-supplied options depending on the target architecture.
314
Uwe Hermann44ffd582011-08-20 14:16:00 +0000315# Determine the destination processor architecture.
316# IMPORTANT: The following line must be placed before ARCH is ever used
317# (of course), but should come after any lines setting CC because the line
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000318# below uses CC itself.
Stefan Taunerb0eee9b2015-01-10 09:32:50 +0000319override ARCH := $(strip $(shell LC_ALL=C $(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
Uwe Hermann44ffd582011-08-20 14:16:00 +0000320
David Hendricksb286da72012-02-13 00:35:35 +0000321# PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM.
322# Right now this means the drivers below only work on x86.
323ifneq ($(ARCH), x86)
Uwe Hermann21b10c62011-07-29 12:13:01 +0000324ifeq ($(CONFIG_NIC3COM), yes)
325UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
326else
327override CONFIG_NIC3COM = no
328endif
329ifeq ($(CONFIG_NICREALTEK), yes)
330UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
331else
332override CONFIG_NICREALTEK = no
333endif
334ifeq ($(CONFIG_NICNATSEMI), yes)
335UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
336else
337override CONFIG_NICNATSEMI = no
338endif
339ifeq ($(CONFIG_RAYER_SPI), yes)
340UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
341else
342override CONFIG_RAYER_SPI = no
343endif
344ifeq ($(CONFIG_ATAHPT), yes)
345UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
346else
347override CONFIG_ATAHPT = no
348endif
349ifeq ($(CONFIG_SATAMV), yes)
350UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
351else
352override CONFIG_SATAMV = no
353endif
354endif
355
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000356###############################################################################
357# Flash chip drivers and bus support infrastructure.
358
Stefan Tauner4404f732013-09-12 08:28:56 +0000359CHIP_OBJS = jedec.o stm50.o w39.o w29ee011.o \
Carl-Daniel Hailfingera8cf3622014-08-08 08:33:01 +0000360 sst28sf040.o 82802ab.o \
Stefan Tauner6ee37e22012-12-29 15:03:51 +0000361 sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o spi25_statusreg.o \
Aidan Thorntondb4e87d2013-08-27 18:01:53 +0000362 opaque.o sfdp.o en29lv640b.o at45db.o
Sean Nelson5d134642009-12-24 16:54:21 +0000363
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000364###############################################################################
365# Library code.
Sean Nelson5d134642009-12-24 16:54:21 +0000366
Stefan Tauner6ad6e012014-06-12 00:04:32 +0000367LIB_OBJS = layout.o flashrom.o udelay.o programmer.o helpers.o
Sean Nelson5d134642009-12-24 16:54:21 +0000368
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000369###############################################################################
370# Frontend related stuff.
Ollie Lho184a4042005-11-26 21:55:36 +0000371
Stefan Tauner9b32de92014-08-08 23:52:33 +0000372CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
Ollie Lho184a4042005-11-26 21:55:36 +0000373
Stefan Taunerec7a35f2013-08-29 00:38:14 +0000374# Set the flashrom version string from the highest revision number of the checked out flashrom files.
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +0000375# Note to packagers: Any tree exported with "make export" or "make tarball"
376# will not require subversion. The downloadable snapshots are already exported.
Stefan Taunerd5ff8452015-01-10 09:32:07 +0000377SVNVERSION := $(shell ./util/getrevision.sh -u 2>/dev/null )
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +0000378
Stefan Tauner241e9d52013-08-13 22:13:01 +0000379RELEASE := 0.9.7
Stefan Taunerec7a35f2013-08-29 00:38:14 +0000380VERSION := $(RELEASE)-$(SVNVERSION)
Carl-Daniel Hailfinger48e5e092009-08-31 16:25:08 +0000381RELEASENAME ?= $(VERSION)
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +0000382
383SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
Bernhard Walle201bde32008-01-21 15:24:22 +0000384
Stefan Taunerd5ff8452015-01-10 09:32:07 +0000385# Inform user if there is no meaningful version string. If there is version information from a VCS print
386# something anyway because $(info...) will print a line break in any case which would look suspicious.
Stefan Tauner5d1ad352015-01-25 23:57:08 +0000387# The && between the echos is a workaround for old versions of GNU make that issue the error "unterminated
388# variable reference" if a semicolon is used instead.
389$(info $(shell ./util/getrevision.sh -c 2>/dev/null || echo "Files don't seem to be under version control." && \
Stefan Taunerd5ff8452015-01-10 09:32:07 +0000390 echo "Replacing all version templates with $(VERSION)." ))
391
Stefan Tauner037cd842013-08-25 00:10:56 +0000392###############################################################################
393# Default settings of CONFIG_* variables.
394
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000395# Always enable internal/onboard support for now.
396CONFIG_INTERNAL ?= yes
397
Stefan Tauner52b6e9d2013-04-01 00:46:05 +0000398# Always enable serprog for now.
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000399CONFIG_SERPROG ?= yes
400
Carl-Daniel Hailfingere7fdd6e2010-07-21 10:26:01 +0000401# RayeR SPIPGM hardware support
402CONFIG_RAYER_SPI ?= yes
403
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000404# PonyProg2000 SPI hardware support
405CONFIG_PONY_SPI ?= yes
406
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000407# Always enable 3Com NICs for now.
408CONFIG_NIC3COM ?= yes
409
Carl-Daniel Hailfingerbf3af292010-07-29 14:41:46 +0000410# Enable NVIDIA graphics cards. Note: write and erase do not work properly.
411CONFIG_GFXNVIDIA ?= yes
Uwe Hermann2bc98f62009-09-30 18:29:55 +0000412
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000413# Always enable SiI SATA controllers for now.
414CONFIG_SATASII ?= yes
415
Uwe Hermannddd5c9e2010-02-21 21:17:00 +0000416# Highpoint (HPT) ATA/RAID controller support.
417# IMPORTANT: This code is not yet working!
418CONFIG_ATAHPT ?= no
419
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000420# VIA VT6421A LPC memory support
421CONFIG_ATAVIA ?= yes
422
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000423# Always enable FT2232 SPI dongles for now.
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000424CONFIG_FT2232_SPI ?= yes
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000425
James Lairdc60de0e2013-03-27 13:00:23 +0000426# Always enable Altera USB-Blaster dongles for now.
427CONFIG_USBBLASTER_SPI ?= yes
428
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000429# MSTAR DDC support needs more tests/reviews/cleanups.
430CONFIG_MSTARDDC_SPI ?= no
431
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000432# Always enable dummy tracing for now.
433CONFIG_DUMMY ?= yes
434
435# Always enable Dr. Kaiser for now.
436CONFIG_DRKAISER ?= yes
Carl-Daniel Hailfinger6be74112009-08-12 16:17:41 +0000437
Joerg Fischer5665ef32010-05-21 21:54:07 +0000438# Always enable Realtek NICs for now.
439CONFIG_NICREALTEK ?= yes
440
Andrew Morganc29c2e72010-06-07 22:37:54 +0000441# Disable National Semiconductor NICs until support is complete and tested.
442CONFIG_NICNATSEMI ?= no
443
Carl-Daniel Hailfingerb713d2e2011-05-08 00:24:18 +0000444# Always enable Intel NICs for now.
445CONFIG_NICINTEL ?= yes
446
Idwer Vollering004f4b72010-09-03 18:21:21 +0000447# Always enable SPI on Intel NICs for now.
448CONFIG_NICINTEL_SPI ?= yes
449
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000450# Always enable EEPROM on Intel NICs for now.
451CONFIG_NICINTEL_EEPROM ?= yes
452
Mark Marshall90021f22010-12-03 14:48:11 +0000453# Always enable SPI on OGP cards for now.
454CONFIG_OGP_SPI ?= yes
455
Carl-Daniel Hailfinger5cca01f2009-11-24 00:20:03 +0000456# Always enable Bus Pirate SPI for now.
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000457CONFIG_BUSPIRATE_SPI ?= yes
Carl-Daniel Hailfinger5cca01f2009-11-24 00:20:03 +0000458
Carl-Daniel Hailfingerd38fac82010-01-19 11:15:48 +0000459# Disable Dediprog SF100 until support is complete and tested.
460CONFIG_DEDIPROG ?= no
461
Carl-Daniel Hailfinger9a1105c2011-02-04 21:37:59 +0000462# Always enable Marvell SATA controllers for now.
463CONFIG_SATAMV ?= yes
464
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000465# Enable Linux spidev interface by default. We disable it on non-Linux targets.
466CONFIG_LINUX_SPI ?= yes
467
Kyösti Mälkki72d42f82014-06-01 23:48:31 +0000468# Always enable ITE IT8212F PATA controllers for now.
469CONFIG_IT8212 ?= yes
470
Carl-Daniel Hailfinger6161ff12009-11-16 21:22:24 +0000471# Disable wiki printing by default. It is only useful if you have wiki access.
Uwe Hermann2db77a02010-06-04 17:07:39 +0000472CONFIG_PRINT_WIKI ?= no
Carl-Daniel Hailfinger9c8476b2009-09-16 12:19:03 +0000473
Patrick Georgiced7ab62015-01-19 19:52:34 +0000474# Enable all features if CONFIG_EVERYTHING=yes is given
475ifeq ($(CONFIG_EVERYTHING), yes)
476$(foreach var, $(filter CONFIG_%, $(.VARIABLES)),\
477 $(if $(filter no, $($(var))),\
478 $(eval $(var)=yes)))
479endif
480
Carl-Daniel Hailfinger9e3a6c42010-10-08 12:40:09 +0000481# Bitbanging SPI infrastructure, default off unless needed.
482ifeq ($(CONFIG_RAYER_SPI), yes)
483override CONFIG_BITBANG_SPI = yes
484else
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000485ifeq ($(CONFIG_PONY_SPI), yes)
486override CONFIG_BITBANG_SPI = yes
487else
Carl-Daniel Hailfinger9e3a6c42010-10-08 12:40:09 +0000488ifeq ($(CONFIG_INTERNAL), yes)
489override CONFIG_BITBANG_SPI = yes
490else
491ifeq ($(CONFIG_NICINTEL_SPI), yes)
492override CONFIG_BITBANG_SPI = yes
493else
Mark Marshall90021f22010-12-03 14:48:11 +0000494ifeq ($(CONFIG_OGP_SPI), yes)
495override CONFIG_BITBANG_SPI = yes
496else
Carl-Daniel Hailfinger9e3a6c42010-10-08 12:40:09 +0000497CONFIG_BITBANG_SPI ?= no
498endif
499endif
500endif
Mark Marshall90021f22010-12-03 14:48:11 +0000501endif
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000502endif
Carl-Daniel Hailfinger9e3a6c42010-10-08 12:40:09 +0000503
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000504###############################################################################
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000505# Handle CONFIG_* variables that depend on others set (and verified) above.
506
507# The external DMI decoder (dmidecode) does not work in libpayload. Bail out if the internal one got disabled.
508ifeq ($(TARGET_OS), libpayload)
509ifeq ($(CONFIG_INTERNAL), yes)
510ifeq ($(CONFIG_INTERNAL_DMI), no)
511UNSUPPORTED_FEATURES += CONFIG_INTERNAL_DMI=no
512else
513override CONFIG_INTERNAL_DMI = yes
514endif
515endif
516endif
517
518# Use internal DMI/SMBIOS decoder by default instead of relying on dmidecode.
519CONFIG_INTERNAL_DMI ?= yes
520
521###############################################################################
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000522# Programmer drivers and programmer support infrastructure.
Stefan Tauner037cd842013-08-25 00:10:56 +0000523# Depending on the CONFIG_* variables set and verified above we set compiler flags and parameters below.
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000524
Stefan Taunerfd0d4132012-09-25 21:24:55 +0000525FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER=$(CONFIG_DEFAULT_PROGRAMMER)'
Stefan Tauner265fcac2014-06-02 00:12:23 +0000526FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_ARGS="$(CONFIG_DEFAULT_PROGRAMMER_ARGS)"'
Stefan Taunerfd0d4132012-09-25 21:24:55 +0000527
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000528ifeq ($(CONFIG_INTERNAL), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000529FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1'
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000530PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o internal.o
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000531ifeq ($(ARCH), x86)
Rudolf Marek70e14592013-07-25 22:58:56 +0000532PROGRAMMER_OBJS += it87spi.o it85spi.o sb600spi.o amd_imc.o wbsio_spi.o mcp6x_spi.o
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000533PROGRAMMER_OBJS += ichspi.o ich_descriptors.o dmi.o
534ifeq ($(CONFIG_INTERNAL_DMI), yes)
535FEATURE_CFLAGS += -D'CONFIG_INTERNAL_DMI=1'
536endif
Carl-Daniel Hailfinger91199a12011-07-07 06:59:18 +0000537else
538endif
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000539NEED_PCI := yes
540endif
541
Carl-Daniel Hailfinger6be74112009-08-12 16:17:41 +0000542ifeq ($(CONFIG_SERPROG), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000543FEATURE_CFLAGS += -D'CONFIG_SERPROG=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000544PROGRAMMER_OBJS += serprog.o
Carl-Daniel Hailfinger5bdf2982010-06-14 12:42:05 +0000545NEED_SERIAL := yes
546NEED_NET := yes
Carl-Daniel Hailfinger6be74112009-08-12 16:17:41 +0000547endif
548
Carl-Daniel Hailfingere7fdd6e2010-07-21 10:26:01 +0000549ifeq ($(CONFIG_RAYER_SPI), yes)
550FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1'
551PROGRAMMER_OBJS += rayer_spi.o
552# Actually, NEED_PCI is wrong. NEED_IOPORT_ACCESS would be more correct.
553NEED_PCI := yes
554endif
555
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000556ifeq ($(CONFIG_PONY_SPI), yes)
557FEATURE_CFLAGS += -D'CONFIG_PONY_SPI=1'
558PROGRAMMER_OBJS += pony_spi.o
559NEED_SERIAL := yes
560endif
561
Carl-Daniel Hailfinger547872b2009-09-28 13:15:16 +0000562ifeq ($(CONFIG_BITBANG_SPI), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000563FEATURE_CFLAGS += -D'CONFIG_BITBANG_SPI=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000564PROGRAMMER_OBJS += bitbang_spi.o
Carl-Daniel Hailfinger547872b2009-09-28 13:15:16 +0000565endif
566
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000567ifeq ($(CONFIG_NIC3COM), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000568FEATURE_CFLAGS += -D'CONFIG_NIC3COM=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000569PROGRAMMER_OBJS += nic3com.o
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000570NEED_PCI := yes
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000571endif
Carl-Daniel Hailfinger6be74112009-08-12 16:17:41 +0000572
Uwe Hermann2bc98f62009-09-30 18:29:55 +0000573ifeq ($(CONFIG_GFXNVIDIA), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000574FEATURE_CFLAGS += -D'CONFIG_GFXNVIDIA=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000575PROGRAMMER_OBJS += gfxnvidia.o
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000576NEED_PCI := yes
Uwe Hermann2bc98f62009-09-30 18:29:55 +0000577endif
578
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000579ifeq ($(CONFIG_SATASII), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000580FEATURE_CFLAGS += -D'CONFIG_SATASII=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000581PROGRAMMER_OBJS += satasii.o
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000582NEED_PCI := yes
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000583endif
584
Uwe Hermannddd5c9e2010-02-21 21:17:00 +0000585ifeq ($(CONFIG_ATAHPT), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000586FEATURE_CFLAGS += -D'CONFIG_ATAHPT=1'
Uwe Hermannddd5c9e2010-02-21 21:17:00 +0000587PROGRAMMER_OBJS += atahpt.o
588NEED_PCI := yes
589endif
590
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000591ifeq ($(CONFIG_ATAVIA), yes)
592FEATURE_CFLAGS += -D'CONFIG_ATAVIA=1'
593PROGRAMMER_OBJS += atavia.o
594NEED_PCI := yes
595endif
596
Kyösti Mälkki72d42f82014-06-01 23:48:31 +0000597ifeq ($(CONFIG_IT8212), yes)
598FEATURE_CFLAGS += -D'CONFIG_IT8212=1'
599PROGRAMMER_OBJS += it8212.o
600NEED_PCI := yes
601endif
602
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000603ifeq ($(CONFIG_FT2232_SPI), yes)
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000604# This is a totally ugly hack.
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000605FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_FT2232_SPI=1'")
James Lairdc60de0e2013-03-27 13:00:23 +0000606NEED_FTDI := yes
607PROGRAMMER_OBJS += ft2232_spi.o
608endif
609
610ifeq ($(CONFIG_USBBLASTER_SPI), yes)
611# This is a totally ugly hack.
612FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_USBBLASTER_SPI=1'")
613NEED_FTDI := yes
614PROGRAMMER_OBJS += usbblaster_spi.o
615endif
616
617ifeq ($(NEED_FTDI), yes)
Stefan Taunere37735a2015-01-26 22:03:35 +0000618FTDILIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libftdi || printf "%s" "-lftdi -lusb")
Ilya A. Volynets-Evenbakh2c714ab2012-09-26 00:47:09 +0000619FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'")
Jörg Mayer8776db22009-11-16 14:05:13 +0000620FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000621# We can't set NEED_USB here because that would transform libftdi auto-enabling
622# into a hard requirement for libusb, defeating the purpose of auto-enabling.
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000623endif
624
625ifeq ($(CONFIG_DUMMY), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000626FEATURE_CFLAGS += -D'CONFIG_DUMMY=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000627PROGRAMMER_OBJS += dummyflasher.o
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000628endif
629
630ifeq ($(CONFIG_DRKAISER), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000631FEATURE_CFLAGS += -D'CONFIG_DRKAISER=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000632PROGRAMMER_OBJS += drkaiser.o
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000633NEED_PCI := yes
Carl-Daniel Hailfinger4740c6f2009-09-16 10:09:21 +0000634endif
Carl-Daniel Hailfinger6be74112009-08-12 16:17:41 +0000635
Joerg Fischer5665ef32010-05-21 21:54:07 +0000636ifeq ($(CONFIG_NICREALTEK), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000637FEATURE_CFLAGS += -D'CONFIG_NICREALTEK=1'
Joerg Fischer5665ef32010-05-21 21:54:07 +0000638PROGRAMMER_OBJS += nicrealtek.o
639NEED_PCI := yes
640endif
641
Andrew Morganc29c2e72010-06-07 22:37:54 +0000642ifeq ($(CONFIG_NICNATSEMI), yes)
643FEATURE_CFLAGS += -D'CONFIG_NICNATSEMI=1'
644PROGRAMMER_OBJS += nicnatsemi.o
645NEED_PCI := yes
646endif
647
Carl-Daniel Hailfingerb713d2e2011-05-08 00:24:18 +0000648ifeq ($(CONFIG_NICINTEL), yes)
649FEATURE_CFLAGS += -D'CONFIG_NICINTEL=1'
650PROGRAMMER_OBJS += nicintel.o
651NEED_PCI := yes
652endif
653
Idwer Vollering004f4b72010-09-03 18:21:21 +0000654ifeq ($(CONFIG_NICINTEL_SPI), yes)
655FEATURE_CFLAGS += -D'CONFIG_NICINTEL_SPI=1'
656PROGRAMMER_OBJS += nicintel_spi.o
657NEED_PCI := yes
658endif
659
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000660ifeq ($(CONFIG_NICINTEL_EEPROM), yes)
661FEATURE_CFLAGS += -D'CONFIG_NICINTEL_EEPROM=1'
662PROGRAMMER_OBJS += nicintel_eeprom.o
663NEED_PCI := yes
664endif
665
Mark Marshall90021f22010-12-03 14:48:11 +0000666ifeq ($(CONFIG_OGP_SPI), yes)
667FEATURE_CFLAGS += -D'CONFIG_OGP_SPI=1'
668PROGRAMMER_OBJS += ogp_spi.o
669NEED_PCI := yes
670endif
671
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000672ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
673FEATURE_CFLAGS += -D'CONFIG_BUSPIRATE_SPI=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000674PROGRAMMER_OBJS += buspirate_spi.o
Carl-Daniel Hailfinger5bdf2982010-06-14 12:42:05 +0000675NEED_SERIAL := yes
Carl-Daniel Hailfinger5cca01f2009-11-24 00:20:03 +0000676endif
677
Carl-Daniel Hailfingerd38fac82010-01-19 11:15:48 +0000678ifeq ($(CONFIG_DEDIPROG), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000679FEATURE_CFLAGS += -D'CONFIG_DEDIPROG=1'
Carl-Daniel Hailfingerd38fac82010-01-19 11:15:48 +0000680PROGRAMMER_OBJS += dediprog.o
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000681NEED_USB := yes
Carl-Daniel Hailfingerd38fac82010-01-19 11:15:48 +0000682endif
683
Carl-Daniel Hailfinger9a1105c2011-02-04 21:37:59 +0000684ifeq ($(CONFIG_SATAMV), yes)
685FEATURE_CFLAGS += -D'CONFIG_SATAMV=1'
686PROGRAMMER_OBJS += satamv.o
687NEED_PCI := yes
688endif
689
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000690ifeq ($(CONFIG_LINUX_SPI), yes)
Stefan Tauner8868db32012-03-13 00:18:19 +0000691# This is a totally ugly hack.
692FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'")
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000693PROGRAMMER_OBJS += linux_spi.o
694endif
695
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000696ifeq ($(CONFIG_MSTARDDC_SPI), yes)
697# This is a totally ugly hack.
698FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'")
699NEED_LINUX_I2C := yes
700PROGRAMMER_OBJS += mstarddc_spi.o
701endif
702
Carl-Daniel Hailfinger5bdf2982010-06-14 12:42:05 +0000703ifeq ($(NEED_SERIAL), yes)
Sean Nelson5d134642009-12-24 16:54:21 +0000704LIB_OBJS += serial.o
Carl-Daniel Hailfinger5bdf2982010-06-14 12:42:05 +0000705endif
706
707ifeq ($(NEED_NET), yes)
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000708ifeq ($(TARGET_OS), SunOS)
Carl-Daniel Hailfinger5bdf2982010-06-14 12:42:05 +0000709LIBS += -lsocket
Carl-Daniel Hailfinger5cca01f2009-11-24 00:20:03 +0000710endif
Carl-Daniel Hailfingere51ea102009-11-23 19:20:11 +0000711endif
712
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000713ifeq ($(NEED_PCI), yes)
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +0000714CHECK_LIBPCI = yes
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000715FEATURE_CFLAGS += -D'NEED_PCI=1'
Carl-Daniel Hailfingerfb0828f2010-02-12 19:35:25 +0000716PROGRAMMER_OBJS += pcidev.o physmap.o hwaccess.o
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000717ifeq ($(TARGET_OS), NetBSD)
Carl-Daniel Hailfinger460b2822010-06-04 23:24:57 +0000718# The libpci we want is called libpciutils on NetBSD and needs NetBSD libpci.
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000719PCILIBS += -lpciutils -lpci
Carl-Daniel Hailfinger460b2822010-06-04 23:24:57 +0000720# For (i386|x86_64)_iopl(2).
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000721PCILIBS += -l$(shell uname -p)
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +0000722else
Stefan Taunerbe62d3f2015-01-10 09:32:44 +0000723
Stefan Tauner449abe22013-09-11 23:34:57 +0000724PCILIBS += -lpci
Stefan Taunerbe62d3f2015-01-10 09:32:44 +0000725
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000726ifeq ($(TARGET_OS), OpenBSD)
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +0000727# For (i386|amd64)_iopl(2).
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000728PCILIBS += -l$(shell uname -m)
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000729else
730ifeq ($(TARGET_OS), Darwin)
731# DirectHW framework can be found in the DirectHW library.
Stefan Taunere34e3e82013-01-01 00:06:51 +0000732PCILIBS += -framework IOKit -framework DirectHW
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +0000733endif
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +0000734endif
Jonathan A. Kollasch3646c8f2010-01-08 21:18:08 +0000735endif
Carl-Daniel Hailfinger66ef4e52009-12-13 22:28:00 +0000736endif
737
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000738ifeq ($(NEED_USB), yes)
739CHECK_LIBUSB0 = yes
740FEATURE_CFLAGS += -D'NEED_USB=1'
Stefan Taunere37735a2015-01-26 22:03:35 +0000741USBLIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libusb || printf "%s" "-lusb")
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000742endif
743
Carl-Daniel Hailfinger9c8476b2009-09-16 12:19:03 +0000744ifeq ($(CONFIG_PRINT_WIKI), yes)
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000745FEATURE_CFLAGS += -D'CONFIG_PRINT_WIKI=1'
Sean Nelson5d134642009-12-24 16:54:21 +0000746CLI_OBJS += print_wiki.o
Carl-Daniel Hailfinger9c8476b2009-09-16 12:19:03 +0000747endif
748
Carl-Daniel Hailfinger132e2ec2010-03-27 16:36:40 +0000749FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'")
750
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000751# We could use PULLED_IN_LIBS, but that would be ugly.
752FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
753
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000754LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
Stefan Taunerd94d25d2012-07-28 03:17:15 +0000755OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS)
Sean Nelson5d134642009-12-24 16:54:21 +0000756
Joerg Mayera93d9dc2013-08-29 00:38:19 +0000757all: hwlibs features $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000758ifeq ($(ARCH), x86)
759 @+$(MAKE) -C util/ich_descriptors_tool/ TARGET_OS=$(TARGET_OS) EXEC_SUFFIX=$(EXEC_SUFFIX)
760endif
761
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000762$(PROGRAM)$(EXEC_SUFFIX): $(OBJS)
Carl-Daniel Hailfinger11990da2013-07-13 23:21:05 +0000763 $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS) $(USBLIBS)
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +0000764
Patrick Georgi97bc95c2011-03-08 07:17:44 +0000765libflashrom.a: $(LIBFLASHROM_OBJS)
766 $(AR) rcs $@ $^
767 $(RANLIB) $@
768
Carl-Daniel Hailfinger8ef7dce2009-07-10 20:19:48 +0000769# TAROPTIONS reduces information leakage from the packager's system.
770# If other tar programs support command line arguments for setting uid/gid of
771# stored files, they can be handled here as well.
772TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
Carl-Daniel Hailfingerb18ecbc2009-06-19 14:20:34 +0000773
Paul Fox05dfbe62009-06-16 21:08:06 +0000774%.o: %.c .features
Carl-Daniel Hailfingera8da2242012-08-15 23:06:32 +0000775 $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $<
Clark Rawlins02016f72008-02-14 23:22:20 +0000776
Carl-Daniel Hailfingera0020df2010-05-30 22:35:14 +0000777# Make sure to add all names of generated binaries here.
778# This includes all frontends and libflashrom.
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000779# We don't use EXEC_SUFFIX here because we want to clean everything.
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +0000780clean:
Joerg Mayera93d9dc2013-08-29 00:38:19 +0000781 rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a *.o *.d $(PROGRAM).8
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000782 @+$(MAKE) -C util/ich_descriptors_tool/ clean
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +0000783
Ollie Lho184a4042005-11-26 21:55:36 +0000784distclean: clean
Stefan Reinauere2f01582010-06-07 11:08:07 +0000785 rm -f .features .libdeps
Christian Ruppertdb9d9f42009-05-14 14:17:07 +0000786
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000787strip: $(PROGRAM)$(EXEC_SUFFIX)
788 $(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX)
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +0000789
Stefan Tauner56787082011-08-18 02:27:19 +0000790# to define test programs we use verbatim variables, which get exported
791# to environment variables and are referenced with $$<varname> later
792
793define COMPILER_TEST
794int main(int argc, char **argv)
795{
796 (void) argc;
797 (void) argv;
798 return 0;
799}
800endef
801export COMPILER_TEST
802
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000803compiler: featuresavailable
Paul Fox05dfbe62009-06-16 21:08:06 +0000804 @printf "Checking for a C compiler... "
Stefan Tauner56787082011-08-18 02:27:19 +0000805 @echo "$$COMPILER_TEST" > .test.c
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000806 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null && \
Carl-Daniel Hailfinger4cb7a962009-06-16 09:31:51 +0000807 echo "found." || ( echo "not found."; \
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000808 rm -f .test.c .test$(EXEC_SUFFIX); exit 1)
809 @rm -f .test.c .test$(EXEC_SUFFIX)
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000810 @printf "Target arch is "
Carl-Daniel Hailfinger91199a12011-07-07 06:59:18 +0000811 @# FreeBSD wc will output extraneous whitespace.
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000812 @echo $(ARCH)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \
Carl-Daniel Hailfinger91199a12011-07-07 06:59:18 +0000813 ( echo "unknown. Aborting."; exit 1)
814 @printf "%s\n" '$(ARCH)'
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +0000815 @printf "Target OS is "
816 @# FreeBSD wc will output extraneous whitespace.
817 @echo $(TARGET_OS)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \
818 ( echo "unknown. Aborting."; exit 1)
819 @printf "%s\n" '$(TARGET_OS)'
Stefan Taunerd6c17f62013-09-12 14:04:31 +0000820ifeq ($(TARGET_OS), libpayload)
821 @$(CC) --version 2>&1 | grep -q coreboot || \
822 ( echo "Warning: It seems you are not using coreboot's reference compiler."; \
823 echo "This might work but usually does not, please beware." )
824endif
Carl-Daniel Hailfinger4cb7a962009-06-16 09:31:51 +0000825
Stefan Tauner56787082011-08-18 02:27:19 +0000826define LIBPCI_TEST
827/* Avoid a failing test due to libpci header symbol shadowing breakage */
828#define index shadow_workaround_index
Stefan Tauner8d21ff12015-01-10 09:33:06 +0000829#if !defined __NetBSD__
Stefan Tauner56787082011-08-18 02:27:19 +0000830#include <pci/pci.h>
Stefan Taunerc65b8552013-09-12 15:48:39 +0000831#else
832#include <pciutils/pci.h>
833#endif
Stefan Tauner56787082011-08-18 02:27:19 +0000834struct pci_access *pacc;
835int main(int argc, char **argv)
836{
837 (void) argc;
838 (void) argv;
839 pacc = pci_alloc();
840 return 0;
841}
842endef
843export LIBPCI_TEST
844
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000845define LIBUSB0_TEST
Stefan Tauner0cbd8c22015-01-26 22:06:04 +0000846#include "platform.h"
847#if IS_WINDOWS
848#include <lusb0_usb.h>
849#else
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000850#include <usb.h>
Stefan Tauner0cbd8c22015-01-26 22:06:04 +0000851#endif
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000852int main(int argc, char **argv)
853{
854 (void) argc;
855 (void) argv;
856 usb_init();
857 return 0;
858}
859endef
860export LIBUSB0_TEST
861
862hwlibs: compiler
863 @printf "" > .libdeps
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +0000864ifeq ($(CHECK_LIBPCI), yes)
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000865 @printf "Checking for libpci headers... "
Stefan Tauner56787082011-08-18 02:27:19 +0000866 @echo "$$LIBPCI_TEST" > .test.c
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000867 @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null && \
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000868 echo "found." || ( echo "not found."; echo; \
869 echo "Please install libpci headers (package pciutils-devel)."; \
870 echo "See README for more information."; echo; \
871 rm -f .test.c .test.o; exit 1)
Carl-Daniel Hailfinger9979eac2010-03-22 12:29:45 +0000872 @printf "Checking if libpci is present and sufficient... "
Carl-Daniel Hailfinger26148ae2012-11-29 22:22:04 +0000873 @$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) >/dev/null && \
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000874 echo "yes." || ( echo "no."; \
Carl-Daniel Hailfinger9979eac2010-03-22 12:29:45 +0000875 printf "Checking if libz+libpci are present and sufficient..."; \
Carl-Daniel Hailfinger26148ae2012-11-29 22:22:04 +0000876 $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) -lz >/dev/null && \
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000877 ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo; \
Carl-Daniel Hailfinger9979eac2010-03-22 12:29:45 +0000878 echo "Please install libpci (package pciutils) and/or libz."; \
Carl-Daniel Hailfingera472b8b2009-10-03 17:08:02 +0000879 echo "See README for more information."; echo; \
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000880 rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1) )
881 @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000882endif
883ifeq ($(CHECK_LIBUSB0), yes)
884 @printf "Checking for libusb-0.1/libusb-compat headers... "
885 @echo "$$LIBUSB0_TEST" > .test.c
886 @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null && \
887 echo "found." || ( echo "not found."; echo; \
888 echo "Please install libusb-0.1 headers or libusb-compat headers."; \
889 echo "See README for more information."; echo; \
890 rm -f .test.c .test.o; exit 1)
891 @printf "Checking if libusb-0.1 is usable... "
Carl-Daniel Hailfinger26148ae2012-11-29 22:22:04 +0000892 @$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USBLIBS) >/dev/null && \
Carl-Daniel Hailfingere7a39bf2012-11-20 21:06:16 +0000893 echo "yes." || ( echo "no."; \
894 echo "Please install libusb-0.1 or libusb-compat."; \
895 echo "See README for more information."; echo; \
896 rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1)
897 @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
Carl-Daniel Hailfinger8a59ff02009-12-24 03:33:11 +0000898endif
Stefan Reinauer53e96252005-12-01 16:19:24 +0000899
Carl-Daniel Hailfingerb18ecbc2009-06-19 14:20:34 +0000900.features: features
901
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000902# If a user does not explicitly request a non-working feature, we should
903# silently disable it. However, if a non-working (does not compile) feature
904# is explicitly requested, we should bail out with a descriptive error message.
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000905# We also have to check that at least one programmer driver is enabled.
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000906featuresavailable:
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000907ifeq ($(PROGRAMMER_OBJS),)
908 @echo "You have to enable at least one programmer driver!"
909 @false
910endif
911ifneq ($(UNSUPPORTED_FEATURES), )
Carl-Daniel Hailfinger5d3fcb92010-06-14 18:40:59 +0000912 @echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)"
913 @false
914endif
915
Stefan Tauner56787082011-08-18 02:27:19 +0000916define FTDI_TEST
917#include <ftdi.h>
918struct ftdi_context *ftdic = NULL;
919int main(int argc, char **argv)
920{
921 (void) argc;
922 (void) argv;
923 return ftdi_init(ftdic);
924}
925endef
926export FTDI_TEST
927
Ilya A. Volynets-Evenbakh2c714ab2012-09-26 00:47:09 +0000928define FTDI_232H_TEST
929#include <ftdi.h>
930enum ftdi_chip_type type = TYPE_232H;
931endef
932export FTDI_232H_TEST
933
Stefan Tauner56787082011-08-18 02:27:19 +0000934define UTSNAME_TEST
935#include <sys/utsname.h>
936struct utsname osinfo;
937int main(int argc, char **argv)
938{
939 (void) argc;
940 (void) argv;
941 uname (&osinfo);
942 return 0;
943}
944endef
945export UTSNAME_TEST
946
Stefan Tauner8868db32012-03-13 00:18:19 +0000947define LINUX_SPI_TEST
948#include <linux/types.h>
949#include <linux/spi/spidev.h>
950
951int main(int argc, char **argv)
952{
953 (void) argc;
954 (void) argv;
955 return 0;
956}
957endef
958export LINUX_SPI_TEST
959
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000960define LINUX_I2C_TEST
961#include <linux/i2c-dev.h>
962#include <linux/i2c.h>
963
964int main(int argc, char **argv)
965{
966 (void) argc;
967 (void) argv;
968 return 0;
969}
970endef
971export LINUX_I2C_TEST
972
Carl-Daniel Hailfingerb18ecbc2009-06-19 14:20:34 +0000973features: compiler
974 @echo "FEATURES := yes" > .features.tmp
James Lairdc60de0e2013-03-27 13:00:23 +0000975ifeq ($(NEED_FTDI), yes)
Paul Fox05dfbe62009-06-16 21:08:06 +0000976 @printf "Checking for FTDI support... "
Stefan Tauner56787082011-08-18 02:27:19 +0000977 @echo "$$FTDI_TEST" > .featuretest.c
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +0000978 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \
Carl-Daniel Hailfingerb18ecbc2009-06-19 14:20:34 +0000979 ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \
980 ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
Ilya A. Volynets-Evenbakh2c714ab2012-09-26 00:47:09 +0000981 @printf "Checking for FT232H support in libftdi... "
982 @echo "$$FTDI_232H_TEST" >> .featuretest.c
983 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \
984 ( echo "found."; echo "FT232H := yes" >> .features.tmp ) || \
985 ( echo "not found."; echo "FT232H := no" >> .features.tmp )
Carl-Daniel Hailfinger8a59ff02009-12-24 03:33:11 +0000986endif
Stefan Tauner8868db32012-03-13 00:18:19 +0000987ifeq ($(CONFIG_LINUX_SPI), yes)
988 @printf "Checking if Linux SPI headers are present... "
989 @echo "$$LINUX_SPI_TEST" > .featuretest.c
990 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \
991 ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \
992 ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp )
993endif
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000994ifeq ($(NEED_LINUX_I2C), yes)
995 @printf "Checking if Linux I2C headers are present... "
996 @echo "$$LINUX_I2C_TEST" > .featuretest.c
997 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \
998 ( echo "yes."; echo "LINUX_I2C_SUPPORT := yes" >> .features.tmp ) || \
999 ( echo "no."; echo "LINUX_I2C_SUPPORT := no" >> .features.tmp )
1000endif
Stefan Tauner56787082011-08-18 02:27:19 +00001001 @printf "Checking for utsname support... "
1002 @echo "$$UTSNAME_TEST" > .featuretest.c
1003 @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \
1004 ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \
1005 ( echo "not found."; echo "UTSNAME := no" >> .features.tmp )
1006 @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
1007 @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
Paul Fox05dfbe62009-06-16 21:08:06 +00001008
Joerg Mayera93d9dc2013-08-29 00:38:19 +00001009$(PROGRAM).8: $(PROGRAM).8.tmpl
Stefan Taunerd5ff8452015-01-10 09:32:07 +00001010 @sed -e '1 s#".*".*#"$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl 2>/dev/null)" "$(VERSION)"#' <$< >$@
Joerg Mayera93d9dc2013-08-29 00:38:19 +00001011
1012install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
Uwe Hermannc2a9c9c2009-05-14 14:51:14 +00001013 mkdir -p $(DESTDIR)$(PREFIX)/sbin
Uwe Hermann56b2cb02009-05-21 15:59:58 +00001014 mkdir -p $(DESTDIR)$(MANDIR)/man8
Carl-Daniel Hailfingerddbab712010-06-14 14:44:08 +00001015 $(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
Uwe Hermann56b2cb02009-05-21 15:59:58 +00001016 $(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
Uwe Hermannc113b572006-12-14 00:59:41 +00001017
Joerg Mayera93d9dc2013-08-29 00:38:19 +00001018export: $(PROGRAM).8
Carl-Daniel Hailfinger48e5e092009-08-31 16:25:08 +00001019 @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME)
1020 @svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME)
1021 @sed "s/^SVNVERSION.*/SVNVERSION := $(SVNVERSION)/" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile
Joerg Mayera93d9dc2013-08-29 00:38:19 +00001022 @cp $(PROGRAM).8 "$(EXPORTDIR)/flashrom-$(RELEASENAME)/$(PROGRAM).8"
Carl-Daniel Hailfinger48e5e092009-08-31 16:25:08 +00001023 @LC_ALL=C svn log >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog
1024 @echo Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +00001025
1026tarball: export
Carl-Daniel Hailfinger48e5e092009-08-31 16:25:08 +00001027 @tar cjf $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2 -C $(EXPORTDIR)/ $(TAROPTIONS) flashrom-$(RELEASENAME)/
1028 @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME)
1029 @echo Created $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2
Carl-Daniel Hailfingera23041c2009-06-12 14:49:10 +00001030
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +00001031djgpp-dos: clean
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +00001032 make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip
1033libpayload: clean
1034 make CC="CC=i386-elf-gcc lpgcc" AR=i386-elf-ar RANLIB=i386-elf-ranlib
Carl-Daniel Hailfinger50415d22010-03-21 14:54:57 +00001035
Joerg Mayera93d9dc2013-08-29 00:38:19 +00001036.PHONY: all install clean distclean compiler hwlibs features export tarball dos featuresavailable
Ollie Lho184a4042005-11-26 21:55:36 +00001037
Stefan Reinauere2f01582010-06-07 11:08:07 +00001038-include $(OBJS:.o=.d)