Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 1 | cbfsobj := |
Stefan Reinauer | 2e200cd | 2012-10-30 14:02:45 -0700 | [diff] [blame] | 2 | cbfsobj += cbfstool.o |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 3 | cbfsobj += common.o |
| 4 | cbfsobj += compress.o |
Hung-Te Lin | eab2c81 | 2013-01-29 01:56:17 +0800 | [diff] [blame] | 5 | cbfsobj += cbfs_image.o |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 6 | cbfsobj += cbfs-mkstage.o |
| 7 | cbfsobj += cbfs-mkpayload.o |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 8 | cbfsobj += elfheaders.o |
Aaron Durbin | 4be1674 | 2015-09-15 17:00:23 -0500 | [diff] [blame] | 9 | cbfsobj += rmodule.o |
Ronald G. Minnich | aa2f739 | 2013-12-03 11:13:35 -0800 | [diff] [blame] | 10 | cbfsobj += xdr.o |
Aaron Durbin | 6b0d0d6 | 2012-12-14 17:16:21 -0600 | [diff] [blame] | 11 | cbfsobj += fit.o |
Sol Boucher | e3260a0 | 2015-03-25 13:40:08 -0700 | [diff] [blame] | 12 | cbfsobj += partitioned_file.o |
Aaron Durbin | 8a414a0 | 2015-10-01 17:02:45 -0500 | [diff] [blame] | 13 | cbfsobj += fsp1_1_relocate.o |
Stefan Reinauer | 2e200cd | 2012-10-30 14:02:45 -0700 | [diff] [blame] | 14 | # LZMA |
| 15 | cbfsobj += lzma.o |
| 16 | cbfsobj += LzFind.o |
| 17 | cbfsobj += LzmaDec.o |
| 18 | cbfsobj += LzmaEnc.o |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 19 | # CRYPTOLIB |
| 20 | cbfsobj += 2sha_utility.o |
| 21 | cbfsobj += 2sha1.o |
| 22 | cbfsobj += 2sha256.o |
| 23 | cbfsobj += 2sha512.o |
Sol Boucher | e3260a0 | 2015-03-25 13:40:08 -0700 | [diff] [blame] | 24 | # FMAP |
| 25 | cbfsobj += fmap.o |
| 26 | cbfsobj += kv_pair.o |
| 27 | cbfsobj += valstr.o |
Patrick Georgi | de36d33 | 2013-08-27 20:22:21 +0200 | [diff] [blame] | 28 | # linux as payload |
| 29 | cbfsobj += linux_trampoline.o |
| 30 | cbfsobj += cbfs-payload-linux.o |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 31 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 32 | fmapobj := |
| 33 | fmapobj += fmaptool.o |
Sol Boucher | 023e829 | 2015-03-18 10:13:48 -0700 | [diff] [blame] | 34 | fmapobj += cbfs_sections.o |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 35 | fmapobj += fmap_from_fmd.o |
| 36 | fmapobj += fmd.o |
| 37 | fmapobj += fmd_parser.o |
| 38 | fmapobj += fmd_scanner.o |
| 39 | # FMAP |
| 40 | fmapobj += fmap.o |
| 41 | fmapobj += kv_pair.o |
| 42 | fmapobj += valstr.o |
| 43 | |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 44 | rmodobj := |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 45 | rmodobj += rmodtool.o |
| 46 | rmodobj += rmodule.o |
| 47 | rmodobj += common.o |
| 48 | rmodobj += elfheaders.o |
| 49 | rmodobj += xdr.o |
| 50 | |
Stefan Reinauer | 354c11d | 2015-09-15 17:41:07 -0700 | [diff] [blame] | 51 | TOOLCFLAGS ?= -Werror -Wall -Wextra |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 52 | TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow |
| 53 | TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 54 | TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h |
Jonathan A. Kollasch | 9d6a17b | 2015-07-06 08:29:00 -0500 | [diff] [blame] | 55 | TOOLCPPFLAGS += -D_XOPEN_SOURCE=700 # strdup() from string.h |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 56 | TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 57 | TOOLCPPFLAGS += -I$(top)/util/cbfstool |
| 58 | TOOLCPPFLAGS += -I$(objutil)/cbfstool |
Paul Kocialkowski | 34ce438 | 2015-09-24 19:00:47 +0200 | [diff] [blame] | 59 | TOOLCPPFLAGS += -I$(top)/src/commonlib/include |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 60 | TOOLCPPFLAGS += -DNEED_VB2_SHA_LIBRARY |
| 61 | TOOLCPPFLAGS += -I$(top)/3rdparty/vboot/firmware/include |
| 62 | TOOLCPPFLAGS += -I$(top)/3rdparty/vboot/firmware/2lib/include |
Aaron Durbin | 8a414a0 | 2015-10-01 17:02:45 -0500 | [diff] [blame] | 63 | # UEFI header file support. It's not pretty, but that's what we currently |
| 64 | # have right now. |
| 65 | TOOLCPPFLAGS += -I$(top)/src |
| 66 | TOOLCPPFLAGS += -I$(top)/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include |
| 67 | |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 68 | TOOLLDFLAGS ?= |
Werner Zeh | 8c3780a | 2015-10-02 09:56:32 +0200 | [diff] [blame] | 69 | HOSTCFLAGS += -fms-extensions |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 70 | |
Zheng Bao | c31cdd8 | 2012-10-22 16:39:24 +0800 | [diff] [blame] | 71 | ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32) |
Patrick Georgi | cdeb1c4 | 2015-09-16 16:19:26 +0200 | [diff] [blame] | 72 | TOOLCFLAGS += -mno-ms-bitfields |
Zheng Bao | c31cdd8 | 2012-10-22 16:39:24 +0800 | [diff] [blame] | 73 | endif |
Stefan Reinauer | 354c11d | 2015-09-15 17:41:07 -0700 | [diff] [blame] | 74 | ifeq ($(shell uname -o 2>/dev/null), Cygwin) |
| 75 | TOOLCFLAGS+=-std=gnu99 |
| 76 | TOOLCPPFLAGS+=-D_GNU_SOURCE |
| 77 | else |
| 78 | TOOLCFLAGS+=-std=c99 |
| 79 | endif |
Zheng Bao | c31cdd8 | 2012-10-22 16:39:24 +0800 | [diff] [blame] | 80 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 81 | $(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c |
| 82 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 83 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 84 | |
Patrick Georgi | a2acbc7 | 2010-04-16 22:48:57 +0000 | [diff] [blame] | 85 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c |
| 86 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 87 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 88 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 89 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/flashmap/%.c |
| 90 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 91 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 92 | |
Stefan Reinauer | aa3f7ba | 2013-03-28 16:51:45 -0700 | [diff] [blame] | 93 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c |
| 94 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 95 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 96 | |
Stefan Reinauer | 2e200cd | 2012-10-30 14:02:45 -0700 | [diff] [blame] | 97 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c |
Zheng Bao | a182cbd | 2012-12-14 15:44:59 +0800 | [diff] [blame] | 98 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 99 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 100 | |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 101 | $(objutil)/cbfstool/%.o: $(top)/3rdparty/vboot/firmware/2lib/%.c |
| 102 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 103 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 104 | |
Aaron Durbin | 8a414a0 | 2015-10-01 17:02:45 -0500 | [diff] [blame] | 105 | $(objutil)/cbfstool/%.o: $(top)/src/commonlib/%.c |
| 106 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 107 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 108 | |
Patrick Georgi | 913e171 | 2014-07-15 12:28:12 +0200 | [diff] [blame] | 109 | $(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) |
Stefan Reinauer | aa3f7ba | 2013-03-28 16:51:45 -0700 | [diff] [blame] | 110 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 111 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 112 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 113 | $(objutil)/cbfstool/fmaptool: $(addprefix $(objutil)/cbfstool/,$(fmapobj)) |
| 114 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
| 115 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(fmapobj)) |
| 116 | |
Patrick Georgi | 913e171 | 2014-07-15 12:28:12 +0200 | [diff] [blame] | 117 | $(objutil)/cbfstool/rmodtool: $(addprefix $(objutil)/cbfstool/,$(rmodobj)) |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 118 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 119 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 120 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 121 | # Yacc source is superset of header |
Kyösti Mälkki | c877149 | 2015-05-09 08:06:02 +0300 | [diff] [blame] | 122 | $(objutil)/cbfstool/fmd.o: TOOLCFLAGS += -Wno-redundant-decls |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 123 | $(objutil)/cbfstool/fmd_parser.o: TOOLCFLAGS += -Wno-redundant-decls |
Kyösti Mälkki | c877149 | 2015-05-09 08:06:02 +0300 | [diff] [blame] | 124 | # Lex generates unneeded functions and declarations |
| 125 | $(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-redundant-decls |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 126 | $(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-unused-function |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 127 | # Tolerate lzma sdk warnings |
| 128 | $(objutil)/cbfstool/LzmaEnc.o: TOOLCFLAGS += -Wno-sign-compare -Wno-cast-qual |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 129 | # Tolerate vboot warnings |
| 130 | $(objutil)/cbfstool/2sha_utility.o: TOOLCFLAGS += -Wno-sign-compare |
| 131 | $(objutil)/cbfstool/2sha1.o: TOOLCFLAGS += -Wno-cast-qual |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 132 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 133 | $(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_parser.h |
| 134 | $(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_scanner.h |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 135 | $(objutil)/cbfstool/fmd_parser.o: $(objutil)/cbfstool/fmd.o |
| 136 | $(objutil)/cbfstool/fmd_scanner.o: $(objutil)/cbfstool/fmd.o |
| 137 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 138 | $(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 139 | mkdir -p $(dir $@) |
| 140 | cp $< $@ |
| 141 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 142 | ifeq ($(CONFIG_FMD_GENPARSER),y) |
| 143 | TOOLLEX := lex |
| 144 | TOOLYACC := yacc |
| 145 | |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 146 | # the .c rule also creates .h |
| 147 | $(top)/util/cbfstool/fmd_scanner.h_shipped: $(top)/util/cbfstool/fmd_scanner.c_shipped |
| 148 | $(top)/util/cbfstool/fmd_scanner.c_shipped: $(top)/util/cbfstool/fmd_scanner.l |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 149 | echo " LEX util/cbfstool/fmd_scanner.[ch]" |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 150 | $(TOOLLEX) -t --header-file=$(top)/util/cbfstool/fmd_scanner.h_shipped $< >$(top)/util/cbfstool/fmd_scanner.c_shipped |
| 151 | |
| 152 | # the .c rule also creates .h |
| 153 | $(top)/util/cbfstool/fmd_parser.h_shipped: $(top)/util/cbfstool/fmd_parser.c_shipped |
| 154 | $(top)/util/cbfstool/fmd_parser.c_shipped: $(top)/util/cbfstool/fmd_parser.y |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 155 | echo " YACC util/cbfstool/fmd_parser.[ch]" |
| 156 | $(TOOLYACC) -d $< |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 157 | mv -f y.tab.c $(top)/util/cbfstool/fmd_parser.c_shipped |
| 158 | mv -f y.tab.h $(top)/util/cbfstool/fmd_parser.h_shipped |
| 159 | |
| 160 | endif # CONFIG_FMD_GENPARSER |