libcamera/utils/gen-header.sh
Kieran Bingham 7e125787ad utils: Convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-24 12:19:03 +00:00

27 lines
499 B
Bash
Executable file

#!/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
*/
#pragma once
EOF
headers=$(for header in "$src_dir"/*.h "$src_dir"/*.h.in ; do
header=$(basename "$header")
header="${header%.in}"
echo "$header"
done | sort)
for header in $headers ; do
echo "#include <libcamera/$header>" >> "$dst_file"
done