]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Homogenize paths for source files during compilation 188/head
authorSebastien Duthil <duthils@duthils.net>
Fri, 7 Oct 2022 15:47:30 +0000 (11:47 -0400)
committerSebastien Duthil <duthils@duthils.net>
Fri, 12 Jul 2024 22:27:29 +0000 (18:27 -0400)
Why:

* Compiling a .o file alone will compile with "-c file.c"
* Compiling a .lo file alone will create the corresponding .o files with "-c ./file.c"
* Building with "make -j1" will only execute the .lo rules; the .o rules will
  be skipped since the .o files are already created from the .lo rules with
  option "-c ./file.c"
* Building with "make -j2" will execute the .lo rules and the .o rules in
  parallel with option "-c file.c"
* assert() captures the path of the source file (taken from the -c option) in
  the compiled binary in order to display the source of the assertion error
* Hence the compiled binaries are not reproducible depending on the number of
  make parallel jobs

Example:

* when compiling examples/ldns-dane with "make -j1", the binary contains the
  string "./examples/ldns-dane.c"
* when compiling examples/ldns-dane with "make -j2", the binary contains the
  string "examples/ldns-dane.c"

Makefile.in

index 32b91576d0d9b1dc279f42c2d5a04c13bec1d656..1181a38c99def735ea1718b1cca30014b217ced7 100644 (file)
@@ -132,11 +132,11 @@ all:      setup-builddir lib linktest manpages @P5_DNS_LDNS@ @PYLDNS@ @DRILL@ @EXAMPL
 .SUFFIXES: .c .o .a .lo .h .i
 
 .c.lo:
-       $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $< -o $@
+       $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $(srcdir)/$< -o $@
 
 # Need libtool compile
 .c.o:
-       $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $< -o $@
+       $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $(srcdir)/$< -o $@
 
 $(LDNS_LOBJS) $(LIBLOBJS) $(DRILL_LOBJS) $(EXAMPLE_LOBJS):
        $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@