google/reef: Add asl code to enable google ChromeEC
[coreboot.git] / util / checklist / Makefile.inc
blobf8e5ebd5e653cefd9125cc79e52419c8053c37a1
2 # This file is part of the coreboot project.
4 # Copyright (C) 2016 Intel Corporation.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; version 2 of the License.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
16 ###########################################################################
17 # Build the board implementation checklist
18 ###########################################################################
20 # Only build the checklist for boards under development
21 ifeq ($(CONFIG_CREATE_BOARD_CHECKLIST),y)
24 # Extract the symbol table from the image
26 %.symbol_table: %.elf %.debug
27         $(NM_$(class)) $< > $@
28         $(NM_$(class)) $(*D)/$(*F).debug >> $@
31 # All symbols in the image
33 # 1. Remove the address and symbol type
34 # 2. Sort the table into alphabetical order
35 # 3. Remove any duplicates
37 %.symbols: %.symbol_table
38         sed 's/^...........//' $< > $@.tmp
39         sort $@.tmp > $@.tmp2
40         uniq $@.tmp2 > $@
41         rm $@.tmp $@.tmp2
44 # Weak symbols in the image
46 # 1. Find the weak symbols
47 # 2. Remove the address and symbol type
48 # 3. Sort the table into alphabetical order
49 # 4. Remove any duplicates
51 %.weak: %.symbol_table
52         grep -F " W " $< | sed 's/^...........//' > $@.tmp
53         sort $@.tmp > $@.tmp2
54         uniq $@.tmp2 > $@
55         rm $@.tmp $@.tmp2
58 # Expected symbols in the image
60 # 1. Get the complete list of expected symbols in the image
61 # 2. Sort the table into alphabetical order
62 # 3. Remove any duplicates
64 %.expected: %.symbol_table
65         cp $(CONFIG_CHECKLIST_DATA_FILE_LOCATION)/$(basename $(*F))_complete.dat $@.tmp
66         # If no separate verstage, combine verstage and romstage routines into a single list
67         if [ "$(*F)" = "romstage" ]; then \
68           if [ ! -e $(*D)/verstage.elf ]; then \
69             if [ ! -e $(*D)/postcar.elf ]; then \
70               cat $(CONFIG_CHECKLIST_DATA_FILE_LOCATION)/verstage_complete.dat >> $@.tmp; \
71             fi; \
72           fi; \
73         fi
74         sort $@.tmp > $@.tmp2
75         uniq $@.tmp2 > $@
76         rm $@.tmp $@.tmp2
79 # Optional symbols in the image
81 # 1. Get the list of optional symbols in the image
82 # 2. Sort the table into alphabetical order
83 # 3. Remove any duplicates
85 %.optional: %.symbol_table
86         cp $(CONFIG_CHECKLIST_DATA_FILE_LOCATION)/$(basename $(*F))_optional.dat $@.tmp
87         # If no separate verstage, combine verstage and romstage routines into a single list
88         if [ "$(*F)" = "romstage" ]; then \
89           if [ ! -e $(*D)/verstage.elf ]; then \
90             if [ ! -e $(*D)/postcar.elf ]; then \
91               cat $(CONFIG_CHECKLIST_DATA_FILE_LOCATION)/verstage_optional.dat >> $@.tmp; \
92             fi; \
93           fi; \
94         fi
95         sort $@.tmp > $@.tmp2
96         uniq $@.tmp2 > $@
97         rm $@.tmp $@.tmp2
100 #   Expected Symbols Optional   Weak    Done    Type
101 #       no      yes     no      d/c     yes     Don't display
102 #       yes     no      no      no      no      Required - not implemented
103 #       yes     no      yes     no      no      Optional - not implemented
104 #       yes     yes     yes     yes     no      Optional - not implemented
105 #       yes     yes     no      no      yes     Required - implemented
106 #       yes     yes     yes     no      yes     Required - implemented
108 # Implemented routines are in the symbol table and are not weak
110 # 1. Remove expected symbols which are not in the image (not implemented yet)
111 # 2. Remove weak symbols from the list (not implemented yet)
113 %.done: %.symbols %.expected %.weak %.optional
114         comm -12 $(*D)/$(*F).expected $(*D)/$(*F).symbols | sed "s/^[ \t]*//" > $@.tmp
115         comm -23 $@.tmp $(*D)/$(*F).weak | sed "s/^[ \t]*//" > $@
116         rm $@.tmp
119 # Remove any routines that are implemented
121 %.optional2: %.optional %.done
122         comm -23 $^ | sed "s/^[ \t]*//" > $@
125 # Remove any implemented or optional routines
127 %.tbd: %.expected %.done %.optional2
128         comm -23 $(*D)/$(*F).expected $(*D)/$(*F).done | sed "s/^[ \t]*//" > $@.tmp
129         comm -23 $@.tmp $(*D)/$(*F).optional2 | sed "s/^[ \t]*//" > $@
130         rm $@.tmp
133 # Build the implementation table for each stage
134 # 1. Color code the rows
135 #    *  Done table rows are in green
136 #    *  Optional table rows are in yellow
137 #    *  TBD table rows are in red
138 # 2. Add the row termination
139 # 3. Sort the rows into alphabetical order
141 %.table_rows: %.optional2 %.done %.expected %.tbd
142         sed -e 's/^/<tr bgcolor=#c0ffc0><td>Required<\/td><td>/' $(*D)/$(basename $(*F)).done > $@.tmp
143         sed -e 's/^/<tr bgcolor=#ffffc0><td>Optional<\/td><td>/' $(*D)/$(basename $(*F)).optional2 >> $@.tmp
144         if [ -s $(*D)/$(basename $(*F)).tbd ]; then \
145           sed -e 's/^/<tr bgcolor=#ffc0c0><td>Required<\/td><td>/' $(*D)/$(basename $(*F)).tbd >> $@.tmp; \
146         fi
147         sed -e 's/$$/<\/td><\/tr>/' -i $@.tmp
148         sort -t ">" -k4 $@.tmp > $@
149         rm $@.tmp
152 # Count the lines in the done file
154 done_lines = $$(wc -l $(*D)/$(basename $(*F)).done | sed 's/ .*//')
157 # Count the lines in the optional file
159 optional_lines = $$(wc -l $(*D)/$(basename $(*F)).optional2 | sed 's/ .*//')
162 # Count the lines in the expected file
164 expected_lines = $$(wc -l $(*D)/$(basename $(*F)).expected | sed 's/ .*//')
166 # Compute the percentage done by routine count
167 percent_complete = $$(($(done_lines) * 100 / ($(expected_lines) - $(optional_lines))))
170 # Build the table
171 # 1. Add the table header
172 # 2. Add the table rows
173 # 3. Add the table trailer
175 %.html: %.table_rows
176         echo "<table border=1>" > $@
177         echo "<tr><th colspan=2>$(basename $(*F)): $(percent_complete)% Done</th></tr>" >> $@
178         echo "<tr><th>Type</th><th>Routine</td></tr>" >> $@
179         cat $< >> $@
180         echo "</table>" >> $@
183 # Determine which HTML files to include into the webpage
185 ifeq ($(CONFIG_SEPARATE_VERSTAGE),y)
186 html_table_files += $(objcbfs)/verstage.html
187 endif
188 ifeq ($(CONFIG_POSTCAR_STAGE),y)
189 html_table_files += $(objcbfs)/postcar.html
190 endif
191 html_table_files += $(objcbfs)/romstage.html $(objcbfs)/ramstage.html
194 # Create a list with each file on a separate line
196 list_of_html_files = $(subst _NEWLINE_,${\n},${html_table_files})
199 # Get the date for the webpage
201 current_date_time = $$(date +"%Y/%m/%d %T %Z")
204 # Build the webpage from the implementation tables
205 # 1. Add the header to the webpage
206 # 2. Add the legend to the webpage
207 # 3. Use a table to place stage tables side-by-side
208 # 4. Add the stage tables to the webpage
209 # 5. Separate the stage tables
210 # 6. Terminate the outer table
211 # 7. Add the trailer to the webpage
213 $(obj)/$(CONFIG_MAINBOARD_PART_NUMBER)_checklist.html: $(html_table_files)
214         echo "<html>" > $@
215         echo "<head>" >> $@
216         echo "<title>$(CONFIG_MAINBOARD_PART_NUMBER) Implementation Status</title>" >> $@
217         echo "</title>" >> $@
218         echo "<body>" >> $@
219         echo "<h1>$(CONFIG_MAINBOARD_PART_NUMBER) Implementation Status<br>$(current_date_time)</h1>" >> $@
220         echo "<table>" >> $@
221         echo "  <tr><td colspan=2><b>Legend</b></td></tr>" >> $@
222         echo "  <tr><td bgcolor=\"#ffc0c0\">Red</td><td>Required - To-be-implemented</td></tr>" >> $@
223         echo "  <tr><td bgcolor=\"#ffffc0\">Yellow</td><td>Optional</td></tr>" >> $@
224         echo "  <tr><td bgcolor=\"#c0ffc0\">Green</td><td>Implemented</td></tr>" >> $@
225         echo "</table>" >> $@
226         echo "<table>" >> $@
227         echo "  <tr valign=\"top\">" >> $@
228         for table in $(list_of_html_files); do \
229           echo "    <td>" >> $@; \
230           cat $$table >> $@; \
231           echo "    </td>" >> $@; \
232           echo "    <td width=5>&nbsp;</td>" >> $@; \
233         done
234         echo "  </tr>" >> $@
235         echo "</table>" >> $@
236         echo "</body>" >> $@
237         echo "</html>" >> $@
240 # Copy the output file into the Documentation directory
242 Documentation/$(CONFIG_MAINBOARD_VENDOR)/Board/$(CONFIG_MAINBOARD_PART_NUMBER)_checklist.html: $(obj)/$(CONFIG_MAINBOARD_PART_NUMBER)_checklist.html
243         if [ ! -d Documentation/$(CONFIG_MAINBOARD_VENDOR) ]; then \
244           mkdir Documentation/$(CONFIG_MAINBOARD_VENDOR); \
245         fi
246         if [ ! -d Documentation/$(CONFIG_MAINBOARD_VENDOR)/Board ]; then \
247           mkdir Documentation/$(CONFIG_MAINBOARD_VENDOR)/Board; \
248         fi
249         cp $< $@
252 # Determine where to place the output file
254 ifeq ($(CONFIG_MAKE_CHECKLIST_PUBLIC),y)
255 INTERMEDIATE+=Documentation/$(CONFIG_MAINBOARD_VENDOR)/Board/$(CONFIG_MAINBOARD_PART_NUMBER)_checklist.html
256 else
257 INTERMEDIATE+=$(obj)/$(CONFIG_MAINBOARD_PART_NUMBER)_checklist.html
258 endif
260 endif