commit 75647420803955c60fcfc7469cb792def13c4775
parent ed0c59c9d9073363181d0526c543c4b84138b8b2
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 19 Jul 2023 14:59:59 +0200
Update several Makefile targets
The tests depend on the linker flags set in the config.mk file. This
dependency is not really necessary since these executables depend on
their object file which themselves depend on the config.mk file. So in
any case, their linking would be redone even without this change which
in all rigor remains necessary.
Like .o files, the .d files depend on the contents of the config.mk
file, including the value of build flags such as include directories to
search for headers and macro definitions. In addition, the .d files of
the tests no longer use the inference rule defined for the library and
now rely on its own targets with its own compilation flags used for its
compilation. If in practice this does not change anything, it is more
rigorous.
The local pkg-config file depends on the config.mk file which defines
the requirements version. Note that making this dependency explicit is
not necessary for the installed pkg-config file which is regenerated
from scratch at each installation, to take into account the potential
redefinition of the PREFIX macro on the command line.
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -60,7 +60,7 @@ build_library: .config $(DEP)
echo "$(LIBNAME_SHARED)";\
fi)
-$(OBJ): config.mk
+$(DEP) $(OBJ): config.mk
$(LIBNAME_SHARED): $(OBJ)
$(CXX) $(CXXFLAGS) $(AES_CFLAGS) $(DPDC_CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(SOFLAGS) $(DPDC_LIBS)
@@ -69,7 +69,7 @@ $(LIBNAME_STATIC): $(OBJ)
$(AR) -rc $@ $?
$(RANLIB) $@
-.config: Makefile config.mk
+.config: config.mk
@if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
@if ! $(PKG_CONFIG) --atleast-version $(RANDOM123_VERSION) random123; then \
@@ -94,7 +94,7 @@ pkg:
-e 's#@RANDOM123_VERSION@#$(RANDOM123_VERSION)#g' \
star-sp.pc.in > star-sp.pc
-star-sp-local.pc: star-sp.pc.in
+star-sp-local.pc: config.mk star-sp.pc.in
@sed -e '1d'\
-e 's#^includedir=.*#includedir=./src/#'\
-e 's#^libdir=.*#libdir=./#'\
@@ -170,6 +170,9 @@ test: build_tests
clean_test:
@$(SHELL) make.sh clean_test $(TEST_SRC)
+$(TEST_DEP): config.mk star-sp-local.pc
+ @$(CC) $(CFLAGS) $(S3D_CFLAGS) $(RSYS_CFLAGS) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
$(TEST_OBJ): config.mk star-sp-local.pc
$(CC) $(CFLAGS) $(S3D_CFLAGS) $(RSYS_CFLAGS) -c $(@:.o=.c) -o $@
@@ -187,5 +190,5 @@ test_ssp_ran_triangle \
test_ssp_ran_uniform_disk \
test_ssp_rng \
test_ssp_rng_proxy \
-: star-sp-local.pc
+: config.mk star-sp-local.pc
$(CC) -o $@ src/$@.o $(LDFLAGS) $(SSP_LIBS) $(RSYS_LIBS) -lm