# Makefile for eyesee-mpp/system/public/rgb_ctrl CUR_PATH := . PACKAGE_TOP := .. EYESEE_MPP_INCLUDE:=$(STAGING_DIR)/usr/include/eyesee-mpp EYESEE_MPP_LIBDIR:=$(STAGING_DIR)/usr/lib/eyesee-mpp # STAGING_DIR is exported in rules.mk, so it can be used directly here. # STAGING_DIR:=.../tina-v316/out/v316-perfnor/staging_dir/target #set source files here. SRCCS := \ rgb_ctrl.c \ lz4f_decompress.c #include directories INCLUDE_DIRS := \ $(CUR_PATH) \ $(CUR_PATH)/../include \ $(EYESEE_MPP_INCLUDE)/external/lz4-1.7.5/lib LOCAL_SHARED_LIBS := \ libpthread \ liblog LOCAL_STATIC_LIBS := \ liblz4 #set dst file name: shared library, static library, execute bin. LOCAL_TARGET_DYNAMIC := librgb_ctrl LOCAL_TARGET_STATIC := librgb_ctrl LOCAL_TARGET_BIN := #generate include directory flags for gcc. inc_paths := $(foreach inc,$(filter-out -I%,$(INCLUDE_DIRS)),$(addprefix -I, $(inc))) \ $(filter -I%, $(INCLUDE_DIRS)) #Extra flags to give to the C compiler LOCAL_CFLAGS := $(CFLAGS) $(inc_paths) -fPIC -Wall #Extra flags to give to the C++ compiler LOCAL_CXXFLAGS := $(CXXFLAGS) $(inc_paths) -fPIC -Wall #Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers). LOCAL_CPPFLAGS := $(CPPFLAGS) #target device arch: x86, arm LOCAL_TARGET_ARCH := $(ARCH) #Extra flags to give to compilers when they are supposed to invoke the linker,‘ld’. LOCAL_LDFLAGS := $(LDFLAGS) LOCAL_DYNAMIC_LDFLAGS := $(LOCAL_LDFLAGS) -shared \ -L $(EYESEE_MPP_LIBDIR) \ -L $(CUR_PATH)/../liblog \ -Wl,-Bstatic \ -Wl,--start-group $(foreach n, $(LOCAL_STATIC_LIBS), -l$(patsubst lib%,%,$(patsubst %.a,%,$(notdir $(n))))) -Wl,--end-group \ -Wl,-Bdynamic \ $(foreach y, $(LOCAL_SHARED_LIBS), -l$(patsubst lib%,%,$(patsubst %.so,%,$(notdir $(y))))) #generate object files OBJS := $(SRCCS:%=%.o) #OBJS=$(patsubst %,%.o,$(SRCCS)) #add dynamic lib name suffix and static lib name suffix. target_dynamic := $(if $(LOCAL_TARGET_DYNAMIC),$(LOCAL_TARGET_DYNAMIC).so,) target_static := $(if $(LOCAL_TARGET_STATIC),$(LOCAL_TARGET_STATIC).a,) #generate exe file. .PHONY: all all: $(target_dynamic) $(target_static) @echo =================================== @echo build eyesee-mpp-system-rgb_ctrl done @echo =================================== $(target_dynamic): $(OBJS) $(CXX) $+ $(LOCAL_DYNAMIC_LDFLAGS) -o $@ @echo ---------------------------- @echo "finish target: $@" # @echo "object files: $+" # @echo "source files: $(SRCCS)" @echo ---------------------------- $(target_static): $(OBJS) $(AR) -rcs -o $@ $+ @echo ---------------------------- @echo "finish target: $@" # @echo "object files: $+" # @echo "source files: $(SRCCS)" @echo ---------------------------- #patten rules to generate local object files %.cpp.o: %.cpp $(CXX) $(LOCAL_CXXFLAGS) $(LOCAL_CPPFLAGS) -c -o $@ $< %.c.o: %.c $(CC) $(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS) -c -o $@ $< # clean all .PHONY: clean clean: -rm -f $(OBJS) $(target_dynamic) $(target_static)