summaryrefslogtreecommitdiff
path: root/include/libcamera/gen-header.sh
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-05-21 19:13:44 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-05-23 13:56:36 +0300
commit90de3690c45655d12260ce5879358552f4824c88 (patch)
treebb0baa2f4a2c3e416a2616e5b66e81383262a54e /include/libcamera/gen-header.sh
parent3fac104158fcbdd7d6d7ffb34e5db77f1f9ebeb5 (diff)
libcamera: Auto-generate libcamera.h
As shown by two missing includes, keeping the libcamera.h file in sync when adding or removing headers is an error-prone manual process. Automate it by generating the header automatically. The libcamera.h header is also added to the libcamera dependency libcamera_dep to ensure that the headers gets generated before any source depending on it gets compiled. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include/libcamera/gen-header.sh')
-rwxr-xr-xinclude/libcamera/gen-header.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/libcamera/gen-header.sh b/include/libcamera/gen-header.sh
new file mode 100755
index 00000000..e171c08c
--- /dev/null
+++ b/include/libcamera/gen-header.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+src_dir="$1"
+dst_file="$2"
+
+cat <<EOF > "$dst_file"
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/* This file is auto-generated, do not edit! */
+/*
+ * Copyright (C) 2018-2019, Google Inc.
+ *
+ * libcamera.h - libcamera public API
+ */
+#ifndef __LIBCAMERA_LIBCAMERA_H__
+#define __LIBCAMERA_LIBCAMERA_H__
+
+EOF
+
+for header in "$src_dir"/*.h ; do
+ header=$(basename "$header")
+ echo "#include <libcamera/$header>" >> "$dst_file"
+done
+
+cat <<EOF >> "$dst_file"
+
+#endif /* __LIBCAMERA_LIBCAMERA_H__ */
+EOF