1Authors: Andrei Rozanski and Grace Dinh
2Last-Update: 2022-08-23
3Description: fix makefile.u in order to get libamplsover.so (Linux) or libamplsolver.dylib (Mac)
4
5--- a/makefile.u
6+++ b/makefile.u
7
8@@ -26,8 +26,9 @@
9
10 .SUFFIXES: .c .o
11 CC = cc
12-CFLAGS = -O
13+CFLAGS := $(CFLAGS) -pipe -DASL_BUILD -fPIC -DPIC
14 SHELL=/bin/sh
15+OFILES=$(addsuffix .o,$(basename $(a)))
16
17 # Add -DNO_RUSAGE to the CFLAGS assignment if your system
18 # lacks getrusage(). This only matters for compiling xectim.c.
19@@ -86,7 +87,7 @@
20 .c.o:
21 $(CC) -c $(CFLAGS) $*.c
22
23-all: arith.h stdio1.h amplsolver.a funcadd0.o
24+all: arith.h stdio1.h amplsolver.a funcadd0.o libamplsolver@sharedlibext@
25
26 a = \
27 asldate.c \
28@@ -189,6 +190,11 @@
29 # search path, e.g.
30 # exec true
31 # or just comment out the ranlib invocation above.
32+libamplsolver.so: $(OFILES)
33+ $(CC) $^ -shared -Wl,-soname,libamplsolver.so.0 $(LDFLAGS) -o $@.0
34+ ln -s $@.0 $@
35+libamplsolver.dylib: amplsolver.a
36+ $(CC) -fpic -shared -Wl,-all_load amplsolver.a $(LDFLAGS) -o libamplsolver.dylib
37
38 Aslh = arith.h asl.h funcadd.h stdio1.h
39 auxinfo.o libnamsave.o: funcadd.h stdio1.h