Author: Andrei Rozanski
Last-Update: 2020-09-29
Description: fix makefile.u in order to get libamplsover.so

--- a/makefile.u
+++ b/makefile.u
@@ -26,8 +26,9 @@
 
 .SUFFIXES: .c .o
 CC = cc
-CFLAGS = -O
+CFLAGS := $(CFLAGS) -pipe -DASL_BUILD -fPIC -DPIC
 SHELL=/bin/sh
+OFILES=$(addsuffix .o,$(basename $(a)))
 
 # Add -DNO_RUSAGE to the CFLAGS assignment if your system
 # lacks getrusage().  This only matters for compiling xectim.c.
@@ -86,7 +87,7 @@ SHELL=/bin/sh
 .c.o:
 	$(CC) -c $(CFLAGS) $*.c
 
-all: arith.h stdio1.h amplsolver.a funcadd0.o
+all: arith.h stdio1.h amplsolver.a funcadd0.o libamplsolver.so
 
 a = \
 	asldate.c \
@@ -181,6 +182,11 @@ a = \
 	xp2known.c
 
 ARFLAGS = ruv
+
+libamplsolver.so: $(OFILES)
+	$(CC) $^ -shared  -Wl,-soname,libamplsolver.so.0 $(LDFLAGS) -o $@.0
+	ln -s $@.0 $@
+
 amplsolver.a: $a
 	$(CC) -c $(CFLAGS) $?
 	x=`echo $? | sed 's/\.[cs]/.o/g'` && ar $(ARFLAGS) amplsolver.a $$x && rm $$x
