Hi.

As pointed out by Reiner Herrmann, the previous patch is not very
robust: the wildcard function may be executed before target's
dependencies building, leading to an empty (or incomplete) objects list.
The attached new patch solves that problem introducing intermediary targets.

Regards,
Alexis Bienvenüe.
diff -u torch3-3.1/Makefile.modules torch3-3.1/Makefile.modules
--- torch3-3.1/Makefile.modules
+++ torch3-3.1/Makefile.modules
@@ -12,11 +12,18 @@
 all:	$(LIBTORCH) $(LIBSOTORCH)
 soname: $(LIBSOTORCH)
 
+.PHONY: LIBTORCH_build LIBSOTORCH_build
+
 $(LIBTORCH): $(STATICOBJS)
+	$(MAKE) LIBTORCH_build -f ../Makefile.modules
+LIBTORCH_build:
 	@echo "Archiving..."
-	$(AR) $(LIBTORCH) $(STATICOBJSDIR)/*.o
+	$(AR) $(LIBTORCH) $(sort $(wildcard $(STATICOBJSDIR)/*.o))
+
 $(LIBSOTORCH): $(DYNAMICOBJS)
-	$(CC) -shared -Wl,-soname=libtorch.so.3 -o $(LIBSOTORCH) $(DYNAMICOBJSDIR)/*.o
+	$(MAKE) LIBSOTORCH_build -f ../Makefile.modules
+LIBSOTORCH_build:
+	$(CC) -shared -Wl,-soname=libtorch.so.3 -o $(LIBSOTORCH) $(sort $(wildcard $(DYNAMICOBJSDIR)/*.o))
 	
 
 $(OBJS_DIR)/static/%.o: %.cc

Reply via email to