commit ccea894a0ee8767e397dc40d81cdc52e5f199ba1
parent 25971ec4954077a83a715685ac17a21b6435712f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 31 Oct 2023 12:40:14 +0100
Update test compilation and link edition
Make sure that the pkg-config directive for the local library appears as
the first compiler flag to be used and the first library to be linked,
to ensure that headers and libraries are searched for first in the local
path. This is because the compiler and linker look for directories in
the left-to-right order in which the -I and -L options appear. So, to
force inclusion of local headers and link editing with the local version
of the library, the -I./src and -L./ directives must appear first when
compiling and linking.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -182,12 +182,12 @@ clean_test:
rm -f test_rnatm src/test_rnatm.o
$(TEST_DEP): config.mk rnatm-local.pc
- @$(CC) $(CFLAGS_EXE) $(RSYS_CFLAGS) $(RNATM_CFLAGS) \
+ @$(CC) $(CFLAGS_EXE) $(RNATM_CFLAGS) $(RSYS_CFLAGS) \
-MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
src/test_rnatm.o: config.mk rnatm-local.pc
- $(CC) $(CFLAGS_EXE) $(RSYS_CFLAGS) $(RNATM_CFLAGS) -c $(@:.o=.c) -o $@
+ $(CC) $(CFLAGS_EXE) $(RNATM_CFLAGS) $(RSYS_CFLAGS) -c $(@:.o=.c) -o $@
test_rnatm: src/test_rnatm.o config.mk rnatm-local.pc $(LIBNAME)
- $(CC) $(CFLAGS_EXE) $(RSYS_CFLAGS) $(RNATM_CFLAGS) -o $@ src/$@.o \
- $(LDFLAGS_EXE) $(RSYS_LIBS) $(RNATM_LIBS)
+ $(CC) $(CFLAGS_EXE) $(RNATM_CFLAGS) $(RSYS_CFLAGS) -o $@ src/$@.o \
+ $(LDFLAGS_EXE) $(RNATM_LIBS) $(RSYS_LIBS)