[PATCH 07/08] Generalize Makefile .so Version Against: numactl-2.0.3-rc2 When building "upstream" libnuma on a system with, e.g., a distro-supplied numactl package installed, I find it useful to build a different version of libnuma.so, so that both versions of the library can co-exist. This patch replaces all explicit usage of the libnuma.so.N file name with the make variable LIBNUMA_SO. Note that I'm building with 'libnuma.so.2'. I think this makes sense for numactl 2.x.y, but may not be what you want. Makefile | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) Index: numactl-2.0.3-rc2/Makefile =================================================================== --- numactl-2.0.3-rc2.orig/Makefile 2009-01-30 10:10:15.000000000 -0500 +++ numactl-2.0.3-rc2/Makefile 2009-02-13 10:16:47.000000000 -0500 @@ -8,6 +8,8 @@ BENCH_CFLAGS := -O3 -ffast-math -funroll CFLAGS += ${OPT_CFLAGS} override CFLAGS += -I. +LIBNUMA_SO = libnuma.so.2 + # find out if compiler supports __thread THREAD_SUPPORT := $(shell if $(CC) $(CFLAGS) threadtest.c -o threadtest \ >/dev/null 2>/dev/null ; then echo "yes" ; else echo "no"; fi) @@ -23,7 +25,7 @@ ifeq ($(THREAD_SUPPORT),yes) endif CLEANFILES := numactl.o libnuma.o numactl numademo numademo.o distance.o \ - memhog libnuma.so libnuma.so.1 numamon numamon.o syscall.o bitops.o \ + memhog libnuma.so $(LIBNUMA_SO) numamon numamon.o syscall.o bitops.o \ memhog.o util.o stream_main.o stream_lib.o shm.o stream clearcache.o \ test/pagesize test/tshared test/mynode.o test/tshared.o mt.o empty.o empty.c \ test/mynode test/ftok test/prefered test/randmap \ @@ -77,13 +79,13 @@ stream: stream_lib.o stream_main.o libn stream_main.o: stream_main.c -libnuma.so.1: versions.ldscript +$(LIBNUMA_SO): versions.ldscript -libnuma.so.1: libnuma.o syscall.o distance.o - ${CC} -shared -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o libnuma.so.1 $(filter-out versions.ldscript,$^) +$(LIBNUMA_SO): libnuma.o syscall.o distance.o + ${CC} -shared -Wl,-soname=$(LIBNUMA_SO) -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o $(LIBNUMA_SO) $(filter-out versions.ldscript,$^) -libnuma.so: libnuma.so.1 - ln -sf libnuma.so.1 libnuma.so +libnuma.so: $(LIBNUMA_SO) + ln -sf $(LIBNUMA_SO) libnuma.so libnuma.o : CFLAGS += -fPIC @@ -123,7 +125,7 @@ test/migrate_pages: test/migrate_pages.c MANPAGES := numa.3 numactl.8 numastat.8 migratepages.8 migspeed.8 -install: numactl migratepages migspeed numademo.c numamon memhog libnuma.so.1 numa.h numaif.h numacompat1.h numastat ${MANPAGES} +install: numactl migratepages migspeed numademo.c numamon memhog $(LIBNUMA_SO) numa.h numaif.h numacompat1.h numastat ${MANPAGES} mkdir -p ${prefix}/bin install -m 0755 numactl ${prefix}/bin install -m 0755 migratepages ${prefix}/bin @@ -135,8 +137,8 @@ install: numactl migratepages migspeed n install -m 0644 numa.3 ${prefix}/share/man/man3 ( cd ${prefix}/share/man/man3 ; for i in $$(./manlinks) ; do ln -sf numa.3 $$i.3 ; done ) mkdir -p ${libdir} - install -m 0755 libnuma.so.1 ${libdir} - cd ${libdir} ; ln -sf libnuma.so.1 libnuma.so + install -m 0755 $(LIBNUMA_SO) ${libdir} + cd ${libdir} ; ln -sf $(LIBNUMA_SO) libnuma.so install -m 0644 libnuma.a ${libdir} mkdir -p ${prefix}/include install -m 0644 numa.h numaif.h numacompat1.h ${prefix}/include -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html