diff options
author | Scott Anderson <scott@anderso.nz> | 2018-08-24 19:33:35 +1200 |
---|---|---|
committer | Scott Anderson <scott@anderso.nz> | 2018-08-24 19:35:21 +1200 |
commit | dc371942911aac5c098205dad7d021837d2d4acd (patch) | |
tree | 03670f7af3dac95f1156d4993a39786ace175e0d | |
parent | fd3fa760d336312acafeb6812b5b0068f5851f27 (diff) |
Change how glgen.sh outputs files
This fixes building wlroots as a subproject.
-rwxr-xr-x | glgen.sh | 15 | ||||
-rw-r--r-- | render/meson.build | 2 |
2 files changed, 8 insertions, 9 deletions
@@ -7,16 +7,15 @@ # to fail if it can't load the function. You'll need to check if that function # is NULL before using it. -if [ $# -ne 3 ]; then +if [ $# -ne 2 ]; then exit 1 fi SPEC=$1 -OUT_C=$2 -OUT_H=$3 +OUTDIR=$2 BASE=$(basename "$SPEC" .txt) -INCLUDE_GUARD=$(printf %s "$OUT_H" | tr -c [:alnum:] _ | tr [:lower:] [:upper:]) +INCLUDE_GUARD=$(printf %s_%s_H "$OUTDIR" "$BASE" | tr -c [:alnum:] _ | tr [:lower:] [:upper:]) DECL="" DEFN="" @@ -56,9 +55,9 @@ while read -r COMMAND; do if [ $OPTIONAL -eq 0 ]; then LOADER="$LOADER$(printf "\n$CHECK_FMT" "$COMMAND" "$COMMAND")" fi -done < $SPEC +done < "$SPEC" -cat > $OUT_H << EOF +cat > "$OUTDIR/$BASE.h" << EOF #ifndef $INCLUDE_GUARD #define $INCLUDE_GUARD @@ -75,9 +74,9 @@ $DECL #endif EOF -cat > $OUT_C << EOF +cat > "$OUTDIR/$BASE.c" << EOF #include <wlr/util/log.h> -#include "$OUT_H" +#include "$BASE.h" $DEFN bool load_$BASE(void) { diff --git a/render/meson.build b/render/meson.build index c5401d22..ab66eab0 100644 --- a/render/meson.build +++ b/render/meson.build @@ -4,7 +4,7 @@ glapi = custom_target( 'glapi', input: 'glapi.txt', output: ['@BASENAME@.c', '@BASENAME@.h'], - command: [glgen, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@'], + command: [glgen, '@INPUT@', '@OUTDIR@'], ) lib_wlr_render = static_library( |