Merge pull request #54 from peterhj/peterhj-staticlib
Add a static library target "staticlib" to the Makefile.
This commit is contained in:
commit
ddddfba1c0
15
Makefile
15
Makefile
@ -60,12 +60,13 @@ CUDA_MAJOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 1)
|
|||||||
CUDA_MINOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 2)
|
CUDA_MINOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 2)
|
||||||
CXXFLAGS += -DCUDA_MAJOR=$(CUDA_MAJOR) -DCUDA_MINOR=$(CUDA_MINOR)
|
CXXFLAGS += -DCUDA_MAJOR=$(CUDA_MAJOR) -DCUDA_MINOR=$(CUDA_MINOR)
|
||||||
|
|
||||||
.PHONY : lib clean test mpitest install deb debian debclean forlib fortest forclean
|
.PHONY : all lib staticlib clean test mpitest install deb debian debclean forlib fortest forclean
|
||||||
.DEFAULT : lib
|
.DEFAULT : all
|
||||||
|
|
||||||
INCEXPORTS := nccl.h
|
INCEXPORTS := nccl.h
|
||||||
LIBSRCFILES := libwrap.cu core.cu all_gather.cu all_reduce.cu broadcast.cu reduce.cu reduce_scatter.cu
|
LIBSRCFILES := libwrap.cu core.cu all_gather.cu all_reduce.cu broadcast.cu reduce.cu reduce_scatter.cu
|
||||||
LIBNAME := libnccl.so
|
LIBNAME := libnccl.so
|
||||||
|
STATICLIBNAME := libnccl_static.a
|
||||||
|
|
||||||
INCDIR := $(BUILDDIR)/include
|
INCDIR := $(BUILDDIR)/include
|
||||||
LIBDIR := $(BUILDDIR)/lib
|
LIBDIR := $(BUILDDIR)/lib
|
||||||
@ -74,12 +75,17 @@ OBJDIR := $(BUILDDIR)/obj
|
|||||||
INCTARGETS := $(patsubst %, $(INCDIR)/%, $(INCEXPORTS))
|
INCTARGETS := $(patsubst %, $(INCDIR)/%, $(INCEXPORTS))
|
||||||
LIBSONAME := $(patsubst %,%.$(NCCL_MAJOR),$(LIBNAME))
|
LIBSONAME := $(patsubst %,%.$(NCCL_MAJOR),$(LIBNAME))
|
||||||
LIBTARGET := $(patsubst %,%.$(NCCL_MAJOR).$(NCCL_MINOR).$(NCCL_PATCH),$(LIBNAME))
|
LIBTARGET := $(patsubst %,%.$(NCCL_MAJOR).$(NCCL_MINOR).$(NCCL_PATCH),$(LIBNAME))
|
||||||
|
STATICLIBTARGET := $(STATICLIBNAME)
|
||||||
LIBLINK := $(patsubst lib%.so, -l%, $(LIBNAME))
|
LIBLINK := $(patsubst lib%.so, -l%, $(LIBNAME))
|
||||||
LIBOBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(filter %.cu, $(LIBSRCFILES)))
|
LIBOBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(filter %.cu, $(LIBSRCFILES)))
|
||||||
DEPFILES := $(patsubst %.o, %.d, $(LIBOBJ)) $(patsubst %, %.d, $(TESTBINS)) $(patsubst %, %.d, $(MPITESTBINS))
|
DEPFILES := $(patsubst %.o, %.d, $(LIBOBJ)) $(patsubst %, %.d, $(TESTBINS)) $(patsubst %, %.d, $(MPITESTBINS))
|
||||||
|
|
||||||
|
all : lib staticlib
|
||||||
|
|
||||||
lib : $(INCTARGETS) $(LIBDIR)/$(LIBTARGET)
|
lib : $(INCTARGETS) $(LIBDIR)/$(LIBTARGET)
|
||||||
|
|
||||||
|
staticlib : $(INCTARGETS) $(LIBDIR)/$(STATICLIBTARGET)
|
||||||
|
|
||||||
-include $(DEPFILES)
|
-include $(DEPFILES)
|
||||||
|
|
||||||
$(LIBDIR)/$(LIBTARGET) : $(LIBOBJ)
|
$(LIBDIR)/$(LIBTARGET) : $(LIBOBJ)
|
||||||
@ -89,6 +95,11 @@ $(LIBDIR)/$(LIBTARGET) : $(LIBOBJ)
|
|||||||
ln -sf $(LIBSONAME) $(LIBDIR)/$(LIBNAME)
|
ln -sf $(LIBSONAME) $(LIBDIR)/$(LIBNAME)
|
||||||
ln -sf $(LIBTARGET) $(LIBDIR)/$(LIBSONAME)
|
ln -sf $(LIBTARGET) $(LIBDIR)/$(LIBSONAME)
|
||||||
|
|
||||||
|
$(LIBDIR)/$(STATICLIBTARGET) : $(LIBOBJ)
|
||||||
|
@printf "Archiving %-35s > %s\n" $(STATICLIBTARGET) $@
|
||||||
|
mkdir -p $(LIBDIR)
|
||||||
|
ar cr $@ $(LIBOBJ)
|
||||||
|
|
||||||
$(INCDIR)/%.h : src/%.h
|
$(INCDIR)/%.h : src/%.h
|
||||||
@printf "Grabbing %-35s > %s\n" $< $@
|
@printf "Grabbing %-35s > %s\n" $< $@
|
||||||
mkdir -p $(INCDIR)
|
mkdir -p $(INCDIR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user