58 -e 's|Note: including file: *||' \ 59 -e 's|\\|/|g' \ 60 -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ 61 -e '/$(subst /,\/,$(TOPDIR))/!d' \ 62 -e 's|$$$$| \\|g' \ 63 # 64 65 define add_native_source 66 # param 1 = BUILD_MYPACKAGE 67 # parma 2 = the source file name (..../alfa.c or .../beta.cpp) 68 # param 3 = the bin dir that stores all .o (.obj) and .d files. 69 # param 4 = the c flags to the compiler 70 # param 5 = the c compiler 71 # param 6 = the c++ flags to the compiler 72 # param 7 = the c++ compiler 73 # param 8 = the objc compiler 74 # param 9 = the flags to the assembler 75 76 ifneq (,$$(filter %.c,$2)) 77 # Compile as a C file 78 $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c 79 $1_$2_COMP=$5 80 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) 81 else ifneq (,$$(filter %.m,$2)) 82 # Compile as a objective-c file 83 $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c 84 $1_$2_COMP=$8 85 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) 86 else ifneq (,$$(filter %.s,$2)) 87 # Compile as assembler file 88 $1_$2_FLAGS=$9 -DTHIS_FILE='"$$(<F)"' 89 $1_$2_COMP=$(AS) 90 $1_$2_DEP_FLAG:= 91 else ifneq (,$$(filter %.cpp,$2)$$(filter %.mm,$2)) 92 # Compile as a C++ file 93 $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c 94 $1_$2_COMP=$7 95 $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS) 96 else 97 $$(error Internal error in NativeCompilation.gmk: no compiler for file $2) 98 endif 99 # Generate the .o (.obj) file name and place it in the bin dir. 100 $1_$2_OBJ := $3/$$(call replace_with_obj_extension, $$(notdir $2)) 101 # Only continue if this object file hasn't been processed already. This lets the first found 102 # source file override any other with the same name. 103 ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_ALL_OBJS))) 104 $1_ALL_OBJS+=$$($1_$2_OBJ) 105 ifeq (,$$(filter %.s,$2)) 106 # And this is the dependency file for this obj file. 107 $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) 108 # Include previously generated dependency information. (if it exists) 109 -include $$($1_$2_DEP) 110 111 ifeq ($(TOOLCHAIN_TYPE), microsoft) 112 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ 113 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) | 58 -e 's|Note: including file: *||' \ 59 -e 's|\\|/|g' \ 60 -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ 61 -e '/$(subst /,\/,$(TOPDIR))/!d' \ 62 -e 's|$$$$| \\|g' \ 63 # 64 65 define add_native_source 66 # param 1 = BUILD_MYPACKAGE 67 # parma 2 = the source file name (..../alfa.c or .../beta.cpp) 68 # param 3 = the bin dir that stores all .o (.obj) and .d files. 69 # param 4 = the c flags to the compiler 70 # param 5 = the c compiler 71 # param 6 = the c++ flags to the compiler 72 # param 7 = the c++ compiler 73 # param 8 = the objc compiler 74 # param 9 = the flags to the assembler 75 76 ifneq (,$$(filter %.c,$2)) 77 # Compile as a C file 78 $1_$2_FLAGS=$(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c 79 $1_$2_COMP=$5 80 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) 81 else ifneq (,$$(filter %.m,$2)) 82 # Compile as a objective-c file 83 $1_$2_FLAGS=-x objective-c $(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c 84 $1_$2_COMP=$8 85 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) 86 else ifneq (,$$(filter %.s,$2)) 87 # Compile as assembler file 88 $1_$2_FLAGS=$9 -DTHIS_FILE='"$$(<F)"' 89 $1_$2_COMP=$(AS) 90 $1_$2_DEP_FLAG:= 91 else ifneq (,$$(filter %.cpp,$2)$$(filter %.mm,$2)) 92 # Compile as a C++ file 93 $1_$2_FLAGS=$(CFLAGS_CCACHE) $6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c 94 $1_$2_COMP=$7 95 $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS) 96 else 97 $$(error Internal error in NativeCompilation.gmk: no compiler for file $2) 98 endif 99 # Generate the .o (.obj) file name and place it in the bin dir. 100 $1_$2_OBJ := $3/$$(call replace_with_obj_extension, $$(notdir $2)) 101 # Only continue if this object file hasn't been processed already. This lets the first found 102 # source file override any other with the same name. 103 ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_ALL_OBJS))) 104 $1_ALL_OBJS+=$$($1_$2_OBJ) 105 ifeq (,$$(filter %.s,$2)) 106 # And this is the dependency file for this obj file. 107 $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) 108 # Include previously generated dependency information. (if it exists) 109 -include $$($1_$2_DEP) 110 111 ifeq ($(TOOLCHAIN_TYPE), microsoft) 112 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ 113 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |