diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2017-05-11 22:53:41 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2017-05-15 11:46:50 +0200 |
commit | f1ab71b04636edf74a2c9376d80d65981c5ec778 (patch) | |
tree | 216a6c7457d33b0aa84d02c4598bdcb95b4b920e /ffbuild/common.mak | |
parent | 6a3740572dfeef2628a1c54ba61e7e413bfb55f8 (diff) | |
download | ffmpeg-f1ab71b04636edf74a2c9376d80d65981c5ec778.tar.gz |
build: add support for building .cu files via nvcc
Original work by Yogender Gupta <ygupta@nvidia.com>
Diffstat (limited to 'ffbuild/common.mak')
-rw-r--r-- | ffbuild/common.mak | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ffbuild/common.mak b/ffbuild/common.mak index e61f853ebb..b54bc1db2d 100644 --- a/ffbuild/common.mak +++ b/ffbuild/common.mak @@ -15,7 +15,7 @@ ifndef SUBDIR ifndef V Q = @ ECHO = printf "$(1)\t%s\n" $(2) -BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES +BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES NVCC SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM MSG = $@ @@ -38,6 +38,7 @@ OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS) ASFLAGS := $(CPPFLAGS) $(ASFLAGS) CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm +NVCCFLAGS += -ptx HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS) @@ -52,6 +53,7 @@ COMPILE_CXX = $(call COMPILE,CXX) COMPILE_S = $(call COMPILE,AS) COMPILE_M = $(call COMPILE,OBJCC) COMPILE_HOSTC = $(call COMPILE,HOSTCC) +COMPILE_NVCC = $(call COMPILE,NVCC) %.o: %.c $(COMPILE_C) @@ -89,6 +91,12 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC) %.h.c: $(Q)echo '#include "$*.h"' >$@ +%.ptx: %.cu + $(COMPILE_NVCC) + +%.ptx.c: %.ptx + $(Q)sh $(SRC_PATH)/compat/cuda/ptx2c.sh $@ $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) + %.c %.h %.pc %.ver %.version: TAG = GEN # Dummy rule to stop make trying to rebuild removed or renamed headers @@ -133,9 +141,10 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR) SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-) SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o)) +PTXOBJS = $(filter %.ptx.o,$(OBJS)) $(HOBJS): CCFLAGS += $(CFLAGS_HEADERS) checkheaders: $(HOBJS) -.SECONDARY: $(HOBJS:.o=.c) +.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=) alltools: $(TOOLS) @@ -154,7 +163,7 @@ $(TOOLOBJS): | tools OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) -CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version *.ho *$(DEFAULT_YASMD).asm +CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version *.ho *$(DEFAULT_YASMD).asm *.ptx *.ptx.c DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a |