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 |
Stefan Reinauer | 2e200cd | 2012-10-30 14:02:45 -0700 | [diff] [blame] | 13 | # LZMA |
| 14 | cbfsobj += lzma.o |
| 15 | cbfsobj += LzFind.o |
| 16 | cbfsobj += LzmaDec.o |
| 17 | cbfsobj += LzmaEnc.o |
Sol Boucher | e3260a0 | 2015-03-25 13:40:08 -0700 | [diff] [blame] | 18 | # FMAP |
| 19 | cbfsobj += fmap.o |
| 20 | cbfsobj += kv_pair.o |
| 21 | cbfsobj += valstr.o |
Patrick Georgi | de36d33 | 2013-08-27 20:22:21 +0200 | [diff] [blame] | 22 | # linux as payload |
| 23 | cbfsobj += linux_trampoline.o |
| 24 | cbfsobj += cbfs-payload-linux.o |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 25 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 26 | fmapobj := |
| 27 | fmapobj += fmaptool.o |
Sol Boucher | 023e829 | 2015-03-18 10:13:48 -0700 | [diff] [blame] | 28 | fmapobj += cbfs_sections.o |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 29 | fmapobj += fmap_from_fmd.o |
| 30 | fmapobj += fmd.o |
| 31 | fmapobj += fmd_parser.o |
| 32 | fmapobj += fmd_scanner.o |
| 33 | # FMAP |
| 34 | fmapobj += fmap.o |
| 35 | fmapobj += kv_pair.o |
| 36 | fmapobj += valstr.o |
| 37 | |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 38 | rmodobj := |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 39 | rmodobj += rmodtool.o |
| 40 | rmodobj += rmodule.o |
| 41 | rmodobj += common.o |
| 42 | rmodobj += elfheaders.o |
| 43 | rmodobj += xdr.o |
| 44 | |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 45 | TOOLCFLAGS ?= -std=c99 -Werror -Wall -Wextra |
| 46 | TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow |
| 47 | TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 48 | TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h |
Jonathan A. Kollasch | 9d6a17b | 2015-07-06 08:29:00 -0500 | [diff] [blame] | 49 | TOOLCPPFLAGS += -D_XOPEN_SOURCE=700 # strdup() from string.h |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 50 | TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 51 | TOOLCPPFLAGS += -I$(top)/util/cbfstool |
| 52 | TOOLCPPFLAGS += -I$(objutil)/cbfstool |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 53 | TOOLLDFLAGS ?= |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 54 | |
Zheng Bao | c31cdd8 | 2012-10-22 16:39:24 +0800 | [diff] [blame] | 55 | ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32) |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 56 | TOOLFLAGS+=-mno-ms-bitfields |
Zheng Bao | c31cdd8 | 2012-10-22 16:39:24 +0800 | [diff] [blame] | 57 | endif |
| 58 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 59 | $(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c |
| 60 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 61 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 62 | |
Patrick Georgi | a2acbc7 | 2010-04-16 22:48:57 +0000 | [diff] [blame] | 63 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c |
| 64 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 65 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 66 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 67 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/flashmap/%.c |
| 68 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 69 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 70 | |
Stefan Reinauer | aa3f7ba | 2013-03-28 16:51:45 -0700 | [diff] [blame] | 71 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c |
| 72 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 73 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 74 | |
Stefan Reinauer | 2e200cd | 2012-10-30 14:02:45 -0700 | [diff] [blame] | 75 | $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c |
Zheng Bao | a182cbd | 2012-12-14 15:44:59 +0800 | [diff] [blame] | 76 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 77 | $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 78 | |
Patrick Georgi | 913e171 | 2014-07-15 12:28:12 +0200 | [diff] [blame] | 79 | $(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) |
Stefan Reinauer | aa3f7ba | 2013-03-28 16:51:45 -0700 | [diff] [blame] | 80 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 81 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 82 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 83 | $(objutil)/cbfstool/fmaptool: $(addprefix $(objutil)/cbfstool/,$(fmapobj)) |
| 84 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
| 85 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(fmapobj)) |
| 86 | |
Patrick Georgi | 913e171 | 2014-07-15 12:28:12 +0200 | [diff] [blame] | 87 | $(objutil)/cbfstool/rmodtool: $(addprefix $(objutil)/cbfstool/,$(rmodobj)) |
Aaron Durbin | 4fde5a6 | 2014-03-07 15:11:53 -0600 | [diff] [blame] | 88 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
Paul Menzel | 6548ae9 | 2015-05-03 09:35:32 +0200 | [diff] [blame] | 89 | $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 90 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 91 | # Yacc source is superset of header |
Kyösti Mälkki | c877149 | 2015-05-09 08:06:02 +0300 | [diff] [blame] | 92 | $(objutil)/cbfstool/fmd.o: TOOLCFLAGS += -Wno-redundant-decls |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 93 | $(objutil)/cbfstool/fmd_parser.o: TOOLCFLAGS += -Wno-redundant-decls |
Kyösti Mälkki | c877149 | 2015-05-09 08:06:02 +0300 | [diff] [blame] | 94 | # Lex generates unneeded functions and declarations |
| 95 | $(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-redundant-decls |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 96 | $(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-unused-function |
Sol Boucher | 0e53931 | 2015-03-05 15:38:03 -0800 | [diff] [blame] | 97 | # Tolerate lzma sdk warnings |
| 98 | $(objutil)/cbfstool/LzmaEnc.o: TOOLCFLAGS += -Wno-sign-compare -Wno-cast-qual |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 99 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 100 | $(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_parser.h |
| 101 | $(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_scanner.h |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 102 | $(objutil)/cbfstool/fmd_parser.o: $(objutil)/cbfstool/fmd.o |
| 103 | $(objutil)/cbfstool/fmd_scanner.o: $(objutil)/cbfstool/fmd.o |
| 104 | |
Patrick Georgi | 7b32145 | 2015-05-19 16:43:05 +0200 | [diff] [blame] | 105 | $(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 106 | mkdir -p $(dir $@) |
| 107 | cp $< $@ |
| 108 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 109 | ifeq ($(CONFIG_FMD_GENPARSER),y) |
| 110 | TOOLLEX := lex |
| 111 | TOOLYACC := yacc |
| 112 | |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 113 | # the .c rule also creates .h |
| 114 | $(top)/util/cbfstool/fmd_scanner.h_shipped: $(top)/util/cbfstool/fmd_scanner.c_shipped |
| 115 | $(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] | 116 | echo " LEX util/cbfstool/fmd_scanner.[ch]" |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 117 | $(TOOLLEX) -t --header-file=$(top)/util/cbfstool/fmd_scanner.h_shipped $< >$(top)/util/cbfstool/fmd_scanner.c_shipped |
| 118 | |
| 119 | # the .c rule also creates .h |
| 120 | $(top)/util/cbfstool/fmd_parser.h_shipped: $(top)/util/cbfstool/fmd_parser.c_shipped |
| 121 | $(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] | 122 | echo " YACC util/cbfstool/fmd_parser.[ch]" |
| 123 | $(TOOLYACC) -d $< |
Kyösti Mälkki | d32b273 | 2015-05-15 09:27:34 +0300 | [diff] [blame] | 124 | mv -f y.tab.c $(top)/util/cbfstool/fmd_parser.c_shipped |
| 125 | mv -f y.tab.h $(top)/util/cbfstool/fmd_parser.h_shipped |
| 126 | |
| 127 | endif # CONFIG_FMD_GENPARSER |