From 8fecf27e5eba5e89d9212c2235e957a64e58ec22 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 20 Jan 2016 16:38:01 +0100 Subject: Don't build cuda non-PIC object if static libs are disabled This significantly speeds up builds since we usually pass disable-static to libtool. --- build/linux/Makefile.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'build') diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in index f556066..8398e35 100644 --- a/build/linux/Makefile.in +++ b/build/linux/Makefile.in @@ -295,14 +295,18 @@ libastra.la: $(ALL_OBJECTS) $(MKDIR) $(*D)/$(DEPDIR) ./libtool --mode=compile --tag=CXX $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o +gen_static_libs := `./libtool --features | grep -q 'disable static' && echo no || echo yes` + ifeq ($(cuda),yes) %.lo: %.cu @# Behave like libtool: compile both a PIC and a non-PIC object file @$(MKDIR) $(*D) - $(NVCC) $(NVCCFLAGS) -c $(<) -o $*.o @$(MKDIR) $(*D)/.libs @$(MKDIR) $(*D)/$(DEPDIR) - @$(NVCC) $(NVCCFLAGS) -c $(<) -Xcompiler -fPIC -DPIC -o $(*D)/.libs/$(*F).o >/dev/null 2>&1 + $(NVCC) $(NVCCFLAGS) -c $(<) -Xcompiler -fPIC -DPIC -o $(*D)/.libs/$(*F).o +ifeq ($(gen_static_libs),yes) + @$(NVCC) $(NVCCFLAGS) -c $(<) -o $*.o >/dev/null 2>&1 +endif @# Generate a .d file, with target name $*.lo @$(NVCC) $(NVCCFLAGS) -M $(<) -MT $(*F).lo -odir $(*D) -o $(*D)/$(DEPDIR)/$(*F).d @# Generate empty targets for all dependencies listed in the .d file. @@ -319,7 +323,11 @@ ifeq ($(cuda),yes) @echo "pic_object='.libs/$(*F).o'" >> $*.lo @echo >> $*.lo @echo "# Name of the non-PIC object." >> $*.lo +ifeq ($(gen_static_libs),yes) @echo "non_pic_object='$(*F).o'" >> $*.lo +else + @echo "non_pic_object=none" >> $*.lo +endif @# Remove generated .linkinfo file @rm -f $(*F).linkinfo endif -- cgit v1.2.3