Commit 0cc0c5b6 authored by Diego Biurrun's avatar Diego Biurrun Committed by James Almer

build: Allow generating dependencies as a side-effect of assembling

(Cherry-picked from libav commit 3c0efbd0)
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent fd502f4f
...@@ -3329,6 +3329,7 @@ CXX_O='-o $@' ...@@ -3329,6 +3329,7 @@ CXX_O='-o $@'
OBJCC_C='-c' OBJCC_C='-c'
OBJCC_E='-E -o $@' OBJCC_E='-E -o $@'
OBJCC_O='-o $@' OBJCC_O='-o $@'
X86ASM_O='-o $@'
LD_O='-o $@' LD_O='-o $@'
LD_LIB='-l%' LD_LIB='-l%'
LD_PATH='-L' LD_PATH='-L'
...@@ -5491,9 +5492,11 @@ EOF ...@@ -5491,9 +5492,11 @@ EOF
if check_cmd $x86asmexe --version; then if check_cmd $x86asmexe --version; then
enabled x86_64 && x86asm_extra="-m amd64" enabled x86_64 && x86asm_extra="-m amd64"
x86asm_debug="-g dwarf2" x86asm_debug="-g dwarf2"
X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
elif check_cmd nasm -v; then elif check_cmd nasm -v; then
x86asmexe=nasm x86asmexe=nasm
x86asm_debug="-g -F dwarf" x86asm_debug="-g -F dwarf"
X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
if enabled x86_64; then if enabled x86_64; then
case "$objformat" in case "$objformat" in
elf) objformat=elf64 ;; elf) objformat=elf64 ;;
...@@ -6739,6 +6742,7 @@ DEPAS=$as ...@@ -6739,6 +6742,7 @@ DEPAS=$as
DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS) DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
X86ASM=$x86asmexe X86ASM=$x86asmexe
DEPX86ASM=$x86asmexe DEPX86ASM=$x86asmexe
DEPX86ASMFLAGS=\$(X86ASMFLAGS)
AR=$ar AR=$ar
ARFLAGS=$arflags ARFLAGS=$arflags
AR_O=$ar_o AR_O=$ar_o
...@@ -6766,6 +6770,7 @@ CXX_O=$CXX_O ...@@ -6766,6 +6770,7 @@ CXX_O=$CXX_O
NVCC_C=$NVCC_C NVCC_C=$NVCC_C
NVCC_O=$NVCC_O NVCC_O=$NVCC_O
LD_O=$LD_O LD_O=$LD_O
X86ASM_O=$X86ASM_O
LD_LIB=$LD_LIB LD_LIB=$LD_LIB
LD_PATH=$LD_PATH LD_PATH=$LD_PATH
DLLTOOL=$dlltool DLLTOOL=$dlltool
...@@ -6793,8 +6798,11 @@ CXXDEP=$CXXDEP ...@@ -6793,8 +6798,11 @@ CXXDEP=$CXXDEP
CCDEP_FLAGS=$CCDEP_FLAGS CCDEP_FLAGS=$CCDEP_FLAGS
ASDEP=$ASDEP ASDEP=$ASDEP
ASDEP_FLAGS=$ASDEP_FLAGS ASDEP_FLAGS=$ASDEP_FLAGS
X86ASMDEP=$X86ASMDEP
X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
CC_DEPFLAGS=$CC_DEPFLAGS CC_DEPFLAGS=$CC_DEPFLAGS
AS_DEPFLAGS=$AS_DEPFLAGS AS_DEPFLAGS=$AS_DEPFLAGS
X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
HOSTCC=$host_cc HOSTCC=$host_cc
HOSTLD=$host_ld HOSTLD=$host_ld
HOSTCFLAGS=$host_cflags HOSTCFLAGS=$host_cflags
......
...@@ -37,7 +37,7 @@ OBJCFLAGS += $(EOBJCFLAGS) ...@@ -37,7 +37,7 @@ OBJCFLAGS += $(EOBJCFLAGS)
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS) OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
ASFLAGS := $(CPPFLAGS) $(ASFLAGS) ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
X86ASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
NVCCFLAGS += -ptx NVCCFLAGS += -ptx
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
...@@ -52,6 +52,7 @@ COMPILE_C = $(call COMPILE,CC) ...@@ -52,6 +52,7 @@ COMPILE_C = $(call COMPILE,CC)
COMPILE_CXX = $(call COMPILE,CXX) COMPILE_CXX = $(call COMPILE,CXX)
COMPILE_S = $(call COMPILE,AS) COMPILE_S = $(call COMPILE,AS)
COMPILE_M = $(call COMPILE,OBJCC) COMPILE_M = $(call COMPILE,OBJCC)
COMPILE_X86ASM = $(call COMPILE,X86ASM)
COMPILE_HOSTC = $(call COMPILE,HOSTCC) COMPILE_HOSTC = $(call COMPILE,HOSTCC)
COMPILE_NVCC = $(call COMPILE,NVCC) COMPILE_NVCC = $(call COMPILE,NVCC)
...@@ -74,12 +75,11 @@ COMPILE_NVCC = $(call COMPILE,NVCC) ...@@ -74,12 +75,11 @@ COMPILE_NVCC = $(call COMPILE,NVCC)
$(COMPILE_HOSTC) $(COMPILE_HOSTC)
%$(DEFAULT_X86ASMD).asm: %.asm %$(DEFAULT_X86ASMD).asm: %.asm
$(DEPX86ASM) $(X86ASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.asm=.d) $(DEPX86ASM) $(X86ASMFLAGS) -M -o $@ $< > $(@:.asm=.d)
$(X86ASM) $(X86ASMFLAGS) -I $(<D)/ -e $< | sed '/^%/d;/^$$/d;' > $@ $(X86ASM) $(X86ASMFLAGS) -e $< | sed '/^%/d;/^$$/d;' > $@
%.o: %.asm %.o: %.asm
$(DEPX86ASM) $(X86ASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(COMPILE_X86ASM)
$(X86ASM) $(X86ASMFLAGS) -I $(<D)/ -o $@ $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
-$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@) -$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)
%.o: %.rc %.o: %.rc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment