From cd81b27c0510097de6b451925176475e347b524e Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 12 Sep 2017 11:33:50 -0700 Subject: [PATCH] build: protect ap_version.h from inclusion --- Tools/ardupilotwaf/ardupilotwaf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tools/ardupilotwaf/ardupilotwaf.py b/Tools/ardupilotwaf/ardupilotwaf.py index 99201154c3..d9edc1bcda 100644 --- a/Tools/ardupilotwaf/ardupilotwaf.py +++ b/Tools/ardupilotwaf/ardupilotwaf.py @@ -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)