commit 9372435cb9d911be561dfcf544b89ebe3d32b84f
parent 06c2ce816b3d86b786f69173a0e908052a53908f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 17 Jul 2023 16:28:37 +0200
Some Makefile tweaks
Make config.mk a dependency of .d files and test executables. These also
depend on the pkg-config smc-local.pc file.
Make the tests .d file a prerequisite of the build_tests target.
Diffstat:
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
@@ -50,14 +50,14 @@ OBJ = $(SRC:.c=.o)
DEP = $(SRC:.c=.d)
build_library: .config $(DEP)
- @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done)\
- $$(if [ -n "$(LIBNAME)" ]; then\
- echo "$(LIBNAME)";\
- else\
- echo "$(LIBNAME_SHARED)";\
- fi)
+ @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) \
+ $$(if [ -n "$(LIBNAME)" ]; then\
+ echo "$(LIBNAME)";\
+ else\
+ echo "$(LIBNAME_SHARED)";\
+ fi)
-$(OBJ): config.mk
+$(DEP) $(OBJ): config.mk
$(LIBNAME_SHARED): $(OBJ)
$(CC) $(CFLAGS) $(DPDC_CFLAGS) -fopenmp -o $@ $(OBJ) $(LDFLAGS) $(SOFLAGS) $(DPDC_LIBS)
@@ -67,7 +67,6 @@ $(LIBNAME_STATIC): $(OBJ)
$(RANLIB) $@
.config: config.mk
- @echo "Find packages"; rm -f $@
@if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then\
echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
@if ! $(PKG_CONFIG) --atleast-version $(STAR-SP_VERSION) star-sp; then\
@@ -105,7 +104,7 @@ install: build_library pkg
@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib" $(LIBNAME)
@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib/pkgconfig" smc.pc
@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/include/star" src/smc.h
- @$(SHELL) make.sh install $(DESTDIR)$(PREFIX)/share/doc/star-mc\
+ @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/star-mc"\
COPYING.en COPYING.fr README.md
uninstall:
@@ -150,7 +149,7 @@ S3D_FOUND = $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d
SMC_CFLAGS = $$($(PKG_CONFIG) --with-path=./ $(PCFLAGS) --cflags smc-local.pc)
SMC_LIBS = $$($(PKG_CONFIG) --with-path=./ $(PCFLAGS) --libs smc-local.pc)
-build_tests: build_library .test
+build_tests: build_library $(TEST_DEP) .test
@$(MAKE) -fMakefile -f.test\
$$(for i in $(TEST_DEP); do echo -f"$${i}"; done)\
$$($(S3D_FOUND) && for i in $(TEST_DEP_S3D); do echo -f"$${i}"; done)\
@@ -173,17 +172,17 @@ $(TEST_OBJ) $(TEST_OBJ_S3D): config.mk smc-local.pc
$(TEST_OBJ):
$(CC) $(CFLAGS) $(SMC_CFLAGS) -c $(@:.o=.c) -o $@
-test_smc_device:
+test_smc_device: config.mk smc-local.pc
$(CC) -o $@ src/$@.o $(LDFLAGS) $(SMC_LIBS) -fopenmp
test_smc_doubleN \
test_smc_errors \
test_smc_solve \
-:
+: config.mk smc-local.pc
$(CC) -o $@ src/$@.o $(LDFLAGS) $(SMC_LIBS) -lm
$(TEST_OBJ_S3D):
$(CC) $(CFLAGS) $(SMC_CFLAGS) $(S3D_CFLAGS) -c $(@:.o=.c) -o $@
-test_smc_light_path:
+test_smc_light_path: config.mk smc-local.pc
$(CC) $(CFLAGS) $(SMC_CFLAGS) $(S3D_CFLAGS) -o $@ src/$@.o $(LDFLAGS) $(SMC_LIBS) $(S3D_LIBS) -lm