]> git.ipfire.org Git - location/libloc.git/commitdiff
Declare make dependencies for Perl binding
authorPetr Písař <ppisar@redhat.com>
Wed, 19 Oct 2022 09:50:23 +0000 (11:50 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 Oct 2022 13:00:18 +0000 (13:00 +0000)
Running make in parallel (make -j5) randomly failed with:

/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -include ./config.h -DSYSCONFDIR=\""/etc"\" -I./src  -Wall -Wchar-subscripts -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wsign-compare -Wstrict-prototypes -Wtype-limits  -fno-semantic-interposition -ffunction-sections -fdata-sections -DLIBLOC_PRIVATE -fvisibility=hidden -g -O2 -c -o src/libloc_internal_la-database.lo `test -f 'src/database.c' || echo './'`src/database.c
/usr/bin/ld: cannot find -lloc: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:482: blib/arch/auto/Location/Location.so] Error 1
make[2]: *** [Makefile:2982: build-perl] Error 2

That's because build-perl did not depend on libloc library.

A similar issue was with running tests and installing files. Moreover,
thess two targets rebuilt Perl binding from scratch.

This patch make the dependencies explicit and turns build-perl into
non-PHONY.

Fixes: #12961
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am

index 63ea173c4a9970d17c85d9a6d2ead601e8f96704..81e10f92ea17363f9f0865ddc5a34177a8191147 100644 (file)
@@ -232,8 +232,7 @@ EXTRA_DIST += \
        src/perl/t/Location.t \
        src/perl/typemap
 
-.PHONY: build-perl
-build-perl:
+build-perl: src/libloc.la
        @mkdir -p $(builddir)/src/perl/{lib,t}
        @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
        @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
@@ -245,19 +244,21 @@ build-perl:
        cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
                INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
        cd $(builddir)/src/perl && $(MAKE)
+       touch build-perl
 
 .PHONY: check-perl
-check-perl: testdata.db
+check-perl: testdata.db build-perl
        cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \
                database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem"
 
 .PHONY: install-perl
-install-perl:
+install-perl: build-perl
        cd $(builddir)/src/perl && $(MAKE) install DESTIDR=$(DESTDIR)
 
 .PHONY: clean-perl
 clean-perl:
        cd $(builddir)/src/perl && $(MAKE) distclean
+       rm build-perl
 
 .PHONY: uninstall-perl
 uninstall-perl: