improve Makefile for users who want to build and install in one step

Sun, 02 Mar 2025 16:45:46 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 02 Mar 2025 16:45:46 +0100
changeset 1234
6cdf81367b93
parent 1233
29e1c48d1a6c
child 1235
3e058f5ba5dc

improve Makefile for users who want to build and install in one step

src/Makefile file | annotate | diff | comparison | revisions
--- a/src/Makefile	Sat Mar 01 15:49:08 2025 +0100
+++ b/src/Makefile	Sun Mar 02 16:45:46 2025 +0100
@@ -53,7 +53,11 @@
 $(build_dir)/libucx$(SHLIB_EXT): $(OBJ)
 	$(CC) $(LDFLAGS) -o $@ $^
 
-install: $(build_dir)/libucx_static$(STLIB_EXT) $(build_dir)/libucx$(SHLIB_EXT)
+rebuild_if_missing:
+	if test -f $(build_dir)/libucx_static$(STLIB_EXT) && test -f $(build_dir)/libucx$(SHLIB_EXT); \
+	then : ; else cd $(root_dir); $(MAKE) compile; fi
+
+install: rebuild_if_missing
 	$(MKDIR) $(libdir) $(includedir)/cx
 	$(RMFILE) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR)
 	$(RMFILE) $(libdir)/libucx$(SHLIB_EXT)

mercurial