Honour CFLAGS Avoid library symlinks Rectify install targets Index: makefile --- makefile.orig +++ makefile @@ -52,8 +52,8 @@ MPLRSOBJ64=lrslong1-mplrs.o lrslib1-mplrs.o lrslibgmp- lrs: ${LRSOBJ} $(CC) ${CFLAGS} -DMA -DB128 -L${LIBDIR} -o lrs ${LRSOBJ} -lgmp - $(CC) -O3 -DGMP -I${INCLUDEDIR} -o lrsgmp lrs.c lrslib.c lrsgmp.c lrsdriver.c -L${LIBDIR} -lgmp - $(CC) -O3 hvref.c -o hvref + $(CC) ${CFLAGS} -DGMP -I${INCLUDEDIR} -o lrsgmp lrs.c lrslib.c lrsgmp.c lrsdriver.c -L${LIBDIR} -lgmp + $(CC) ${CFLAGS} hvref.c -o hvref ln -s -f lrs redund ln -s -f lrsgmp redundgmp @@ -134,48 +134,48 @@ singlemplrs: mplrsgmp mplrs1 mplrs2 flint: lrs.c lrslib.c lrslib.h lrsgmp.c lrsgmp.h @test -d ${INCLUDEDIR}/flint || { echo ${INCLUDEDIR}/flint not found; exit 1; } - $(CC) -O3 -DFLINT -I${INCLUDEDIR} -I${INCLUDEDIR}/flint lrs.c lrsdriver.c lrslib.c lrsgmp.c -L${LIBDIR} -lflint -o lrsflint -lgmp + $(CC) ${CFLAGS} -DFLINT -I${INCLUDEDIR} lrs.c lrsdriver.c lrslib.c lrsgmp.c -L${LIBDIR} -lflint -o lrsflint -lgmp mplrsflint: mplrs.c mplrs.h lrslib.c lrslib.h lrsgmp.c lrsgmp.h lrsdriver.c lrsdriver.h - ${mpicxx} ${CFLAGS} -DTIMES -DSIGNALS -D_WITH_GETLINE -DFLINT -I${INCLUDEDIR}/flint -DPLRS -o mplrsflint mplrs.c lrsdriver.c lrslib.c lrsgmp.c -L${LIBDIR} -lflint -lgmp + ${mpicxx} ${CFLAGS} -DTIMES -DSIGNALS -D_WITH_GETLINE -DFLINT -I${INCLUDEDIR} -DPLRS -o mplrsflint mplrs.c lrsdriver.c lrslib.c lrsgmp.c -L${LIBDIR} -lflint -lgmp #comment out lines with -DB128 if __int128 not supported by your C compiler lrsgmp: lrs.c lrslib.c lrslib.h lrsgmp.c lrsgmp.h lrsdriver.h lrsdriver.c - $(CC) -O3 -DGMP -I${INCLUDEDIR} -o lrsgmp lrs.c lrslib.c lrsgmp.c lrsdriver.c -L${LIBDIR} -lgmp + $(CC) ${CFLAGS} -DGMP -I${INCLUDEDIR} -o lrsgmp lrs.c lrslib.c lrsgmp.c lrsdriver.c -L${LIBDIR} -lgmp single: lrs.c lrslong.c lrslong.h lrslib.c lrslib.h lrsgmp.c lrsgmp.h lrsdriver.h lrsdriver.c - $(CC) -O3 -DSAFE -DLRSLONG -o lrs1 lrs.c lrslib.c lrslong.c lrsdriver.c - $(CC) -O3 -DB128 -DSAFE -DLRSLONG -o lrs2 lrs.c lrslib.c lrslong.c lrsdriver.c + $(CC) ${CFLAGS} -DSAFE -DLRSLONG -o lrs1 lrs.c lrslib.c lrslong.c lrsdriver.c + $(CC) ${CFLAGS} -DB128 -DSAFE -DLRSLONG -o lrs2 lrs.c lrslib.c lrslong.c lrsdriver.c ln -s -f lrs1 redund1 ln -s -f lrs2 redund2 allmp: lrs.c lrslib.c lrslib.h lrsmp.c lrsmp.h lrsdriver.h lrsdriver.c - $(CC) -Wall -O3 -o lrs lrs.c lrslib.c lrsdriver.c lrsmp.c - $(CC) -Wall -O3 -DSAFE -DLRSLONG -o lrs1 lrs.c lrslib.c lrsdriver.c lrslong.c - $(CC) -Wall -O3 -DSAFE -DLRSLONG -DB128 -o lrs2 lrs.c lrslib.c lrsdriver.c lrslong.c - $(CC) -O3 -DLRS_QUIET -o lrsnash lrsnash.c lrsnashlib.c lrslib.c lrsdriver.c lrsmp.c - $(CC) -O3 -o setnash setupnash.c lrslib.c lrsdriver.c lrsmp.c - $(CC) -O3 -o setnash2 setupnash2.c lrslib.c lrsdriver.c lrsmp.c - $(CC) -O3 -o 2nash 2nash.c + $(CC) ${CFLAGS} -o lrs lrs.c lrslib.c lrsdriver.c lrsmp.c + $(CC) ${CFLAGS} -DSAFE -DLRSLONG -o lrs1 lrs.c lrslib.c lrsdriver.c lrslong.c + $(CC) ${CFLAGS} -DSAFE -DLRSLONG -DB128 -o lrs2 lrs.c lrslib.c lrsdriver.c lrslong.c + $(CC) ${CFLAGS} -DLRS_QUIET -o lrsnash lrsnash.c lrsnashlib.c lrslib.c lrsdriver.c lrsmp.c + $(CC) ${CFLAGS} -o setnash setupnash.c lrslib.c lrsdriver.c lrsmp.c + $(CC) ${CFLAGS} -o setnash2 setupnash2.c lrslib.c lrsdriver.c lrsmp.c + $(CC) ${CFLAGS} -o 2nash 2nash.c demo: lpdemo1.c lrslib.c lrsdriver.c lrslib.h lrsgmp.c lrsgmp.h - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo1 lpdemo1.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo lpdemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo2 lpdemo2.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o vedemo vedemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o chdemo chdemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo1 lpdemo1.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo lpdemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lpdemo2 lpdemo2.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o vedemo vedemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o chdemo chdemo.c lrslib.c lrsdriver.c lrsgmp.c -lgmp -DGMP lrsnash: lrsnash.c nashdemo.c lrsnashlib.c lrslib.c lrsnashlib.h lrslib.h lrsgmp.c lrsgmp.h lrslong.h lrsdriver.h lrsdriver.c - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lrsnashgmp lrsnash.c lrsnashlib.c lrslib.c lrsgmp.c lrsdriver.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lrsnash1 lrsnash.c lrsnashlib.c lrslib.c lrslong.c lrsdriver.c -DLRSLONG -DSAFE - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o lrsnash2 lrsnash.c lrsnashlib.c lrslib.c lrslong.c lrsdriver.c -DLRSLONG -DSAFE -DB128 - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o nashdemo nashdemo.c lrsnashlib.c lrslib.c lrsgmp.c lrsdriver.c -lgmp -DGMP - $(CC) -O3 -I${INCLUDEDIR} -L${LIBDIR} -o 2nash 2nash.c + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lrsnashgmp lrsnash.c lrsnashlib.c lrslib.c lrsgmp.c lrsdriver.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lrsnash1 lrsnash.c lrsnashlib.c lrslib.c lrslong.c lrsdriver.c -DLRSLONG -DSAFE + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o lrsnash2 lrsnash.c lrsnashlib.c lrslib.c lrslong.c lrsdriver.c -DLRSLONG -DSAFE -DB128 + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o nashdemo nashdemo.c lrsnashlib.c lrslib.c lrsgmp.c lrsdriver.c -lgmp -DGMP + $(CC) ${CFLAGS} -I${INCLUDEDIR} -L${LIBDIR} -o 2nash 2nash.c cp lrsnashgmp lrsnash fourier: fourier.c lrslib.h lrslib.c lrsgmp.h lrsgmp.c - $(CC) -O3 -DGMP -I${INCLUDEDIR} fourier.c lrslib.c lrsdriver.c lrsgmp.c -L${LIBDIR} -lgmp -o fourier + $(CC) ${CFLAGS} -DGMP -I${INCLUDEDIR} fourier.c lrslib.c lrsdriver.c lrsgmp.c -L${LIBDIR} -lgmp -o fourier ###################################################################### # From here on the author is David Bremner to whom you should turn for help @@ -189,12 +189,12 @@ SHLINK ?=liblrs.so SHLIBOBJ=lrslong1-shr.o lrslong2-shr.o lrslib1-shr.o lrslib2-shr.o \ lrslibgmp-shr.o lrsgmp-shr.o lrsdriver-shr.o -SHLIBBIN=lrs-shared lrsnash-shared +SHLIBBIN=lrs-shared lrsnash-shared lrs1 lrs2 lrsgmp lrsnash1 lrsnash2 lrsnashgmp 2nash nashdemo redund redund1 redund2 redundgmp # Building (linking) the shared library, and relevant symlinks. ${SHLIB}: ${SHLIBOBJ} - $(CC) -shared -Wl,-soname=$(SONAME) $(SHLIBFLAGS) -o $@ ${SHLIBOBJ} -lgmp + $(CC) -shared -Wl,-soname=${SHLIB} $(SHLIBFLAGS) -o $@ ${SHLIBOBJ} -L${LIBDIR} -lgmp ${SONAME}: ${SHLIB} ln -sf ${SHLIB} ${SONAME} @@ -211,7 +211,7 @@ lrs-shared: ${SHLINK} lrs.o lrsnash-shared: ${SHLINK} lrsnash.c - $(CC) -DGMP -DMA lrsnash.c lrsnashlib.c -I${INCLUDEDIR} -o $@ -L . -llrs -lgmp + $(CC) ${CFLAGS} -DGMP -DMA lrsnash.c lrsnashlib.c -I${INCLUDEDIR} -o $@ -L . -L${LIBDIR} -llrs -lgmp # build object files for the shared library @@ -240,19 +240,17 @@ lrslib2-shr.o: lrslib.c lrslib.h # install targets # where to install binaries, libraries, include files prefix ?= /usr/local -INSTALL_INCLUDES=lrslib.h lrsdriver.h lrsgmp.h lrslong.h lrsmp.h +INSTALL_INCLUDES=lrslib.h lrsdriver.h lrsgmp.h lrslong.h lrsmp.h lrsnashlib.h lrsrestart.h install: all-shared install-common mkdir -p $(DESTDIR)${prefix}/bin for file in ${SHLIBBIN}; do cp $${file} $(DESTDIR)${prefix}/bin/$$(basename $$file -shared); done mkdir -p $(DESTDIR)${prefix}/lib - install -t $(DESTDIR)${prefix}/lib $(SHLIB) - cd $(DESTDIR)${prefix}/lib && ln -sf $(SHLIB) $(SHLINK) - cd $(DESTDIR)${prefix}/lib && ln -sf $(SHLIB) $(SONAME) + install $(SHLIB) $(DESTDIR)${prefix}/lib install-common: mkdir -p $(DESTDIR)${prefix}/include/lrslib - install -t $(DESTDIR)${prefix}/include/lrslib ${INSTALL_INCLUDES} + install ${INSTALL_INCLUDES} $(DESTDIR)${prefix}/include/lrslib ###################################################################### clean: