diff options
author | Sylvain Jeaugey <sjeaugey@nvidia.com> | 2016-11-28 20:15:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 20:15:39 +0300 |
commit | ddddfba1c0c4a17bce7377812a436c09dc53cf15 (patch) | |
tree | 9c4a0434aa367bde900f63adbb16310e2ae33e20 | |
parent | c2c515516bad69ee3fa2c7bd2cdac7377b815854 (diff) | |
parent | 5765d608cc2fc602c038dd8aaf5e747986fac25b (diff) |
Merge pull request #54 from peterhj/peterhj-staticlib
Add a static library target "staticlib" to the Makefile.
-rw-r--r-- | Makefile | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -60,12 +60,13 @@ CUDA_MAJOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 1) CUDA_MINOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 2) CXXFLAGS += -DCUDA_MAJOR=$(CUDA_MAJOR) -DCUDA_MINOR=$(CUDA_MINOR) -.PHONY : lib clean test mpitest install deb debian debclean forlib fortest forclean -.DEFAULT : lib +.PHONY : all lib staticlib clean test mpitest install deb debian debclean forlib fortest forclean +.DEFAULT : all INCEXPORTS := nccl.h LIBSRCFILES := libwrap.cu core.cu all_gather.cu all_reduce.cu broadcast.cu reduce.cu reduce_scatter.cu LIBNAME := libnccl.so +STATICLIBNAME := libnccl_static.a INCDIR := $(BUILDDIR)/include LIBDIR := $(BUILDDIR)/lib @@ -74,12 +75,17 @@ OBJDIR := $(BUILDDIR)/obj INCTARGETS := $(patsubst %, $(INCDIR)/%, $(INCEXPORTS)) LIBSONAME := $(patsubst %,%.$(NCCL_MAJOR),$(LIBNAME)) LIBTARGET := $(patsubst %,%.$(NCCL_MAJOR).$(NCCL_MINOR).$(NCCL_PATCH),$(LIBNAME)) +STATICLIBTARGET := $(STATICLIBNAME) LIBLINK := $(patsubst lib%.so, -l%, $(LIBNAME)) LIBOBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(filter %.cu, $(LIBSRCFILES))) DEPFILES := $(patsubst %.o, %.d, $(LIBOBJ)) $(patsubst %, %.d, $(TESTBINS)) $(patsubst %, %.d, $(MPITESTBINS)) +all : lib staticlib + lib : $(INCTARGETS) $(LIBDIR)/$(LIBTARGET) +staticlib : $(INCTARGETS) $(LIBDIR)/$(STATICLIBTARGET) + -include $(DEPFILES) $(LIBDIR)/$(LIBTARGET) : $(LIBOBJ) @@ -89,6 +95,11 @@ $(LIBDIR)/$(LIBTARGET) : $(LIBOBJ) ln -sf $(LIBSONAME) $(LIBDIR)/$(LIBNAME) ln -sf $(LIBTARGET) $(LIBDIR)/$(LIBSONAME) +$(LIBDIR)/$(STATICLIBTARGET) : $(LIBOBJ) + @printf "Archiving %-35s > %s\n" $(STATICLIBTARGET) $@ + mkdir -p $(LIBDIR) + ar cr $@ $(LIBOBJ) + $(INCDIR)/%.h : src/%.h @printf "Grabbing %-35s > %s\n" $< $@ mkdir -p $(INCDIR) |