build: protect ap_version.h from inclusion

This commit is contained in:
Lucas De Marchi 2017-09-12 11:33:50 -07:00
parent 11e47fb145
commit cd81b27c05
1 changed files with 9 additions and 1 deletions

View File

@ -236,7 +236,15 @@ def ap_version_append_str(ctx, k, v):
@conf
def write_version_header(ctx, tgt):
with open(tgt, 'w') as f:
print('#pragma once\n', file=f)
print(
'''// auto-generated header, do not edit
#pragma once
#ifndef FORCE_VERSION_H_INCLUDE
#error ap_version.h should never be included directly. You probably want to include AP_Common/AP_FWVersion.h
#endif
''', file=f)
for k, v in ctx.env['AP_VERSION_ITEMS']:
print('#define {} {}'.format(k, v), file=f)