Ticket #33430: levmar-shared.patch

File levmar-shared.patch, 2.4 KB (added by lockhart (Thomas Lockhart), 12 years ago)

Patch for the goofy levmar Makefile.so to compile on Mac OS X. Works on Lion but does not seem to be version-specific.

  • levmar-2.5/Makefile.so

    diff -up levmar-2.5/Makefile.so.shared levmar-2.5/Makefile.so
    old new  
    66# major & minor shared lib numbers
    77MAJ=2
    88MIN=2
    9 ODIR=sobj # where to place object files for shared lib
     9# ODIR defines where to place object files for shared lib
     10ODIR=sobj
    1011CC=gcc
    1112CONFIGFLAGS=-ULINSOLVERS_RETAIN_MEMORY
    1213#ARCHFLAGS=-march=pentium4 # YOU MIGHT WANT TO UNCOMMENT THIS FOR P4
    CFLAGS=-fPIC $(CONFIGFLAGS) $(ARCHFLAGS) 
    1415LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
    1516LIBOBJS=$(ODIR)/lm.o $(ODIR)/Axb.o $(ODIR)/misc.o $(ODIR)/lmlec.o $(ODIR)/lmbc.o $(ODIR)/lmblec.o $(ODIR)/lmbleic.o
    1617LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
    17 LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK.
     18DEMOBJS=lmdemo.o
     19DEMOSRCS=lmdemo.c
     20# -lf2c removed from LAPACKLIBS for Fedora
     21# comment the following line if you are not using LAPACK.
     22LAPACKLIBS=-llapack -lblas
    1823                                 # On systems with a FORTRAN (not f2c'ed) version of LAPACK, -lf2c is
    1924                                 # not necessary; on others, -lf2c is equivalent to -lF77 -lI77
    2025
    2126LIBS=$(LAPACKLIBS)
    2227
     28all: $(ODIR)/liblevmar.so.$(MAJ).$(MIN) lmdemo
     29
    2330$(ODIR)/liblevmar.so.$(MAJ).$(MIN): $(LIBOBJS)
    24         $(CC) -shared -Wl,-soname,liblevmar.so.$(MAJ) -o $(ODIR)/liblevmar.so.$(MAJ).$(MIN) $(LIBOBJS) #-llapack -lblas -lf2c
     31        $(CC) -shared -Wl,-install_name,liblevmar.so.$(MAJ) -o $(ODIR)/liblevmar.so.$(MAJ).$(MIN) $(LIBOBJS) $(LIBS)
     32
     33$(ODIR)/liblevmar.so: $(ODIR)/liblevmar.so.$(MAJ).$(MIN)
     34        ln -s liblevmar.so.$(MAJ).$(MIN) $(ODIR)/liblevmar.so
    2535
    2636# implicit rule for generating *.o files in ODIR from *.c files
    2737$(ODIR)/%.o : %.c
    $(ODIR)/lmbc.o: lmbc.c lmbc_core.c levma 
    3646$(ODIR)/lmblec.o: lmblec.c lmblec_core.c levmar.h misc.h
    3747$(ODIR)/lmbleic.o: lmbleic.c lmbleic_core.c levmar.h misc.h
    3848
     49lmdemo.o: levmar.h
     50
     51lmdemo: $(DEMOBJS) $(ODIR)/liblevmar.so
     52        $(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -L$(ODIR) -llevmar $(LIBS) -lm # -u MAIN__
     53
    3954clean:
    4055        @rm -f $(LIBOBJS)
    4156
    cleanall: clean 
    4358        @rm -f $(ODIR)/liblevmar.so.$(MAJ).$(MIN)
    4459
    4560depend:
    46         makedepend -f Makefile $(LIBSRCS)
     61        makedepend -f Makefile $(LIBSRCS) $(DEMOSRCS)
    4762
    4863# DO NOT DELETE THIS LINE -- make depend depends on it.
    4964