File DSDP.Makefile of Package DSDP

# The upstream Makefile is broken in multiple ways.
# 1. It doesn't allow for parallel building, due to many missing dependencies.
# 2. It only builds static libraries.  Yes, there is an "oshared" target that
#    supposedly builds a shared library.  Try it and see how it works for you.
# 3. Each target starts by doing a clean.  That means that if you want to build
#    more than one target (we want to build 3), then each invocation of make
#    destroys all the work you did in the previous target.
# 4. A number of targets explicitly invoke make, when they should have done
#    their work in the context of the current invocation of make.
# Forget it!  I'm writing my own Makefile.

CC = gcc
INCLUDES = -I/usr/include/atlas -Iinclude -Isrc/solver -Isrc/sdp -Isrc/vecmat
SONAME = -Wl,-h,

SOLVER_OBJS = src/solver/dualalg.o src/solver/dualimpl.o \
	src/solver/dsdpcops.o src/solver/dsdpschurmat.o src/solver/dsdpcg.o \
	src/solver/dsdpconverge.o src/solver/dsdpsetup.o \
	src/solver/dsdpcone.o src/solver/dsdpsetoptions.o \
	src/solver/dsdpsetdata.o src/solver/dsdprescone.o \
	src/solver/dsdpobjcone.o src/solver/dsdpprintout.o \
	src/solver/dsdpschurmatadd.o src/solver/dsdpx.o

SDP_OBJS = src/sdp/dsdpstep.o src/sdp/printsdpa.o src/sdp/sdpconevec.o \
	src/sdp/sdpsss.o src/sdp/dsdpadddata.o src/sdp/dsdpadddatamat.o \
	src/sdp/dsdpblock.o src/sdp/sdpcone.o src/sdp/sdpkcone.o \
	src/sdp/sdpcompute.o src/sdp/sdpconesetup.o src/sdp/dsdpdsmat.o \
	src/sdp/dsdpdatamat.o src/sdp/dsdpdualmat.o src/sdp/dsdpxmat.o

LP_OBJS = src/lp/dsdplp.o

VECMAT_OBJS = src/vecmat/vech.o src/vecmat/vechu.o src/vecmat/drowcol.o \
	src/vecmat/dlpack.o src/vecmat/dufull.o src/vecmat/sdpvec.o \
	src/vecmat/identity.o src/vecmat/spds.o src/vecmat/zeromat.o \
	src/vecmat/onemat.o src/vecmat/diag.o src/vecmat/rmmat.o \
	src/vecmat/cholmat.o src/vecmat/cholmat2.o src/vecmat/dtrsm2.o \
	src/vecmat/sdpmatx.o src/vecmat/sdpnfac.o src/vecmat/sdporder.o \
	src/vecmat/sdpalloc.o src/vecmat/sdpsymb.o src/vecmat/sdpxlist.o \
	src/vecmat/sdpdvct.o src/vecmat/sdpexit.o

SYS_OBJS = src/sys/dsdperror.o src/sys/dsdploginfo.o src/sys/dsdplog.o \

BOUNDS_OBJS = src/bounds/dbounds.o src/bounds/allbounds.o


EXAMPLES = examples/maxcut examples/theta examples/dsdp5 examples/stable \

all: $(EXAMPLES)

src/ $(LIB_OBJS)
	$(CC) $(CFLAGS) -shared $(SONAME) -o $@ $^ -llapack -lblas

src/ src/
	ln -s $@

src/ src/
	ln -s $@

examples/maxcut: examples/maxcut.c src/
	$(CC) $(BFLAGS) $< -o $@ -ldsdp -lm

examples/theta: examples/theta.c src/
	$(CC) $(BFLAGS) $< -o $@ -ldsdp -lm

examples/dsdp5: examples/readsdpa.c src/
	$(CC) $(BFLAGS) $< -o $@ -ldsdp -lm

examples/stable: examples/stable.c src/
	$(CC) $(BFLAGS) $< -o $@ -ldsdp -lm

examples/color: examples/color.c src/
	$(CC) $(BFLAGS) $< -o $@ -ldsdp -lm