Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 1 | # |
Uwe Hermann | f78cff1 | 2009-06-12 14:05:25 +0000 | [diff] [blame] | 2 | # This file is part of the flashrom project. |
| 3 | # |
| 4 | # Copyright (C) 2005 coresystems GmbH <stepan@coresystems.de> |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 5 | # Copyright (C) 2009,2010,2012 Carl-Daniel Hailfinger |
Uwe Hermann | f78cff1 | 2009-06-12 14:05:25 +0000 | [diff] [blame] | 6 | # |
| 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 Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 19 | # |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 20 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 21 | PROGRAM = flashrom |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 22 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 23 | ############################################################################### |
| 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 Hailfinger | b7bce8a | 2012-08-14 21:36:11 +0000 | [diff] [blame] | 29 | # |
| 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 Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 32 | STRIP ?= strip |
Christian Ruppert | db9d9f4 | 2009-05-14 14:17:07 +0000 | [diff] [blame] | 33 | INSTALL = install |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 34 | DIFF = diff |
Christian Ruppert | db9d9f4 | 2009-05-14 14:17:07 +0000 | [diff] [blame] | 35 | PREFIX ?= /usr/local |
Uwe Hermann | 56b2cb0 | 2009-05-21 15:59:58 +0000 | [diff] [blame] | 36 | MANDIR ?= $(PREFIX)/share/man |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 37 | CFLAGS ?= -Os -Wall -Wshadow |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 38 | EXPORTDIR ?= . |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 39 | RANLIB ?= ranlib |
Stefan Tauner | be62d3f | 2015-01-10 09:32:44 +0000 | [diff] [blame] | 40 | |
Stefan Tauner | fd0d413 | 2012-09-25 21:24:55 +0000 | [diff] [blame] | 41 | # 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. |
| 52 | CONFIG_DEFAULT_PROGRAMMER ?= PROGRAMMER_INVALID |
Stefan Tauner | 265fcac | 2014-06-02 00:12:23 +0000 | [diff] [blame] | 53 | # The following adds a default parameter for the default programmer set above (only). |
| 54 | CONFIG_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 Ruppert | db9d9f4 | 2009-05-14 14:17:07 +0000 | [diff] [blame] | 58 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 59 | # If your compiler spits out excessive warnings, run make WARNERROR=no |
| 60 | # You shouldn't have to change this flag. |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 61 | WARNERROR ?= yes |
| 62 | |
| 63 | ifeq ($(WARNERROR), yes) |
| 64 | CFLAGS += -Werror |
| 65 | endif |
| 66 | |
Stefan Tauner | e37735a | 2015-01-26 22:03:35 +0000 | [diff] [blame] | 67 | ifdef LIBS_BASE |
Stefan Tauner | be62d3f | 2015-01-10 09:32:44 +0000 | [diff] [blame] | 68 | CPPFLAGS += -I$(LIBS_BASE)/include |
Stefan Tauner | e37735a | 2015-01-26 22:03:35 +0000 | [diff] [blame] | 69 | LDFLAGS += -L$(LIBS_BASE)/lib -Wl,-rpath -Wl,$(LIBS_BASE)/lib |
| 70 | PKG_CONFIG_LIBDIR ?= $(LIBS_BASE)/lib/pkgconfig |
| 71 | endif |
Stefan Tauner | be62d3f | 2015-01-10 09:32:44 +0000 | [diff] [blame] | 72 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 73 | ############################################################################### |
Stefan Tauner | 037cd84 | 2013-08-25 00:10:56 +0000 | [diff] [blame] | 74 | # 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 Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 78 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 79 | # HOST_OS is only used to work around local toolchain issues. |
Stefan Tauner | 037cd84 | 2013-08-25 00:10:56 +0000 | [diff] [blame] | 80 | HOST_OS ?= $(shell uname) |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 81 | ifeq ($(HOST_OS), MINGW32_NT-5.1) |
| 82 | # Explicitly set CC = gcc on MinGW, otherwise: "cc: command not found". |
| 83 | CC = gcc |
| 84 | endif |
| 85 | ifneq ($(HOST_OS), SunOS) |
Adam Kaufman | 064b1f2 | 2007-02-06 19:47:50 +0000 | [diff] [blame] | 86 | STRIP_ARGS = -s |
| 87 | endif |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 88 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 89 | # Determine the destination OS. |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 90 | # 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. |
| 93 | override TARGET_OS := $(strip $(shell LC_ALL=C $(CC) $(CPPFLAGS) -E os.h 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"')) |
| 94 | |
| 95 | ifeq ($(TARGET_OS), Darwin) |
Stefan Reinauer | 2fea3f3 | 2010-01-21 20:26:30 +0000 | [diff] [blame] | 96 | CPPFLAGS += -I/opt/local/include -I/usr/local/include |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 97 | LDFLAGS += -L/opt/local/lib -L/usr/local/lib |
Stefan Reinauer | f79edb9 | 2009-01-26 01:23:31 +0000 | [diff] [blame] | 98 | endif |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 99 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 100 | ifeq ($(TARGET_OS), FreeBSD) |
Stefan Reinauer | 2fea3f3 | 2010-01-21 20:26:30 +0000 | [diff] [blame] | 101 | CPPFLAGS += -I/usr/local/include |
Andriy Gapon | 65c1b86 | 2008-05-22 13:22:45 +0000 | [diff] [blame] | 102 | LDFLAGS += -L/usr/local/lib |
| 103 | endif |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 104 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 105 | ifeq ($(TARGET_OS), OpenBSD) |
Carl-Daniel Hailfinger | b63b067 | 2010-07-02 17:12:50 +0000 | [diff] [blame] | 106 | CPPFLAGS += -I/usr/local/include |
| 107 | LDFLAGS += -L/usr/local/lib |
| 108 | endif |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 109 | |
Stefan Tauner | c65b855 | 2013-09-12 15:48:39 +0000 | [diff] [blame] | 110 | ifeq ($(TARGET_OS), NetBSD) |
| 111 | CPPFLAGS += -I/usr/pkg/include |
| 112 | LDFLAGS += -L/usr/pkg/lib |
| 113 | endif |
| 114 | |
| 115 | ifeq ($(TARGET_OS), DragonFlyBSD) |
Stefan Tauner | 8d21ff1 | 2015-01-10 09:33:06 +0000 | [diff] [blame] | 116 | CPPFLAGS += -I/usr/local/include |
| 117 | LDFLAGS += -L/usr/local/lib |
Stefan Tauner | c65b855 | 2013-09-12 15:48:39 +0000 | [diff] [blame] | 118 | endif |
| 119 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 120 | ifeq ($(TARGET_OS), DOS) |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 121 | EXEC_SUFFIX := .exe |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 122 | # DJGPP has odd uint*_t definitions which cause lots of format string warnings. |
Carl-Daniel Hailfinger | b7bce8a | 2012-08-14 21:36:11 +0000 | [diff] [blame] | 123 | CFLAGS += -Wno-format |
Stefan Tauner | 449abe2 | 2013-09-11 23:34:57 +0000 | [diff] [blame] | 124 | LIBS += -lgetopt |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 125 | # Bus Pirate, Serprog and PonyProg are not supported under DOS (missing serial support). |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 126 | ifeq ($(CONFIG_BUSPIRATE_SPI), yes) |
| 127 | UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes |
| 128 | else |
| 129 | override CONFIG_BUSPIRATE_SPI = no |
| 130 | endif |
| 131 | ifeq ($(CONFIG_SERPROG), yes) |
| 132 | UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes |
| 133 | else |
| 134 | override CONFIG_SERPROG = no |
| 135 | endif |
Stefan Tauner | d94d25d | 2012-07-28 03:17:15 +0000 | [diff] [blame] | 136 | ifeq ($(CONFIG_PONY_SPI), yes) |
| 137 | UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes |
| 138 | else |
| 139 | override CONFIG_PONY_SPI = no |
| 140 | endif |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 141 | # Dediprog, USB-Blaster, PICkit2 and FT2232 are not supported under DOS (missing USB support). |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 142 | ifeq ($(CONFIG_DEDIPROG), yes) |
| 143 | UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes |
| 144 | else |
| 145 | override CONFIG_DEDIPROG = no |
| 146 | endif |
| 147 | ifeq ($(CONFIG_FT2232_SPI), yes) |
| 148 | UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes |
| 149 | else |
| 150 | override CONFIG_FT2232_SPI = no |
| 151 | endif |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 152 | ifeq ($(CONFIG_USBBLASTER_SPI), yes) |
| 153 | UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes |
| 154 | else |
| 155 | override CONFIG_USBBLASTER_SPI = no |
| 156 | endif |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 157 | ifeq ($(CONFIG_PICKIT2_SPI), yes) |
| 158 | UNSUPPORTED_FEATURES += CONFIG_PICKIT2_SPI=yes |
| 159 | else |
| 160 | override CONFIG_PICKIT2_SPI = no |
| 161 | endif |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 162 | endif |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 163 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 164 | # FIXME: Should we check for Cygwin/MSVC as well? |
| 165 | ifeq ($(TARGET_OS), MinGW) |
| 166 | EXEC_SUFFIX := .exe |
Uwe Hermann | d5e85d6 | 2011-07-03 19:44:12 +0000 | [diff] [blame] | 167 | # MinGW doesn't have the ffs() function, but we can use gcc's __builtin_ffs(). |
Carl-Daniel Hailfinger | a8da224 | 2012-08-15 23:06:32 +0000 | [diff] [blame] | 168 | FLASHROM_CFLAGS += -Dffs=__builtin_ffs |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 169 | # Some functions provided by Microsoft do not work as described in C99 specifications. This macro fixes that |
| 170 | # for MinGW. See http://sourceforge.net/apps/trac/mingw-w64/wiki/printf%20and%20scanf%20family */ |
| 171 | FLASHROM_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 |
Uwe Hermann | d5e85d6 | 2011-07-03 19:44:12 +0000 | [diff] [blame] | 172 | # libusb-win32/libftdi stuff is usually installed in /usr/local. |
| 173 | CPPFLAGS += -I/usr/local/include |
| 174 | LDFLAGS += -L/usr/local/lib |
Uwe Hermann | d5e85d6 | 2011-07-03 19:44:12 +0000 | [diff] [blame] | 175 | # For now we disable all PCI-based programmers on Windows/MinGW (no libpci). |
| 176 | ifeq ($(CONFIG_INTERNAL), yes) |
| 177 | UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes |
| 178 | else |
| 179 | override CONFIG_INTERNAL = no |
| 180 | endif |
| 181 | ifeq ($(CONFIG_RAYER_SPI), yes) |
| 182 | UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes |
| 183 | else |
| 184 | override CONFIG_RAYER_SPI = no |
| 185 | endif |
| 186 | ifeq ($(CONFIG_NIC3COM), yes) |
| 187 | UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes |
| 188 | else |
| 189 | override CONFIG_NIC3COM = no |
| 190 | endif |
| 191 | ifeq ($(CONFIG_GFXNVIDIA), yes) |
| 192 | UNSUPPORTED_FEATURES += CONFIG_GFXNVIDIA=yes |
| 193 | else |
| 194 | override CONFIG_GFXNVIDIA = no |
| 195 | endif |
| 196 | ifeq ($(CONFIG_SATASII), yes) |
| 197 | UNSUPPORTED_FEATURES += CONFIG_SATASII=yes |
| 198 | else |
| 199 | override CONFIG_SATASII = no |
| 200 | endif |
| 201 | ifeq ($(CONFIG_ATAHPT), yes) |
| 202 | UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes |
| 203 | else |
| 204 | override CONFIG_ATAHPT = no |
| 205 | endif |
Jonathan Kollasch | 7f0f3fa | 2014-06-01 10:26:23 +0000 | [diff] [blame] | 206 | ifeq ($(CONFIG_ATAVIA), yes) |
| 207 | UNSUPPORTED_FEATURES += CONFIG_ATAVIA=yes |
| 208 | else |
| 209 | override CONFIG_ATAVIA = no |
| 210 | endif |
Kyösti Mälkki | 72d42f8 | 2014-06-01 23:48:31 +0000 | [diff] [blame] | 211 | ifeq ($(CONFIG_IT8212), yes) |
| 212 | UNSUPPORTED_FEATURES += CONFIG_IT8212=yes |
| 213 | else |
| 214 | override CONFIG_IT8212 = no |
| 215 | endif |
Uwe Hermann | d5e85d6 | 2011-07-03 19:44:12 +0000 | [diff] [blame] | 216 | ifeq ($(CONFIG_DRKAISER), yes) |
| 217 | UNSUPPORTED_FEATURES += CONFIG_DRKAISER=yes |
| 218 | else |
| 219 | override CONFIG_DRKAISER = no |
| 220 | endif |
| 221 | ifeq ($(CONFIG_NICREALTEK), yes) |
| 222 | UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes |
| 223 | else |
| 224 | override CONFIG_NICREALTEK = no |
| 225 | endif |
| 226 | ifeq ($(CONFIG_NICNATSEMI), yes) |
| 227 | UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes |
| 228 | else |
| 229 | override CONFIG_NICNATSEMI = no |
| 230 | endif |
| 231 | ifeq ($(CONFIG_NICINTEL), yes) |
| 232 | UNSUPPORTED_FEATURES += CONFIG_NICINTEL=yes |
| 233 | else |
| 234 | override CONFIG_NICINTEL = no |
| 235 | endif |
Ricardo Ribalda Delgado | 2a41f0a | 2014-07-28 20:35:21 +0000 | [diff] [blame] | 236 | ifeq ($(CONFIG_NICINTEL_EEPROM), yes) |
| 237 | UNSUPPORTED_FEATURES += CONFIG_NICINTEL_EEPROM=yes |
| 238 | else |
| 239 | override CONFIG_NICINTEL_EEPROM = no |
| 240 | endif |
Uwe Hermann | d5e85d6 | 2011-07-03 19:44:12 +0000 | [diff] [blame] | 241 | ifeq ($(CONFIG_NICINTEL_SPI), yes) |
| 242 | UNSUPPORTED_FEATURES += CONFIG_NICINTEL_SPI=yes |
| 243 | else |
| 244 | override CONFIG_NICINTEL_SPI = no |
| 245 | endif |
| 246 | ifeq ($(CONFIG_OGP_SPI), yes) |
| 247 | UNSUPPORTED_FEATURES += CONFIG_OGP_SPI=yes |
| 248 | else |
| 249 | override CONFIG_OGP_SPI = no |
| 250 | endif |
| 251 | ifeq ($(CONFIG_SATAMV), yes) |
| 252 | UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes |
| 253 | else |
| 254 | override CONFIG_SATAMV = no |
| 255 | endif |
| 256 | endif |
| 257 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 258 | ifeq ($(TARGET_OS), libpayload) |
Stefan Tauner | 8e19b04 | 2013-08-28 09:55:04 +0000 | [diff] [blame] | 259 | ifeq ($(MAKECMDGOALS),) |
| 260 | .DEFAULT_GOAL := libflashrom.a |
| 261 | $(info Setting default goal to libflashrom.a) |
| 262 | endif |
Carl-Daniel Hailfinger | a8da224 | 2012-08-15 23:06:32 +0000 | [diff] [blame] | 263 | FLASHROM_CFLAGS += -DSTANDALONE |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 264 | ifeq ($(CONFIG_DUMMY), yes) |
| 265 | UNSUPPORTED_FEATURES += CONFIG_DUMMY=yes |
| 266 | else |
| 267 | override CONFIG_DUMMY = no |
| 268 | endif |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 269 | # Bus Pirate, Serprog and PonyProg are not supported with libpayload (missing serial support). |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 270 | ifeq ($(CONFIG_BUSPIRATE_SPI), yes) |
| 271 | UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes |
| 272 | else |
| 273 | override CONFIG_BUSPIRATE_SPI = no |
| 274 | endif |
| 275 | ifeq ($(CONFIG_SERPROG), yes) |
| 276 | UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes |
| 277 | else |
| 278 | override CONFIG_SERPROG = no |
| 279 | endif |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 280 | ifeq ($(CONFIG_PONY_SPI), yes) |
| 281 | UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes |
| 282 | else |
| 283 | override CONFIG_PONY_SPI = no |
| 284 | endif |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 285 | # Dediprog, USB-Blaster, PICkit2 and FT2232 are not supported with libpayload (missing libusb support) |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 286 | ifeq ($(CONFIG_DEDIPROG), yes) |
| 287 | UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes |
| 288 | else |
| 289 | override CONFIG_DEDIPROG = no |
| 290 | endif |
| 291 | ifeq ($(CONFIG_FT2232_SPI), yes) |
| 292 | UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes |
| 293 | else |
| 294 | override CONFIG_FT2232_SPI = no |
| 295 | endif |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 296 | ifeq ($(CONFIG_USBBLASTER_SPI), yes) |
| 297 | UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes |
| 298 | else |
| 299 | override CONFIG_USBBLASTER_SPI = no |
| 300 | endif |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 301 | ifeq ($(CONFIG_PICKIT2_SPI), yes) |
| 302 | UNSUPPORTED_FEATURES += CONFIG_PICKIT2_SPI=yes |
| 303 | else |
| 304 | override CONFIG_PICKIT2_SPI = no |
| 305 | endif |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 306 | endif |
| 307 | |
Carl-Daniel Hailfinger | 8541d23 | 2012-02-16 21:00:27 +0000 | [diff] [blame] | 308 | ifneq ($(TARGET_OS), Linux) |
| 309 | ifeq ($(CONFIG_LINUX_SPI), yes) |
| 310 | UNSUPPORTED_FEATURES += CONFIG_LINUX_SPI=yes |
| 311 | else |
| 312 | override CONFIG_LINUX_SPI = no |
| 313 | endif |
Alexandre Boeglin | 80e6471 | 2014-12-20 20:25:19 +0000 | [diff] [blame] | 314 | ifeq ($(CONFIG_MSTARDDC_SPI), yes) |
| 315 | UNSUPPORTED_FEATURES += CONFIG_MSTARDDC_SPI=yes |
| 316 | else |
| 317 | override CONFIG_MSTARDDC_SPI = no |
| 318 | endif |
Carl-Daniel Hailfinger | 8541d23 | 2012-02-16 21:00:27 +0000 | [diff] [blame] | 319 | endif |
| 320 | |
Stefan Tauner | 037cd84 | 2013-08-25 00:10:56 +0000 | [diff] [blame] | 321 | ############################################################################### |
| 322 | # General architecture-specific settings. |
| 323 | # Like above for the OS, below we verify user-supplied options depending on the target architecture. |
| 324 | |
Uwe Hermann | 44ffd58 | 2011-08-20 14:16:00 +0000 | [diff] [blame] | 325 | # Determine the destination processor architecture. |
| 326 | # IMPORTANT: The following line must be placed before ARCH is ever used |
| 327 | # (of course), but should come after any lines setting CC because the line |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 328 | # below uses CC itself. |
Stefan Tauner | b0eee9b | 2015-01-10 09:32:50 +0000 | [diff] [blame] | 329 | override ARCH := $(strip $(shell LC_ALL=C $(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"')) |
Uwe Hermann | 44ffd58 | 2011-08-20 14:16:00 +0000 | [diff] [blame] | 330 | |
Stefan Tauner | fb2d77c | 2015-02-10 08:03:10 +0000 | [diff] [blame] | 331 | # PCI port I/O support is unimplemented on PPC/MIPS/SPARC and unavailable on ARM. |
David Hendricks | b286da7 | 2012-02-13 00:35:35 +0000 | [diff] [blame] | 332 | # Right now this means the drivers below only work on x86. |
| 333 | ifneq ($(ARCH), x86) |
Uwe Hermann | 21b10c6 | 2011-07-29 12:13:01 +0000 | [diff] [blame] | 334 | ifeq ($(CONFIG_NIC3COM), yes) |
| 335 | UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes |
| 336 | else |
| 337 | override CONFIG_NIC3COM = no |
| 338 | endif |
| 339 | ifeq ($(CONFIG_NICREALTEK), yes) |
| 340 | UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes |
| 341 | else |
| 342 | override CONFIG_NICREALTEK = no |
| 343 | endif |
| 344 | ifeq ($(CONFIG_NICNATSEMI), yes) |
| 345 | UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes |
| 346 | else |
| 347 | override CONFIG_NICNATSEMI = no |
| 348 | endif |
| 349 | ifeq ($(CONFIG_RAYER_SPI), yes) |
| 350 | UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes |
| 351 | else |
| 352 | override CONFIG_RAYER_SPI = no |
| 353 | endif |
| 354 | ifeq ($(CONFIG_ATAHPT), yes) |
| 355 | UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes |
| 356 | else |
| 357 | override CONFIG_ATAHPT = no |
| 358 | endif |
| 359 | ifeq ($(CONFIG_SATAMV), yes) |
| 360 | UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes |
| 361 | else |
| 362 | override CONFIG_SATAMV = no |
| 363 | endif |
| 364 | endif |
| 365 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 366 | ############################################################################### |
| 367 | # Flash chip drivers and bus support infrastructure. |
| 368 | |
Stefan Tauner | 4404f73 | 2013-09-12 08:28:56 +0000 | [diff] [blame] | 369 | CHIP_OBJS = jedec.o stm50.o w39.o w29ee011.o \ |
Carl-Daniel Hailfinger | a8cf362 | 2014-08-08 08:33:01 +0000 | [diff] [blame] | 370 | sst28sf040.o 82802ab.o \ |
Stefan Tauner | 6ee37e2 | 2012-12-29 15:03:51 +0000 | [diff] [blame] | 371 | sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o spi25_statusreg.o \ |
Aidan Thornton | db4e87d | 2013-08-27 18:01:53 +0000 | [diff] [blame] | 372 | opaque.o sfdp.o en29lv640b.o at45db.o |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 373 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 374 | ############################################################################### |
| 375 | # Library code. |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 376 | |
Stefan Tauner | 6ad6e01 | 2014-06-12 00:04:32 +0000 | [diff] [blame] | 377 | LIB_OBJS = layout.o flashrom.o udelay.o programmer.o helpers.o |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 378 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 379 | ############################################################################### |
| 380 | # Frontend related stuff. |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 381 | |
Stefan Tauner | 9b32de9 | 2014-08-08 23:52:33 +0000 | [diff] [blame] | 382 | CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 383 | |
Stefan Tauner | ec7a35f | 2013-08-29 00:38:14 +0000 | [diff] [blame] | 384 | # Set the flashrom version string from the highest revision number of the checked out flashrom files. |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 385 | # Note to packagers: Any tree exported with "make export" or "make tarball" |
| 386 | # will not require subversion. The downloadable snapshots are already exported. |
Stefan Tauner | d5ff845 | 2015-01-10 09:32:07 +0000 | [diff] [blame] | 387 | SVNVERSION := $(shell ./util/getrevision.sh -u 2>/dev/null ) |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 388 | |
Stefan Tauner | f4651f6 | 2015-03-01 22:05:16 +0000 | [diff] [blame] | 389 | RELEASE := 0.9.8 |
Stefan Tauner | ec7a35f | 2013-08-29 00:38:14 +0000 | [diff] [blame] | 390 | VERSION := $(RELEASE)-$(SVNVERSION) |
Carl-Daniel Hailfinger | 48e5e09 | 2009-08-31 16:25:08 +0000 | [diff] [blame] | 391 | RELEASENAME ?= $(VERSION) |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 392 | |
| 393 | SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"' |
Bernhard Walle | 201bde3 | 2008-01-21 15:24:22 +0000 | [diff] [blame] | 394 | |
Stefan Tauner | d5ff845 | 2015-01-10 09:32:07 +0000 | [diff] [blame] | 395 | # Inform user if there is no meaningful version string. If there is version information from a VCS print |
| 396 | # something anyway because $(info...) will print a line break in any case which would look suspicious. |
Stefan Tauner | 5d1ad35 | 2015-01-25 23:57:08 +0000 | [diff] [blame] | 397 | # The && between the echos is a workaround for old versions of GNU make that issue the error "unterminated |
| 398 | # variable reference" if a semicolon is used instead. |
| 399 | $(info $(shell ./util/getrevision.sh -c 2>/dev/null || echo "Files don't seem to be under version control." && \ |
Stefan Tauner | d5ff845 | 2015-01-10 09:32:07 +0000 | [diff] [blame] | 400 | echo "Replacing all version templates with $(VERSION)." )) |
| 401 | |
Stefan Tauner | 037cd84 | 2013-08-25 00:10:56 +0000 | [diff] [blame] | 402 | ############################################################################### |
| 403 | # Default settings of CONFIG_* variables. |
| 404 | |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 405 | # Always enable internal/onboard support for now. |
| 406 | CONFIG_INTERNAL ?= yes |
| 407 | |
Stefan Tauner | 52b6e9d | 2013-04-01 00:46:05 +0000 | [diff] [blame] | 408 | # Always enable serprog for now. |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 409 | CONFIG_SERPROG ?= yes |
| 410 | |
Carl-Daniel Hailfinger | e7fdd6e | 2010-07-21 10:26:01 +0000 | [diff] [blame] | 411 | # RayeR SPIPGM hardware support |
| 412 | CONFIG_RAYER_SPI ?= yes |
| 413 | |
Virgil-Adrian Teaca | da7c545 | 2012-04-30 23:11:06 +0000 | [diff] [blame] | 414 | # PonyProg2000 SPI hardware support |
| 415 | CONFIG_PONY_SPI ?= yes |
| 416 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 417 | # Always enable 3Com NICs for now. |
| 418 | CONFIG_NIC3COM ?= yes |
| 419 | |
Carl-Daniel Hailfinger | bf3af29 | 2010-07-29 14:41:46 +0000 | [diff] [blame] | 420 | # Enable NVIDIA graphics cards. Note: write and erase do not work properly. |
| 421 | CONFIG_GFXNVIDIA ?= yes |
Uwe Hermann | 2bc98f6 | 2009-09-30 18:29:55 +0000 | [diff] [blame] | 422 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 423 | # Always enable SiI SATA controllers for now. |
| 424 | CONFIG_SATASII ?= yes |
| 425 | |
Uwe Hermann | ddd5c9e | 2010-02-21 21:17:00 +0000 | [diff] [blame] | 426 | # Highpoint (HPT) ATA/RAID controller support. |
| 427 | # IMPORTANT: This code is not yet working! |
| 428 | CONFIG_ATAHPT ?= no |
| 429 | |
Jonathan Kollasch | 7f0f3fa | 2014-06-01 10:26:23 +0000 | [diff] [blame] | 430 | # VIA VT6421A LPC memory support |
| 431 | CONFIG_ATAVIA ?= yes |
| 432 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 433 | # Always enable FT2232 SPI dongles for now. |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 434 | CONFIG_FT2232_SPI ?= yes |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 435 | |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 436 | # Always enable Altera USB-Blaster dongles for now. |
| 437 | CONFIG_USBBLASTER_SPI ?= yes |
| 438 | |
Alexandre Boeglin | 80e6471 | 2014-12-20 20:25:19 +0000 | [diff] [blame] | 439 | # MSTAR DDC support needs more tests/reviews/cleanups. |
| 440 | CONFIG_MSTARDDC_SPI ?= no |
| 441 | |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 442 | # Always enable PICkit2 SPI dongles for now. |
| 443 | CONFIG_PICKIT2_SPI ?= yes |
| 444 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 445 | # Always enable dummy tracing for now. |
| 446 | CONFIG_DUMMY ?= yes |
| 447 | |
| 448 | # Always enable Dr. Kaiser for now. |
| 449 | CONFIG_DRKAISER ?= yes |
Carl-Daniel Hailfinger | 6be7411 | 2009-08-12 16:17:41 +0000 | [diff] [blame] | 450 | |
Joerg Fischer | 5665ef3 | 2010-05-21 21:54:07 +0000 | [diff] [blame] | 451 | # Always enable Realtek NICs for now. |
| 452 | CONFIG_NICREALTEK ?= yes |
| 453 | |
Andrew Morgan | c29c2e7 | 2010-06-07 22:37:54 +0000 | [diff] [blame] | 454 | # Disable National Semiconductor NICs until support is complete and tested. |
| 455 | CONFIG_NICNATSEMI ?= no |
| 456 | |
Carl-Daniel Hailfinger | b713d2e | 2011-05-08 00:24:18 +0000 | [diff] [blame] | 457 | # Always enable Intel NICs for now. |
| 458 | CONFIG_NICINTEL ?= yes |
| 459 | |
Idwer Vollering | 004f4b7 | 2010-09-03 18:21:21 +0000 | [diff] [blame] | 460 | # Always enable SPI on Intel NICs for now. |
| 461 | CONFIG_NICINTEL_SPI ?= yes |
| 462 | |
Ricardo Ribalda Delgado | 2a41f0a | 2014-07-28 20:35:21 +0000 | [diff] [blame] | 463 | # Always enable EEPROM on Intel NICs for now. |
| 464 | CONFIG_NICINTEL_EEPROM ?= yes |
| 465 | |
Mark Marshall | 90021f2 | 2010-12-03 14:48:11 +0000 | [diff] [blame] | 466 | # Always enable SPI on OGP cards for now. |
| 467 | CONFIG_OGP_SPI ?= yes |
| 468 | |
Carl-Daniel Hailfinger | 5cca01f | 2009-11-24 00:20:03 +0000 | [diff] [blame] | 469 | # Always enable Bus Pirate SPI for now. |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 470 | CONFIG_BUSPIRATE_SPI ?= yes |
Carl-Daniel Hailfinger | 5cca01f | 2009-11-24 00:20:03 +0000 | [diff] [blame] | 471 | |
Carl-Daniel Hailfinger | d38fac8 | 2010-01-19 11:15:48 +0000 | [diff] [blame] | 472 | # Disable Dediprog SF100 until support is complete and tested. |
| 473 | CONFIG_DEDIPROG ?= no |
| 474 | |
Carl-Daniel Hailfinger | 9a1105c | 2011-02-04 21:37:59 +0000 | [diff] [blame] | 475 | # Always enable Marvell SATA controllers for now. |
| 476 | CONFIG_SATAMV ?= yes |
| 477 | |
Carl-Daniel Hailfinger | 8541d23 | 2012-02-16 21:00:27 +0000 | [diff] [blame] | 478 | # Enable Linux spidev interface by default. We disable it on non-Linux targets. |
| 479 | CONFIG_LINUX_SPI ?= yes |
| 480 | |
Kyösti Mälkki | 72d42f8 | 2014-06-01 23:48:31 +0000 | [diff] [blame] | 481 | # Always enable ITE IT8212F PATA controllers for now. |
| 482 | CONFIG_IT8212 ?= yes |
| 483 | |
Carl-Daniel Hailfinger | 6161ff1 | 2009-11-16 21:22:24 +0000 | [diff] [blame] | 484 | # Disable wiki printing by default. It is only useful if you have wiki access. |
Uwe Hermann | 2db77a0 | 2010-06-04 17:07:39 +0000 | [diff] [blame] | 485 | CONFIG_PRINT_WIKI ?= no |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 486 | |
Patrick Georgi | ced7ab6 | 2015-01-19 19:52:34 +0000 | [diff] [blame] | 487 | # Enable all features if CONFIG_EVERYTHING=yes is given |
| 488 | ifeq ($(CONFIG_EVERYTHING), yes) |
| 489 | $(foreach var, $(filter CONFIG_%, $(.VARIABLES)),\ |
| 490 | $(if $(filter no, $($(var))),\ |
| 491 | $(eval $(var)=yes))) |
| 492 | endif |
| 493 | |
Carl-Daniel Hailfinger | 9e3a6c4 | 2010-10-08 12:40:09 +0000 | [diff] [blame] | 494 | # Bitbanging SPI infrastructure, default off unless needed. |
| 495 | ifeq ($(CONFIG_RAYER_SPI), yes) |
| 496 | override CONFIG_BITBANG_SPI = yes |
| 497 | else |
Virgil-Adrian Teaca | da7c545 | 2012-04-30 23:11:06 +0000 | [diff] [blame] | 498 | ifeq ($(CONFIG_PONY_SPI), yes) |
| 499 | override CONFIG_BITBANG_SPI = yes |
| 500 | else |
Carl-Daniel Hailfinger | 9e3a6c4 | 2010-10-08 12:40:09 +0000 | [diff] [blame] | 501 | ifeq ($(CONFIG_INTERNAL), yes) |
| 502 | override CONFIG_BITBANG_SPI = yes |
| 503 | else |
| 504 | ifeq ($(CONFIG_NICINTEL_SPI), yes) |
| 505 | override CONFIG_BITBANG_SPI = yes |
| 506 | else |
Mark Marshall | 90021f2 | 2010-12-03 14:48:11 +0000 | [diff] [blame] | 507 | ifeq ($(CONFIG_OGP_SPI), yes) |
| 508 | override CONFIG_BITBANG_SPI = yes |
| 509 | else |
Carl-Daniel Hailfinger | 9e3a6c4 | 2010-10-08 12:40:09 +0000 | [diff] [blame] | 510 | CONFIG_BITBANG_SPI ?= no |
| 511 | endif |
| 512 | endif |
| 513 | endif |
Mark Marshall | 90021f2 | 2010-12-03 14:48:11 +0000 | [diff] [blame] | 514 | endif |
Virgil-Adrian Teaca | da7c545 | 2012-04-30 23:11:06 +0000 | [diff] [blame] | 515 | endif |
Carl-Daniel Hailfinger | 9e3a6c4 | 2010-10-08 12:40:09 +0000 | [diff] [blame] | 516 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 517 | ############################################################################### |
Sean Nelson | 4c6d3a4 | 2013-09-11 23:35:03 +0000 | [diff] [blame] | 518 | # Handle CONFIG_* variables that depend on others set (and verified) above. |
| 519 | |
| 520 | # The external DMI decoder (dmidecode) does not work in libpayload. Bail out if the internal one got disabled. |
| 521 | ifeq ($(TARGET_OS), libpayload) |
| 522 | ifeq ($(CONFIG_INTERNAL), yes) |
| 523 | ifeq ($(CONFIG_INTERNAL_DMI), no) |
| 524 | UNSUPPORTED_FEATURES += CONFIG_INTERNAL_DMI=no |
| 525 | else |
| 526 | override CONFIG_INTERNAL_DMI = yes |
| 527 | endif |
| 528 | endif |
| 529 | endif |
| 530 | |
| 531 | # Use internal DMI/SMBIOS decoder by default instead of relying on dmidecode. |
| 532 | CONFIG_INTERNAL_DMI ?= yes |
| 533 | |
| 534 | ############################################################################### |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 535 | # Programmer drivers and programmer support infrastructure. |
Stefan Tauner | 037cd84 | 2013-08-25 00:10:56 +0000 | [diff] [blame] | 536 | # Depending on the CONFIG_* variables set and verified above we set compiler flags and parameters below. |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 537 | |
Stefan Tauner | fd0d413 | 2012-09-25 21:24:55 +0000 | [diff] [blame] | 538 | FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER=$(CONFIG_DEFAULT_PROGRAMMER)' |
Stefan Tauner | 265fcac | 2014-06-02 00:12:23 +0000 | [diff] [blame] | 539 | FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_ARGS="$(CONFIG_DEFAULT_PROGRAMMER_ARGS)"' |
Stefan Tauner | fd0d413 | 2012-09-25 21:24:55 +0000 | [diff] [blame] | 540 | |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 541 | ifeq ($(CONFIG_INTERNAL), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 542 | FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1' |
Sean Nelson | 4c6d3a4 | 2013-09-11 23:35:03 +0000 | [diff] [blame] | 543 | PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o internal.o |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 544 | ifeq ($(ARCH), x86) |
Rudolf Marek | 70e1459 | 2013-07-25 22:58:56 +0000 | [diff] [blame] | 545 | PROGRAMMER_OBJS += it87spi.o it85spi.o sb600spi.o amd_imc.o wbsio_spi.o mcp6x_spi.o |
Sean Nelson | 4c6d3a4 | 2013-09-11 23:35:03 +0000 | [diff] [blame] | 546 | PROGRAMMER_OBJS += ichspi.o ich_descriptors.o dmi.o |
| 547 | ifeq ($(CONFIG_INTERNAL_DMI), yes) |
| 548 | FEATURE_CFLAGS += -D'CONFIG_INTERNAL_DMI=1' |
| 549 | endif |
Carl-Daniel Hailfinger | 91199a1 | 2011-07-07 06:59:18 +0000 | [diff] [blame] | 550 | else |
| 551 | endif |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 552 | NEED_PCI := yes |
| 553 | endif |
| 554 | |
Carl-Daniel Hailfinger | 6be7411 | 2009-08-12 16:17:41 +0000 | [diff] [blame] | 555 | ifeq ($(CONFIG_SERPROG), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 556 | FEATURE_CFLAGS += -D'CONFIG_SERPROG=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 557 | PROGRAMMER_OBJS += serprog.o |
Carl-Daniel Hailfinger | 5bdf298 | 2010-06-14 12:42:05 +0000 | [diff] [blame] | 558 | NEED_SERIAL := yes |
| 559 | NEED_NET := yes |
Carl-Daniel Hailfinger | 6be7411 | 2009-08-12 16:17:41 +0000 | [diff] [blame] | 560 | endif |
| 561 | |
Carl-Daniel Hailfinger | e7fdd6e | 2010-07-21 10:26:01 +0000 | [diff] [blame] | 562 | ifeq ($(CONFIG_RAYER_SPI), yes) |
| 563 | FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1' |
| 564 | PROGRAMMER_OBJS += rayer_spi.o |
| 565 | # Actually, NEED_PCI is wrong. NEED_IOPORT_ACCESS would be more correct. |
| 566 | NEED_PCI := yes |
| 567 | endif |
| 568 | |
Virgil-Adrian Teaca | da7c545 | 2012-04-30 23:11:06 +0000 | [diff] [blame] | 569 | ifeq ($(CONFIG_PONY_SPI), yes) |
| 570 | FEATURE_CFLAGS += -D'CONFIG_PONY_SPI=1' |
| 571 | PROGRAMMER_OBJS += pony_spi.o |
| 572 | NEED_SERIAL := yes |
| 573 | endif |
| 574 | |
Carl-Daniel Hailfinger | 547872b | 2009-09-28 13:15:16 +0000 | [diff] [blame] | 575 | ifeq ($(CONFIG_BITBANG_SPI), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 576 | FEATURE_CFLAGS += -D'CONFIG_BITBANG_SPI=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 577 | PROGRAMMER_OBJS += bitbang_spi.o |
Carl-Daniel Hailfinger | 547872b | 2009-09-28 13:15:16 +0000 | [diff] [blame] | 578 | endif |
| 579 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 580 | ifeq ($(CONFIG_NIC3COM), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 581 | FEATURE_CFLAGS += -D'CONFIG_NIC3COM=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 582 | PROGRAMMER_OBJS += nic3com.o |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 583 | NEED_PCI := yes |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 584 | endif |
Carl-Daniel Hailfinger | 6be7411 | 2009-08-12 16:17:41 +0000 | [diff] [blame] | 585 | |
Uwe Hermann | 2bc98f6 | 2009-09-30 18:29:55 +0000 | [diff] [blame] | 586 | ifeq ($(CONFIG_GFXNVIDIA), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 587 | FEATURE_CFLAGS += -D'CONFIG_GFXNVIDIA=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 588 | PROGRAMMER_OBJS += gfxnvidia.o |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 589 | NEED_PCI := yes |
Uwe Hermann | 2bc98f6 | 2009-09-30 18:29:55 +0000 | [diff] [blame] | 590 | endif |
| 591 | |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 592 | ifeq ($(CONFIG_SATASII), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 593 | FEATURE_CFLAGS += -D'CONFIG_SATASII=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 594 | PROGRAMMER_OBJS += satasii.o |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 595 | NEED_PCI := yes |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 596 | endif |
| 597 | |
Uwe Hermann | ddd5c9e | 2010-02-21 21:17:00 +0000 | [diff] [blame] | 598 | ifeq ($(CONFIG_ATAHPT), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 599 | FEATURE_CFLAGS += -D'CONFIG_ATAHPT=1' |
Uwe Hermann | ddd5c9e | 2010-02-21 21:17:00 +0000 | [diff] [blame] | 600 | PROGRAMMER_OBJS += atahpt.o |
| 601 | NEED_PCI := yes |
| 602 | endif |
| 603 | |
Jonathan Kollasch | 7f0f3fa | 2014-06-01 10:26:23 +0000 | [diff] [blame] | 604 | ifeq ($(CONFIG_ATAVIA), yes) |
| 605 | FEATURE_CFLAGS += -D'CONFIG_ATAVIA=1' |
| 606 | PROGRAMMER_OBJS += atavia.o |
| 607 | NEED_PCI := yes |
| 608 | endif |
| 609 | |
Kyösti Mälkki | 72d42f8 | 2014-06-01 23:48:31 +0000 | [diff] [blame] | 610 | ifeq ($(CONFIG_IT8212), yes) |
| 611 | FEATURE_CFLAGS += -D'CONFIG_IT8212=1' |
| 612 | PROGRAMMER_OBJS += it8212.o |
| 613 | NEED_PCI := yes |
| 614 | endif |
| 615 | |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 616 | ifeq ($(CONFIG_FT2232_SPI), yes) |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 617 | # This is a totally ugly hack. |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 618 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_FT2232_SPI=1'") |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 619 | NEED_FTDI := yes |
| 620 | PROGRAMMER_OBJS += ft2232_spi.o |
| 621 | endif |
| 622 | |
| 623 | ifeq ($(CONFIG_USBBLASTER_SPI), yes) |
| 624 | # This is a totally ugly hack. |
| 625 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_USBBLASTER_SPI=1'") |
| 626 | NEED_FTDI := yes |
| 627 | PROGRAMMER_OBJS += usbblaster_spi.o |
| 628 | endif |
| 629 | |
Justin Chevrier | 66e554b | 2015-02-08 21:58:10 +0000 | [diff] [blame] | 630 | ifeq ($(CONFIG_PICKIT2_SPI), yes) |
| 631 | FEATURE_CFLAGS += -D'CONFIG_PICKIT2_SPI=1' |
| 632 | PROGRAMMER_OBJS += pickit2_spi.o |
| 633 | NEED_USB := yes |
| 634 | endif |
| 635 | |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 636 | ifeq ($(NEED_FTDI), yes) |
Alexandru Gagniuc | 3d06abe | 2015-12-25 22:42:45 +0000 | [diff] [blame] | 637 | FTDILIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libftdi1 || pkg-config --libs libftdi || printf "%s" "-lftdi -lusb") |
Ilya A. Volynets-Evenbakh | 2c714ab | 2012-09-26 00:47:09 +0000 | [diff] [blame] | 638 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'") |
Alexandru Gagniuc | 3d06abe | 2015-12-25 22:42:45 +0000 | [diff] [blame] | 639 | FTDI_INCLUDES := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --cflags-only-I libftdi1) |
| 640 | FEATURE_CFLAGS += $(FTDI_INCLUDES) |
Jörg Mayer | 8776db2 | 2009-11-16 14:05:13 +0000 | [diff] [blame] | 641 | FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)") |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 642 | # We can't set NEED_USB here because that would transform libftdi auto-enabling |
| 643 | # into a hard requirement for libusb, defeating the purpose of auto-enabling. |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 644 | endif |
| 645 | |
| 646 | ifeq ($(CONFIG_DUMMY), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 647 | FEATURE_CFLAGS += -D'CONFIG_DUMMY=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 648 | PROGRAMMER_OBJS += dummyflasher.o |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 649 | endif |
| 650 | |
| 651 | ifeq ($(CONFIG_DRKAISER), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 652 | FEATURE_CFLAGS += -D'CONFIG_DRKAISER=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 653 | PROGRAMMER_OBJS += drkaiser.o |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 654 | NEED_PCI := yes |
Carl-Daniel Hailfinger | 4740c6f | 2009-09-16 10:09:21 +0000 | [diff] [blame] | 655 | endif |
Carl-Daniel Hailfinger | 6be7411 | 2009-08-12 16:17:41 +0000 | [diff] [blame] | 656 | |
Joerg Fischer | 5665ef3 | 2010-05-21 21:54:07 +0000 | [diff] [blame] | 657 | ifeq ($(CONFIG_NICREALTEK), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 658 | FEATURE_CFLAGS += -D'CONFIG_NICREALTEK=1' |
Joerg Fischer | 5665ef3 | 2010-05-21 21:54:07 +0000 | [diff] [blame] | 659 | PROGRAMMER_OBJS += nicrealtek.o |
| 660 | NEED_PCI := yes |
| 661 | endif |
| 662 | |
Andrew Morgan | c29c2e7 | 2010-06-07 22:37:54 +0000 | [diff] [blame] | 663 | ifeq ($(CONFIG_NICNATSEMI), yes) |
| 664 | FEATURE_CFLAGS += -D'CONFIG_NICNATSEMI=1' |
| 665 | PROGRAMMER_OBJS += nicnatsemi.o |
| 666 | NEED_PCI := yes |
| 667 | endif |
| 668 | |
Carl-Daniel Hailfinger | b713d2e | 2011-05-08 00:24:18 +0000 | [diff] [blame] | 669 | ifeq ($(CONFIG_NICINTEL), yes) |
| 670 | FEATURE_CFLAGS += -D'CONFIG_NICINTEL=1' |
| 671 | PROGRAMMER_OBJS += nicintel.o |
| 672 | NEED_PCI := yes |
| 673 | endif |
| 674 | |
Idwer Vollering | 004f4b7 | 2010-09-03 18:21:21 +0000 | [diff] [blame] | 675 | ifeq ($(CONFIG_NICINTEL_SPI), yes) |
| 676 | FEATURE_CFLAGS += -D'CONFIG_NICINTEL_SPI=1' |
| 677 | PROGRAMMER_OBJS += nicintel_spi.o |
| 678 | NEED_PCI := yes |
| 679 | endif |
| 680 | |
Ricardo Ribalda Delgado | 2a41f0a | 2014-07-28 20:35:21 +0000 | [diff] [blame] | 681 | ifeq ($(CONFIG_NICINTEL_EEPROM), yes) |
| 682 | FEATURE_CFLAGS += -D'CONFIG_NICINTEL_EEPROM=1' |
| 683 | PROGRAMMER_OBJS += nicintel_eeprom.o |
| 684 | NEED_PCI := yes |
| 685 | endif |
| 686 | |
Mark Marshall | 90021f2 | 2010-12-03 14:48:11 +0000 | [diff] [blame] | 687 | ifeq ($(CONFIG_OGP_SPI), yes) |
| 688 | FEATURE_CFLAGS += -D'CONFIG_OGP_SPI=1' |
| 689 | PROGRAMMER_OBJS += ogp_spi.o |
| 690 | NEED_PCI := yes |
| 691 | endif |
| 692 | |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 693 | ifeq ($(CONFIG_BUSPIRATE_SPI), yes) |
| 694 | FEATURE_CFLAGS += -D'CONFIG_BUSPIRATE_SPI=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 695 | PROGRAMMER_OBJS += buspirate_spi.o |
Carl-Daniel Hailfinger | 5bdf298 | 2010-06-14 12:42:05 +0000 | [diff] [blame] | 696 | NEED_SERIAL := yes |
Carl-Daniel Hailfinger | 5cca01f | 2009-11-24 00:20:03 +0000 | [diff] [blame] | 697 | endif |
| 698 | |
Carl-Daniel Hailfinger | d38fac8 | 2010-01-19 11:15:48 +0000 | [diff] [blame] | 699 | ifeq ($(CONFIG_DEDIPROG), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 700 | FEATURE_CFLAGS += -D'CONFIG_DEDIPROG=1' |
Carl-Daniel Hailfinger | d38fac8 | 2010-01-19 11:15:48 +0000 | [diff] [blame] | 701 | PROGRAMMER_OBJS += dediprog.o |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 702 | NEED_USB := yes |
Carl-Daniel Hailfinger | d38fac8 | 2010-01-19 11:15:48 +0000 | [diff] [blame] | 703 | endif |
| 704 | |
Carl-Daniel Hailfinger | 9a1105c | 2011-02-04 21:37:59 +0000 | [diff] [blame] | 705 | ifeq ($(CONFIG_SATAMV), yes) |
| 706 | FEATURE_CFLAGS += -D'CONFIG_SATAMV=1' |
| 707 | PROGRAMMER_OBJS += satamv.o |
| 708 | NEED_PCI := yes |
| 709 | endif |
| 710 | |
Carl-Daniel Hailfinger | 8541d23 | 2012-02-16 21:00:27 +0000 | [diff] [blame] | 711 | ifeq ($(CONFIG_LINUX_SPI), yes) |
Stefan Tauner | 8868db3 | 2012-03-13 00:18:19 +0000 | [diff] [blame] | 712 | # This is a totally ugly hack. |
| 713 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'") |
Carl-Daniel Hailfinger | 8541d23 | 2012-02-16 21:00:27 +0000 | [diff] [blame] | 714 | PROGRAMMER_OBJS += linux_spi.o |
| 715 | endif |
| 716 | |
Alexandre Boeglin | 80e6471 | 2014-12-20 20:25:19 +0000 | [diff] [blame] | 717 | ifeq ($(CONFIG_MSTARDDC_SPI), yes) |
| 718 | # This is a totally ugly hack. |
| 719 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'") |
| 720 | NEED_LINUX_I2C := yes |
| 721 | PROGRAMMER_OBJS += mstarddc_spi.o |
| 722 | endif |
| 723 | |
Carl-Daniel Hailfinger | 5bdf298 | 2010-06-14 12:42:05 +0000 | [diff] [blame] | 724 | ifeq ($(NEED_SERIAL), yes) |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 725 | LIB_OBJS += serial.o |
Carl-Daniel Hailfinger | 5bdf298 | 2010-06-14 12:42:05 +0000 | [diff] [blame] | 726 | endif |
| 727 | |
| 728 | ifeq ($(NEED_NET), yes) |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 729 | ifeq ($(TARGET_OS), SunOS) |
Carl-Daniel Hailfinger | 5bdf298 | 2010-06-14 12:42:05 +0000 | [diff] [blame] | 730 | LIBS += -lsocket |
Carl-Daniel Hailfinger | 5cca01f | 2009-11-24 00:20:03 +0000 | [diff] [blame] | 731 | endif |
Carl-Daniel Hailfinger | e51ea10 | 2009-11-23 19:20:11 +0000 | [diff] [blame] | 732 | endif |
| 733 | |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 734 | ifeq ($(NEED_PCI), yes) |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 735 | CHECK_LIBPCI = yes |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 736 | FEATURE_CFLAGS += -D'NEED_PCI=1' |
Stefan Tauner | 5673450 | 2015-02-08 21:58:04 +0000 | [diff] [blame] | 737 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'") |
| 738 | |
Carl-Daniel Hailfinger | fb0828f | 2010-02-12 19:35:25 +0000 | [diff] [blame] | 739 | PROGRAMMER_OBJS += pcidev.o physmap.o hwaccess.o |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 740 | ifeq ($(TARGET_OS), NetBSD) |
Carl-Daniel Hailfinger | 460b282 | 2010-06-04 23:24:57 +0000 | [diff] [blame] | 741 | # The libpci we want is called libpciutils on NetBSD and needs NetBSD libpci. |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 742 | PCILIBS += -lpciutils -lpci |
Carl-Daniel Hailfinger | 460b282 | 2010-06-04 23:24:57 +0000 | [diff] [blame] | 743 | # For (i386|x86_64)_iopl(2). |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 744 | PCILIBS += -l$(shell uname -p) |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 745 | else |
Stefan Tauner | be62d3f | 2015-01-10 09:32:44 +0000 | [diff] [blame] | 746 | |
Stefan Tauner | 449abe2 | 2013-09-11 23:34:57 +0000 | [diff] [blame] | 747 | PCILIBS += -lpci |
Stefan Tauner | be62d3f | 2015-01-10 09:32:44 +0000 | [diff] [blame] | 748 | |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 749 | ifeq ($(TARGET_OS), OpenBSD) |
Carl-Daniel Hailfinger | b63b067 | 2010-07-02 17:12:50 +0000 | [diff] [blame] | 750 | # For (i386|amd64)_iopl(2). |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 751 | PCILIBS += -l$(shell uname -m) |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 752 | else |
| 753 | ifeq ($(TARGET_OS), Darwin) |
| 754 | # DirectHW framework can be found in the DirectHW library. |
Stefan Tauner | e34e3e8 | 2013-01-01 00:06:51 +0000 | [diff] [blame] | 755 | PCILIBS += -framework IOKit -framework DirectHW |
Carl-Daniel Hailfinger | b63b067 | 2010-07-02 17:12:50 +0000 | [diff] [blame] | 756 | endif |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 757 | endif |
Jonathan A. Kollasch | 3646c8f | 2010-01-08 21:18:08 +0000 | [diff] [blame] | 758 | endif |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 759 | endif |
| 760 | |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 761 | ifeq ($(NEED_USB), yes) |
| 762 | CHECK_LIBUSB0 = yes |
| 763 | FEATURE_CFLAGS += -D'NEED_USB=1' |
Alexandru Gagniuc | 3d06abe | 2015-12-25 22:42:45 +0000 | [diff] [blame] | 764 | USBLIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libusb || printf "%s" "-lusb") |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 765 | endif |
| 766 | |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 767 | ifeq ($(CONFIG_PRINT_WIKI), yes) |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 768 | FEATURE_CFLAGS += -D'CONFIG_PRINT_WIKI=1' |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 769 | CLI_OBJS += print_wiki.o |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 770 | endif |
| 771 | |
Carl-Daniel Hailfinger | 132e2ec | 2010-03-27 16:36:40 +0000 | [diff] [blame] | 772 | FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'") |
| 773 | |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 774 | # We could use PULLED_IN_LIBS, but that would be ugly. |
| 775 | FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz") |
| 776 | |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 777 | LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS) |
Stefan Tauner | d94d25d | 2012-07-28 03:17:15 +0000 | [diff] [blame] | 778 | OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS) |
Sean Nelson | 5d13464 | 2009-12-24 16:54:21 +0000 | [diff] [blame] | 779 | |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 780 | all: hwlibs features $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8 |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 781 | ifeq ($(ARCH), x86) |
| 782 | @+$(MAKE) -C util/ich_descriptors_tool/ TARGET_OS=$(TARGET_OS) EXEC_SUFFIX=$(EXEC_SUFFIX) |
| 783 | endif |
| 784 | |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 785 | $(PROGRAM)$(EXEC_SUFFIX): $(OBJS) |
Carl-Daniel Hailfinger | 11990da | 2013-07-13 23:21:05 +0000 | [diff] [blame] | 786 | $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS) $(USBLIBS) |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 787 | |
Patrick Georgi | 97bc95c | 2011-03-08 07:17:44 +0000 | [diff] [blame] | 788 | libflashrom.a: $(LIBFLASHROM_OBJS) |
| 789 | $(AR) rcs $@ $^ |
| 790 | $(RANLIB) $@ |
| 791 | |
Carl-Daniel Hailfinger | 8ef7dce | 2009-07-10 20:19:48 +0000 | [diff] [blame] | 792 | # TAROPTIONS reduces information leakage from the packager's system. |
| 793 | # If other tar programs support command line arguments for setting uid/gid of |
| 794 | # stored files, they can be handled here as well. |
| 795 | TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root") |
Carl-Daniel Hailfinger | b18ecbc | 2009-06-19 14:20:34 +0000 | [diff] [blame] | 796 | |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 797 | %.o: %.c .features |
Carl-Daniel Hailfinger | a8da224 | 2012-08-15 23:06:32 +0000 | [diff] [blame] | 798 | $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $< |
Clark Rawlins | 02016f7 | 2008-02-14 23:22:20 +0000 | [diff] [blame] | 799 | |
Carl-Daniel Hailfinger | a0020df | 2010-05-30 22:35:14 +0000 | [diff] [blame] | 800 | # Make sure to add all names of generated binaries here. |
| 801 | # This includes all frontends and libflashrom. |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 802 | # We don't use EXEC_SUFFIX here because we want to clean everything. |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 803 | clean: |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 804 | rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a *.o *.d $(PROGRAM).8 |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 805 | @+$(MAKE) -C util/ich_descriptors_tool/ clean |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 806 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 807 | distclean: clean |
Stefan Reinauer | e2f0158 | 2010-06-07 11:08:07 +0000 | [diff] [blame] | 808 | rm -f .features .libdeps |
Christian Ruppert | db9d9f4 | 2009-05-14 14:17:07 +0000 | [diff] [blame] | 809 | |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 810 | strip: $(PROGRAM)$(EXEC_SUFFIX) |
| 811 | $(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX) |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 812 | |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 813 | # to define test programs we use verbatim variables, which get exported |
| 814 | # to environment variables and are referenced with $$<varname> later |
| 815 | |
| 816 | define COMPILER_TEST |
| 817 | int main(int argc, char **argv) |
| 818 | { |
| 819 | (void) argc; |
| 820 | (void) argv; |
| 821 | return 0; |
| 822 | } |
| 823 | endef |
| 824 | export COMPILER_TEST |
| 825 | |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 826 | compiler: featuresavailable |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 827 | @printf "Checking for a C compiler... " |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 828 | @echo "$$COMPILER_TEST" > .test.c |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 829 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >/dev/null && \ |
Carl-Daniel Hailfinger | 4cb7a96 | 2009-06-16 09:31:51 +0000 | [diff] [blame] | 830 | echo "found." || ( echo "not found."; \ |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 831 | rm -f .test.c .test$(EXEC_SUFFIX); exit 1) |
| 832 | @rm -f .test.c .test$(EXEC_SUFFIX) |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 833 | @printf "Target arch is " |
Carl-Daniel Hailfinger | 91199a1 | 2011-07-07 06:59:18 +0000 | [diff] [blame] | 834 | @# FreeBSD wc will output extraneous whitespace. |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 835 | @echo $(ARCH)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \ |
Carl-Daniel Hailfinger | 91199a1 | 2011-07-07 06:59:18 +0000 | [diff] [blame] | 836 | ( echo "unknown. Aborting."; exit 1) |
| 837 | @printf "%s\n" '$(ARCH)' |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 838 | @printf "Target OS is " |
| 839 | @# FreeBSD wc will output extraneous whitespace. |
| 840 | @echo $(TARGET_OS)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \ |
| 841 | ( echo "unknown. Aborting."; exit 1) |
| 842 | @printf "%s\n" '$(TARGET_OS)' |
Stefan Tauner | d6c17f6 | 2013-09-12 14:04:31 +0000 | [diff] [blame] | 843 | ifeq ($(TARGET_OS), libpayload) |
| 844 | @$(CC) --version 2>&1 | grep -q coreboot || \ |
| 845 | ( echo "Warning: It seems you are not using coreboot's reference compiler."; \ |
| 846 | echo "This might work but usually does not, please beware." ) |
| 847 | endif |
Carl-Daniel Hailfinger | 4cb7a96 | 2009-06-16 09:31:51 +0000 | [diff] [blame] | 848 | |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 849 | define LIBPCI_TEST |
| 850 | /* Avoid a failing test due to libpci header symbol shadowing breakage */ |
| 851 | #define index shadow_workaround_index |
Stefan Tauner | 8d21ff1 | 2015-01-10 09:33:06 +0000 | [diff] [blame] | 852 | #if !defined __NetBSD__ |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 853 | #include <pci/pci.h> |
Stefan Tauner | c65b855 | 2013-09-12 15:48:39 +0000 | [diff] [blame] | 854 | #else |
| 855 | #include <pciutils/pci.h> |
| 856 | #endif |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 857 | struct pci_access *pacc; |
| 858 | int main(int argc, char **argv) |
| 859 | { |
| 860 | (void) argc; |
| 861 | (void) argv; |
| 862 | pacc = pci_alloc(); |
| 863 | return 0; |
| 864 | } |
| 865 | endef |
| 866 | export LIBPCI_TEST |
| 867 | |
Stefan Tauner | 5673450 | 2015-02-08 21:58:04 +0000 | [diff] [blame] | 868 | define PCI_GET_DEV_TEST |
| 869 | /* Avoid a failing test due to libpci header symbol shadowing breakage */ |
| 870 | #define index shadow_workaround_index |
| 871 | #if !defined __NetBSD__ |
| 872 | #include <pci/pci.h> |
| 873 | #else |
| 874 | #include <pciutils/pci.h> |
| 875 | #endif |
| 876 | struct pci_access *pacc; |
| 877 | struct pci_dev *dev = {0}; |
| 878 | int main(int argc, char **argv) |
| 879 | { |
| 880 | (void) argc; |
| 881 | (void) argv; |
| 882 | pacc = pci_alloc(); |
| 883 | dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1); |
| 884 | return 0; |
| 885 | } |
| 886 | endef |
| 887 | export PCI_GET_DEV_TEST |
| 888 | |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 889 | define LIBUSB0_TEST |
Stefan Tauner | 0cbd8c2 | 2015-01-26 22:06:04 +0000 | [diff] [blame] | 890 | #include "platform.h" |
| 891 | #if IS_WINDOWS |
| 892 | #include <lusb0_usb.h> |
| 893 | #else |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 894 | #include <usb.h> |
Stefan Tauner | 0cbd8c2 | 2015-01-26 22:06:04 +0000 | [diff] [blame] | 895 | #endif |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 896 | int main(int argc, char **argv) |
| 897 | { |
| 898 | (void) argc; |
| 899 | (void) argv; |
| 900 | usb_init(); |
| 901 | return 0; |
| 902 | } |
| 903 | endef |
| 904 | export LIBUSB0_TEST |
| 905 | |
| 906 | hwlibs: compiler |
| 907 | @printf "" > .libdeps |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 908 | ifeq ($(CHECK_LIBPCI), yes) |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 909 | @printf "Checking for libpci headers... " |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 910 | @echo "$$LIBPCI_TEST" > .test.c |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 911 | @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null && \ |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 912 | echo "found." || ( echo "not found."; echo; \ |
| 913 | echo "Please install libpci headers (package pciutils-devel)."; \ |
| 914 | echo "See README for more information."; echo; \ |
| 915 | rm -f .test.c .test.o; exit 1) |
Stefan Tauner | 5673450 | 2015-02-08 21:58:04 +0000 | [diff] [blame] | 916 | @printf "Checking version of pci_get_dev... " |
| 917 | @echo "$$PCI_GET_DEV_TEST" > .test.c |
| 918 | @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null 2>&1 && \ |
| 919 | ( echo "new version (including PCI domain parameter)."; echo "OLD_PCI_GET_DEV := no" >> .libdeps ) || \ |
| 920 | ( echo "old version (without PCI domain parameter)."; echo "OLD_PCI_GET_DEV := yes" >> .libdeps ) |
Carl-Daniel Hailfinger | 9979eac | 2010-03-22 12:29:45 +0000 | [diff] [blame] | 921 | @printf "Checking if libpci is present and sufficient... " |
Carl-Daniel Hailfinger | 26148ae | 2012-11-29 22:22:04 +0000 | [diff] [blame] | 922 | @$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) >/dev/null && \ |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 923 | echo "yes." || ( echo "no."; \ |
Carl-Daniel Hailfinger | 9979eac | 2010-03-22 12:29:45 +0000 | [diff] [blame] | 924 | printf "Checking if libz+libpci are present and sufficient..."; \ |
Carl-Daniel Hailfinger | 26148ae | 2012-11-29 22:22:04 +0000 | [diff] [blame] | 925 | $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) -lz >/dev/null && \ |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 926 | ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo; \ |
Carl-Daniel Hailfinger | 9979eac | 2010-03-22 12:29:45 +0000 | [diff] [blame] | 927 | echo "Please install libpci (package pciutils) and/or libz."; \ |
Carl-Daniel Hailfinger | a472b8b | 2009-10-03 17:08:02 +0000 | [diff] [blame] | 928 | echo "See README for more information."; echo; \ |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 929 | rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1) ) |
| 930 | @rm -f .test.c .test.o .test$(EXEC_SUFFIX) |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 931 | endif |
| 932 | ifeq ($(CHECK_LIBUSB0), yes) |
| 933 | @printf "Checking for libusb-0.1/libusb-compat headers... " |
| 934 | @echo "$$LIBUSB0_TEST" > .test.c |
| 935 | @$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >/dev/null && \ |
| 936 | echo "found." || ( echo "not found."; echo; \ |
| 937 | echo "Please install libusb-0.1 headers or libusb-compat headers."; \ |
| 938 | echo "See README for more information."; echo; \ |
| 939 | rm -f .test.c .test.o; exit 1) |
| 940 | @printf "Checking if libusb-0.1 is usable... " |
Carl-Daniel Hailfinger | 26148ae | 2012-11-29 22:22:04 +0000 | [diff] [blame] | 941 | @$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USBLIBS) >/dev/null && \ |
Carl-Daniel Hailfinger | e7a39bf | 2012-11-20 21:06:16 +0000 | [diff] [blame] | 942 | echo "yes." || ( echo "no."; \ |
| 943 | echo "Please install libusb-0.1 or libusb-compat."; \ |
| 944 | echo "See README for more information."; echo; \ |
| 945 | rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1) |
| 946 | @rm -f .test.c .test.o .test$(EXEC_SUFFIX) |
Carl-Daniel Hailfinger | 8a59ff0 | 2009-12-24 03:33:11 +0000 | [diff] [blame] | 947 | endif |
Stefan Reinauer | 53e9625 | 2005-12-01 16:19:24 +0000 | [diff] [blame] | 948 | |
Carl-Daniel Hailfinger | b18ecbc | 2009-06-19 14:20:34 +0000 | [diff] [blame] | 949 | .features: features |
| 950 | |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 951 | # If a user does not explicitly request a non-working feature, we should |
| 952 | # silently disable it. However, if a non-working (does not compile) feature |
| 953 | # is explicitly requested, we should bail out with a descriptive error message. |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 954 | # We also have to check that at least one programmer driver is enabled. |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 955 | featuresavailable: |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 956 | ifeq ($(PROGRAMMER_OBJS),) |
| 957 | @echo "You have to enable at least one programmer driver!" |
| 958 | @false |
| 959 | endif |
| 960 | ifneq ($(UNSUPPORTED_FEATURES), ) |
Carl-Daniel Hailfinger | 5d3fcb9 | 2010-06-14 18:40:59 +0000 | [diff] [blame] | 961 | @echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)" |
| 962 | @false |
| 963 | endif |
| 964 | |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 965 | define FTDI_TEST |
Stefan Tauner | 5c316f9 | 2015-02-08 21:57:52 +0000 | [diff] [blame] | 966 | #include <stdlib.h> |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 967 | #include <ftdi.h> |
| 968 | struct ftdi_context *ftdic = NULL; |
| 969 | int main(int argc, char **argv) |
| 970 | { |
| 971 | (void) argc; |
| 972 | (void) argv; |
| 973 | return ftdi_init(ftdic); |
| 974 | } |
| 975 | endef |
| 976 | export FTDI_TEST |
| 977 | |
Ilya A. Volynets-Evenbakh | 2c714ab | 2012-09-26 00:47:09 +0000 | [diff] [blame] | 978 | define FTDI_232H_TEST |
| 979 | #include <ftdi.h> |
| 980 | enum ftdi_chip_type type = TYPE_232H; |
| 981 | endef |
| 982 | export FTDI_232H_TEST |
| 983 | |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 984 | define UTSNAME_TEST |
| 985 | #include <sys/utsname.h> |
| 986 | struct utsname osinfo; |
| 987 | int main(int argc, char **argv) |
| 988 | { |
| 989 | (void) argc; |
| 990 | (void) argv; |
| 991 | uname (&osinfo); |
| 992 | return 0; |
| 993 | } |
| 994 | endef |
| 995 | export UTSNAME_TEST |
| 996 | |
Stefan Tauner | 8868db3 | 2012-03-13 00:18:19 +0000 | [diff] [blame] | 997 | define LINUX_SPI_TEST |
| 998 | #include <linux/types.h> |
| 999 | #include <linux/spi/spidev.h> |
| 1000 | |
| 1001 | int main(int argc, char **argv) |
| 1002 | { |
| 1003 | (void) argc; |
| 1004 | (void) argv; |
| 1005 | return 0; |
| 1006 | } |
| 1007 | endef |
| 1008 | export LINUX_SPI_TEST |
| 1009 | |
Alexandre Boeglin | 80e6471 | 2014-12-20 20:25:19 +0000 | [diff] [blame] | 1010 | define LINUX_I2C_TEST |
| 1011 | #include <linux/i2c-dev.h> |
| 1012 | #include <linux/i2c.h> |
| 1013 | |
| 1014 | int main(int argc, char **argv) |
| 1015 | { |
| 1016 | (void) argc; |
| 1017 | (void) argv; |
| 1018 | return 0; |
| 1019 | } |
| 1020 | endef |
| 1021 | export LINUX_I2C_TEST |
| 1022 | |
Carl-Daniel Hailfinger | b18ecbc | 2009-06-19 14:20:34 +0000 | [diff] [blame] | 1023 | features: compiler |
| 1024 | @echo "FEATURES := yes" > .features.tmp |
James Laird | c60de0e | 2013-03-27 13:00:23 +0000 | [diff] [blame] | 1025 | ifeq ($(NEED_FTDI), yes) |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 1026 | @printf "Checking for FTDI support... " |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 1027 | @echo "$$FTDI_TEST" > .featuretest.c |
Alexandru Gagniuc | 3d06abe | 2015-12-25 22:42:45 +0000 | [diff] [blame] | 1028 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ |
Carl-Daniel Hailfinger | b18ecbc | 2009-06-19 14:20:34 +0000 | [diff] [blame] | 1029 | ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ |
| 1030 | ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) |
Ilya A. Volynets-Evenbakh | 2c714ab | 2012-09-26 00:47:09 +0000 | [diff] [blame] | 1031 | @printf "Checking for FT232H support in libftdi... " |
| 1032 | @echo "$$FTDI_232H_TEST" >> .featuretest.c |
Alexandru Gagniuc | 3d06abe | 2015-12-25 22:42:45 +0000 | [diff] [blame] | 1033 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ |
Ilya A. Volynets-Evenbakh | 2c714ab | 2012-09-26 00:47:09 +0000 | [diff] [blame] | 1034 | ( echo "found."; echo "FT232H := yes" >> .features.tmp ) || \ |
| 1035 | ( echo "not found."; echo "FT232H := no" >> .features.tmp ) |
Carl-Daniel Hailfinger | 8a59ff0 | 2009-12-24 03:33:11 +0000 | [diff] [blame] | 1036 | endif |
Stefan Tauner | 8868db3 | 2012-03-13 00:18:19 +0000 | [diff] [blame] | 1037 | ifeq ($(CONFIG_LINUX_SPI), yes) |
| 1038 | @printf "Checking if Linux SPI headers are present... " |
| 1039 | @echo "$$LINUX_SPI_TEST" > .featuretest.c |
| 1040 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ |
| 1041 | ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \ |
| 1042 | ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) |
| 1043 | endif |
Alexandre Boeglin | 80e6471 | 2014-12-20 20:25:19 +0000 | [diff] [blame] | 1044 | ifeq ($(NEED_LINUX_I2C), yes) |
| 1045 | @printf "Checking if Linux I2C headers are present... " |
| 1046 | @echo "$$LINUX_I2C_TEST" > .featuretest.c |
| 1047 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ |
| 1048 | ( echo "yes."; echo "LINUX_I2C_SUPPORT := yes" >> .features.tmp ) || \ |
| 1049 | ( echo "no."; echo "LINUX_I2C_SUPPORT := no" >> .features.tmp ) |
| 1050 | endif |
Stefan Tauner | 5678708 | 2011-08-18 02:27:19 +0000 | [diff] [blame] | 1051 | @printf "Checking for utsname support... " |
| 1052 | @echo "$$UTSNAME_TEST" > .featuretest.c |
| 1053 | @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ |
| 1054 | ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ |
| 1055 | ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) |
| 1056 | @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features |
| 1057 | @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX) |
Paul Fox | 05dfbe6 | 2009-06-16 21:08:06 +0000 | [diff] [blame] | 1058 | |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 1059 | $(PROGRAM).8: $(PROGRAM).8.tmpl |
Stefan Tauner | d5ff845 | 2015-01-10 09:32:07 +0000 | [diff] [blame] | 1060 | @sed -e '1 s#".*".*#"$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl 2>/dev/null)" "$(VERSION)"#' <$< >$@ |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 1061 | |
| 1062 | install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8 |
Uwe Hermann | c2a9c9c | 2009-05-14 14:51:14 +0000 | [diff] [blame] | 1063 | mkdir -p $(DESTDIR)$(PREFIX)/sbin |
Uwe Hermann | 56b2cb0 | 2009-05-21 15:59:58 +0000 | [diff] [blame] | 1064 | mkdir -p $(DESTDIR)$(MANDIR)/man8 |
Carl-Daniel Hailfinger | ddbab71 | 2010-06-14 14:44:08 +0000 | [diff] [blame] | 1065 | $(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin |
Uwe Hermann | 56b2cb0 | 2009-05-21 15:59:58 +0000 | [diff] [blame] | 1066 | $(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8 |
Uwe Hermann | c113b57 | 2006-12-14 00:59:41 +0000 | [diff] [blame] | 1067 | |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 1068 | export: $(PROGRAM).8 |
Carl-Daniel Hailfinger | 48e5e09 | 2009-08-31 16:25:08 +0000 | [diff] [blame] | 1069 | @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME) |
| 1070 | @svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME) |
| 1071 | @sed "s/^SVNVERSION.*/SVNVERSION := $(SVNVERSION)/" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile |
Joerg Mayer | a93d9dc | 2013-08-29 00:38:19 +0000 | [diff] [blame] | 1072 | @cp $(PROGRAM).8 "$(EXPORTDIR)/flashrom-$(RELEASENAME)/$(PROGRAM).8" |
Carl-Daniel Hailfinger | 48e5e09 | 2009-08-31 16:25:08 +0000 | [diff] [blame] | 1073 | @LC_ALL=C svn log >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog |
| 1074 | @echo Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/ |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 1075 | |
| 1076 | tarball: export |
Carl-Daniel Hailfinger | 48e5e09 | 2009-08-31 16:25:08 +0000 | [diff] [blame] | 1077 | @tar cjf $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2 -C $(EXPORTDIR)/ $(TAROPTIONS) flashrom-$(RELEASENAME)/ |
| 1078 | @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME) |
| 1079 | @echo Created $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2 |
Carl-Daniel Hailfinger | a23041c | 2009-06-12 14:49:10 +0000 | [diff] [blame] | 1080 | |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 1081 | djgpp-dos: clean |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 1082 | make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip |
| 1083 | libpayload: clean |
| 1084 | make CC="CC=i386-elf-gcc lpgcc" AR=i386-elf-ar RANLIB=i386-elf-ranlib |
Carl-Daniel Hailfinger | 50415d2 | 2010-03-21 14:54:57 +0000 | [diff] [blame] | 1085 | |
Stefan Tauner | 74dc73f | 2015-03-01 22:04:38 +0000 | [diff] [blame] | 1086 | .PHONY: all install clean distclean compiler hwlibs features export tarball djgpp-dos featuresavailable libpayload |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 1087 | |
Stefan Reinauer | e2f0158 | 2010-06-07 11:08:07 +0000 | [diff] [blame] | 1088 | -include $(OBJS:.o=.d) |