diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-01-20 16:38:01 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-01-20 16:38:01 +0100 |
commit | 8fecf27e5eba5e89d9212c2235e957a64e58ec22 (patch) | |
tree | fef5046fffc6802a3ebf916a166ddda2010257be /build | |
parent | b428366389ecdad457fb04e13857902e11585881 (diff) | |
download | astra-8fecf27e5eba5e89d9212c2235e957a64e58ec22.tar.gz astra-8fecf27e5eba5e89d9212c2235e957a64e58ec22.tar.bz2 astra-8fecf27e5eba5e89d9212c2235e957a64e58ec22.tar.xz astra-8fecf27e5eba5e89d9212c2235e957a64e58ec22.zip |
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.
Diffstat (limited to 'build')
-rw-r--r-- | build/linux/Makefile.in | 12 |
1 files changed, 10 insertions, 2 deletions
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 |