diff -up levmar-2.5/Makefile.so.shared levmar-2.5/Makefile.so
--- levmar-2.5/Makefile.so.shared 2009-12-04 13:26:14.000000000 -0800
+++ levmar-2.5/Makefile.so 2010-01-28 12:40:13.000000000 -0800
@@ -6,7 +6,8 @@
# major & minor shared lib numbers
MAJ=2
MIN=2
-ODIR=sobj # where to place object files for shared lib
+# ODIR defines where to place object files for shared lib
+ODIR=sobj
CC=gcc
CONFIGFLAGS=-ULINSOLVERS_RETAIN_MEMORY
#ARCHFLAGS=-march=pentium4 # YOU MIGHT WANT TO UNCOMMENT THIS FOR P4
@@ -14,14 +15,23 @@ CFLAGS=-fPIC $(CONFIGFLAGS) $(ARCHFLAGS)
LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
LIBOBJS=$(ODIR)/lm.o $(ODIR)/Axb.o $(ODIR)/misc.o $(ODIR)/lmlec.o $(ODIR)/lmbc.o $(ODIR)/lmblec.o $(ODIR)/lmbleic.o
LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
-LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK.
+DEMOBJS=lmdemo.o
+DEMOSRCS=lmdemo.c
+# -lf2c removed from LAPACKLIBS for Fedora
+# comment the following line if you are not using LAPACK.
+LAPACKLIBS=-llapack -lblas
# On systems with a FORTRAN (not f2c'ed) version of LAPACK, -lf2c is
# not necessary; on others, -lf2c is equivalent to -lF77 -lI77
LIBS=$(LAPACKLIBS)
+all: $(ODIR)/liblevmar.so.$(MAJ).$(MIN) lmdemo
+
$(ODIR)/liblevmar.so.$(MAJ).$(MIN): $(LIBOBJS)
- $(CC) -shared -Wl,-soname,liblevmar.so.$(MAJ) -o $(ODIR)/liblevmar.so.$(MAJ).$(MIN) $(LIBOBJS) #-llapack -lblas -lf2c
+ $(CC) -shared -Wl,-soname,liblevmar.so.$(MAJ) -o $(ODIR)/liblevmar.so.$(MAJ).$(MIN) $(LIBOBJS) $(LIBS)
+
+$(ODIR)/liblevmar.so: $(ODIR)/liblevmar.so.$(MAJ).$(MIN)
+ ln -s liblevmar.so.$(MAJ).$(MIN) $(ODIR)/liblevmar.so
# implicit rule for generating *.o files in ODIR from *.c files
$(ODIR)/%.o : %.c
@@ -36,6 +46,11 @@ $(ODIR)/lmbc.o: lmbc.c lmbc_core.c levma
$(ODIR)/lmblec.o: lmblec.c lmblec_core.c levmar.h misc.h
$(ODIR)/lmbleic.o: lmbleic.c lmbleic_core.c levmar.h misc.h
+lmdemo.o: levmar.h
+
+lmdemo: $(DEMOBJS) $(ODIR)/liblevmar.so
+ $(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -L$(ODIR) -llevmar $(LIBS) -lm -u MAIN__
+
clean:
@rm -f $(LIBOBJS)
@@ -43,7 +58,7 @@ cleanall: clean
@rm -f $(ODIR)/liblevmar.so.$(MAJ).$(MIN)
depend:
- makedepend -f Makefile $(LIBSRCS)
+ makedepend -f Makefile $(LIBSRCS) $(DEMOSRCS)
# DO NOT DELETE THIS LINE -- make depend depends on it.