Ticket #5281: tachyon-shared-library.patch

File tachyon-shared-library.patch, 8.3 KB (added by vbraun, 12 years ago)

Debian shared library patch for reference

  • unix/Makefile

    old new  
    2323# Name of raytracing library file to create
    2424#
    2525RAYLIB=${ARCHDIR}/libtachyon.a
     26RAYSHLIB=${ARCHDIR}/libtachyon.so
    2627RAYLIBDIR=${ARCHDIR}
    2728
    2829#
     
    7172# No test programs included..
    7273#
    7374BINARIES = ${COMPILEDIR} ${ARCHDIR} ${OBJDIR} ${PARSEDIRS} \
    74         ${RAYLIB} ${PARSELIB} ${ARCHDIR}/tachyon
     75        ${RAYLIB} ${PARSELIB} ${ARCHDIR}/tachyon ${RAYSHLIB}
    7576
    7677
    7778#----------------------------------------------------------------------
     
    259260        ${AR} ${ARFLAGS} ${RAYLIB} ${RAYOBJS}
    260261        ${RANLIB} ${RAYLIB}
    261262
     263shobj : ${RAYOBJS}
     264shobj : FPICFLAG = -fPIC
     265
     266${RAYSHLIB} : VERSION=$(shell grep TACHYON_VERSION_STRING ../src/rtcommon.h | cut -d\" -f 2)
     267${RAYSHLIB} : DIRNAME=tachyon-${VERSION}
     268${RAYSHLIB} :
     269        -rm -f ${RAYOBJS}
     270        make shobj
     271        ${CC} -fPIC -shared -Wl,-soname,lib${DIRNAME}.so -o ${RAYLIBDIR}/lib${DIRNAME}.so ${CFLAGS} -lpng -lm -lpthread ${RAYOBJS}
     272        ln -s lib${DIRNAME}.so $@
     273
    262274${OBJDIR}/vol.o : ${SRCDIR}/vol.c ${OBJDEPS}
    263         ${CC} ${CFLAGS} -c ${SRCDIR}/vol.c -o ${OBJDIR}/vol.o
     275        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/vol.c -o ${OBJDIR}/vol.o
    264276
    265277${OBJDIR}/extvol.o : ${SRCDIR}/extvol.c ${OBJDEPS}
    266         ${CC} ${CFLAGS} -c ${SRCDIR}/extvol.c -o ${OBJDIR}/extvol.o
     278        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/extvol.c -o ${OBJDIR}/extvol.o
    267279
    268280${OBJDIR}/winbmp.o : ${SRCDIR}/winbmp.c ${OBJDEPS}
    269         ${CC} ${CFLAGS} -c ${SRCDIR}/winbmp.c -o ${OBJDIR}/winbmp.o
     281        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/winbmp.c -o ${OBJDIR}/winbmp.o
    270282
    271283${OBJDIR}/vector.o : ${SRCDIR}/vector.c ${OBJDEPS}
    272         ${CC} ${CFLAGS} -c ${SRCDIR}/vector.c -o ${OBJDIR}/vector.o
     284        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/vector.c -o ${OBJDIR}/vector.o
    273285
    274286${OBJDIR}/triangle.o : ${SRCDIR}/triangle.c ${OBJDEPS} ${SRCDIR}/triangle.h
    275         ${CC} ${CFLAGS} -c ${SRCDIR}/triangle.c -o ${OBJDIR}/triangle.o
     287        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/triangle.c -o ${OBJDIR}/triangle.o
    276288
    277289${OBJDIR}/trace.o : ${SRCDIR}/trace.c ${OBJDEPS}
    278         ${CC} ${CFLAGS} -c ${SRCDIR}/trace.c -o ${OBJDIR}/trace.o
     290        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/trace.c -o ${OBJDIR}/trace.o
    279291
    280292${OBJDIR}/threads.o : ${SRCDIR}/threads.c ${OBJDEPS}
    281         ${CC} ${CFLAGS} -c ${SRCDIR}/threads.c -o ${OBJDIR}/threads.o
     293        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/threads.c -o ${OBJDIR}/threads.o
    282294
    283295${OBJDIR}/tgafile.o : ${SRCDIR}/tgafile.c ${OBJDEPS}
    284         ${CC} ${CFLAGS} -c ${SRCDIR}/tgafile.c -o ${OBJDIR}/tgafile.o
     296        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/tgafile.c -o ${OBJDIR}/tgafile.o
    285297
    286298${OBJDIR}/util.o : ${SRCDIR}/util.c ${OBJDEPS}
    287         ${CC} ${CFLAGS} -c ${SRCDIR}/util.c -o ${OBJDIR}/util.o
     299        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/util.c -o ${OBJDIR}/util.o
    288300
    289301${OBJDIR}/ui.o : ${SRCDIR}/ui.c ${OBJDEPS}
    290         ${CC} ${CFLAGS} -c ${SRCDIR}/ui.c -o ${OBJDIR}/ui.o
     302        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/ui.c -o ${OBJDIR}/ui.o
    291303
    292304${OBJDIR}/texture.o : ${SRCDIR}/texture.c ${OBJDEPS}
    293         ${CC} ${CFLAGS} -c ${SRCDIR}/texture.c -o ${OBJDIR}/texture.o
     305        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/texture.c -o ${OBJDIR}/texture.o
    294306
    295307${OBJDIR}/sphere.o : ${SRCDIR}/sphere.c ${OBJDEPS} ${SRCDIR}/sphere.h
    296         ${CC} ${CFLAGS} -c ${SRCDIR}/sphere.c -o ${OBJDIR}/sphere.o
     308        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/sphere.c -o ${OBJDIR}/sphere.o
    297309
    298310${OBJDIR}/sgirgb.o : ${SRCDIR}/sgirgb.c ${OBJDEPS}
    299         ${CC} ${CFLAGS} -c ${SRCDIR}/sgirgb.c -o ${OBJDIR}/sgirgb.o
     311        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/sgirgb.c -o ${OBJDIR}/sgirgb.o
    300312
    301313${OBJDIR}/shade.o : ${SRCDIR}/shade.c ${OBJDEPS}
    302         ${CC} ${CFLAGS} -c ${SRCDIR}/shade.c -o ${OBJDIR}/shade.o
     314        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/shade.c -o ${OBJDIR}/shade.o
    303315
    304316${OBJDIR}/ring.o : ${SRCDIR}/ring.c ${OBJDEPS}
    305         ${CC} ${CFLAGS} -c ${SRCDIR}/ring.c -o ${OBJDIR}/ring.o
     317        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/ring.c -o ${OBJDIR}/ring.o
    306318
    307319${OBJDIR}/render.o : ${SRCDIR}/render.c ${OBJDEPS}
    308         ${CC} ${CFLAGS} -c ${SRCDIR}/render.c -o ${OBJDIR}/render.o
     320        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/render.c -o ${OBJDIR}/render.o
    309321
    310322${OBJDIR}/quadric.o : ${SRCDIR}/quadric.c ${OBJDEPS}
    311         ${CC} ${CFLAGS} -c ${SRCDIR}/quadric.c -o ${OBJDIR}/quadric.o
     323        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/quadric.c -o ${OBJDIR}/quadric.o
    312324
    313325${OBJDIR}/jpeg.o : ${SRCDIR}/jpeg.c ${OBJDEPS}
    314         ${CC} ${CFLAGS} -c ${SRCDIR}/jpeg.c -o ${OBJDIR}/jpeg.o
     326        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/jpeg.c -o ${OBJDIR}/jpeg.o
    315327
    316328${OBJDIR}/pngfile.o : ${SRCDIR}/pngfile.c ${OBJDEPS}
    317         ${CC} ${CFLAGS} -c ${SRCDIR}/pngfile.c -o ${OBJDIR}/pngfile.o
     329        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/pngfile.c -o ${OBJDIR}/pngfile.o
    318330
    319331${OBJDIR}/ppm.o : ${SRCDIR}/ppm.c ${OBJDEPS}
    320         ${CC} ${CFLAGS} -c ${SRCDIR}/ppm.c -o ${OBJDIR}/ppm.o
     332        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/ppm.c -o ${OBJDIR}/ppm.o
    321333
    322334${OBJDIR}/psd.o : ${SRCDIR}/psd.c ${OBJDEPS}
    323         ${CC} ${CFLAGS} -c ${SRCDIR}/psd.c -o ${OBJDIR}/psd.o
     335        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/psd.c -o ${OBJDIR}/psd.o
    324336
    325337${OBJDIR}/plane.o : ${SRCDIR}/plane.c ${OBJDEPS} ${SRCDIR}/plane.h
    326         ${CC} ${CFLAGS} -c ${SRCDIR}/plane.c -o ${OBJDIR}/plane.o
     338        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/plane.c -o ${OBJDIR}/plane.o
    327339
    328340${OBJDIR}/parallel.o : ${SRCDIR}/parallel.c ${OBJDEPS}
    329         ${CC} ${CFLAGS} -c ${SRCDIR}/parallel.c -o ${OBJDIR}/parallel.o
     341        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/parallel.c -o ${OBJDIR}/parallel.o
    330342
    331343${OBJDIR}/objbound.o : ${SRCDIR}/objbound.c ${OBJDEPS}
    332         ${CC} ${CFLAGS} -c ${SRCDIR}/objbound.c -o ${OBJDIR}/objbound.o
     344        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/objbound.c -o ${OBJDIR}/objbound.o
    333345
    334346${OBJDIR}/light.o : ${SRCDIR}/light.c ${OBJDEPS}
    335         ${CC} ${CFLAGS} -c ${SRCDIR}/light.c -o ${OBJDIR}/light.o
     347        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/light.c -o ${OBJDIR}/light.o
    336348
    337349${OBJDIR}/intersect.o : ${SRCDIR}/intersect.c ${OBJDEPS}
    338         ${CC} ${CFLAGS} -c ${SRCDIR}/intersect.c -o ${OBJDIR}/intersect.o
     350        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/intersect.c -o ${OBJDIR}/intersect.o
    339351
    340352${OBJDIR}/imageio.o : ${SRCDIR}/imageio.c ${OBJDEPS}
    341         ${CC} ${CFLAGS} -c ${SRCDIR}/imageio.c -o ${OBJDIR}/imageio.o
     353        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/imageio.c -o ${OBJDIR}/imageio.o
    342354
    343355${OBJDIR}/imap.o : ${SRCDIR}/imap.c ${OBJDEPS}
    344         ${CC} ${CFLAGS} -c ${SRCDIR}/imap.c -o ${OBJDIR}/imap.o
     356        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/imap.c -o ${OBJDIR}/imap.o
    345357
    346358${OBJDIR}/grid.o : ${SRCDIR}/grid.c ${SRCDIR}/grid.h ${OBJDEPS}
    347         ${CC} ${CFLAGS} -c ${SRCDIR}/grid.c -o ${OBJDIR}/grid.o
     359        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/grid.c -o ${OBJDIR}/grid.o
    348360
    349361${OBJDIR}/global.o : ${SRCDIR}/global.c ${OBJDEPS}
    350         ${CC} ${CFLAGS} -c ${SRCDIR}/global.c -o ${OBJDIR}/global.o
     362        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/global.c -o ${OBJDIR}/global.o
    351363
    352364${OBJDIR}/hash.o : ${SRCDIR}/hash.c ${OBJDEPS}
    353         ${CC} ${CFLAGS} -c ${SRCDIR}/hash.c -o ${OBJDIR}/hash.o
     365        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/hash.c -o ${OBJDIR}/hash.o
    354366
    355367${OBJDIR}/cylinder.o : ${SRCDIR}/cylinder.c ${OBJDEPS} ${SRCDIR}/cylinder.h
    356         ${CC} ${CFLAGS} -c ${SRCDIR}/cylinder.c -o ${OBJDIR}/cylinder.o
     368        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/cylinder.c -o ${OBJDIR}/cylinder.o
    357369
    358370${OBJDIR}/coordsys.o : ${SRCDIR}/coordsys.c ${OBJDEPS}
    359         ${CC} ${CFLAGS} -c ${SRCDIR}/coordsys.c -o ${OBJDIR}/coordsys.o
     371        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/coordsys.c -o ${OBJDIR}/coordsys.o
    360372
    361373${OBJDIR}/camera.o : ${SRCDIR}/camera.c ${OBJDEPS}
    362         ${CC} ${CFLAGS} -c ${SRCDIR}/camera.c -o ${OBJDIR}/camera.o
     374        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/camera.c -o ${OBJDIR}/camera.o
    363375
    364376${OBJDIR}/box.o : ${SRCDIR}/box.c ${OBJDEPS}
    365         ${CC} ${CFLAGS} -c ${SRCDIR}/box.c -o ${OBJDIR}/box.o
     377        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/box.c -o ${OBJDIR}/box.o
    366378
    367379${OBJDIR}/bndbox.o : ${SRCDIR}/bndbox.c ${OBJDEPS}
    368         ${CC} ${CFLAGS} -c ${SRCDIR}/bndbox.c -o ${OBJDIR}/bndbox.o
     380        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/bndbox.c -o ${OBJDIR}/bndbox.o
    369381
    370382${OBJDIR}/apigeom.o : ${SRCDIR}/apigeom.c ${OBJDEPS}
    371         ${CC} ${CFLAGS} -c ${SRCDIR}/apigeom.c -o ${OBJDIR}/apigeom.o
     383        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/apigeom.c -o ${OBJDIR}/apigeom.o
    372384
    373385${OBJDIR}/api.o : ${SRCDIR}/api.c ${OBJDEPS} ${SRCDIR}/sphere.h ${SRCDIR}/plane.h ${SRCDIR}/triangle.h ${SRCDIR}/cylinder.h
    374         ${CC} ${CFLAGS} -c ${SRCDIR}/api.c -o ${OBJDIR}/api.o
     386        ${CC} ${CFLAGS} ${FPICFLAG} -c ${SRCDIR}/api.c -o ${OBJDIR}/api.o
    375387
    376388clean :
    377389        @echo "Cleaning object files, binaries etc."