[LTP] [PATCH v2 1/4] Makefile: Add C header with generated LTP version

Li Wang liwang@redhat.com
Thu Jul 20 07:23:32 CEST 2023


Hi Petr,

On Wed, Jul 19, 2023 at 7:01 PM Petr Vorel <pvorel@suse.cz> wrote:

> From: Cyril Hrubis <chrubis@suse.cz>
>
> It will be used for printing LTP version in C API.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  lib/.gitignore     |  2 ++
>  lib/Makefile       | 13 +++++++++++++
>  lib/gen_version.sh | 16 ++++++++++++++++
>  3 files changed, 31 insertions(+)
>  create mode 100644 lib/.gitignore
>  create mode 100755 lib/gen_version.sh
>
> diff --git a/lib/.gitignore b/lib/.gitignore
> new file mode 100644
> index 000000000..1bd967e2f
> --- /dev/null
> +++ b/lib/.gitignore
> @@ -0,0 +1,2 @@
> +/ltp-version.h
> +/cached-version
> diff --git a/lib/Makefile b/lib/Makefile
> index 9b9906f25..ac1f62048 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -20,6 +20,19 @@ pc_file                      :=
> $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc
>
>  INSTALL_TARGETS                := $(pc_file)
>
> +tst_test.o: ltp-version.h
> +
> +ltp-version.h: gen_version
> +
> +MAKE_TARGETS += gen_version
> +
> +.PHONY: gen_version
> +gen_version:
> +       @echo GEN ltp-version.h
> +       @./gen_version.sh
>

If we build LTP out of the source tree, it failed with no
such file gen_version.sh.

By adding the absolute path then works.

--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,7 +29,7 @@ MAKE_TARGETS += gen_version
 .PHONY: gen_version
 gen_version:
        @echo GEN ltp-version.h
-       @./gen_version.sh
+       @$(top_srcdir)/lib/gen_version.sh

 CLEAN_TARGETS += ltp-version.h cached-version


For patch series:
Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang


More information about the ltp mailing list