如何将.a文件包含到Makefile中

时间:2019-01-25 17:23:24

标签: makefile linker libuv

我想在以下路径中的makefile文件中包含一个.a库     〜/ libuv / out / Debug / libuv.a

要#include文件.c文件

Makefile如下

ROOT_DIR=$(shell pwd)
export CROSS_COMPILE=aarch64-linux-android-
export ROOT_DIR
export TOP_DIR=$(ROOT_DIR)
export DLSP_ROOT=$(ROOT_DIR)/dlsp
export VROUTER_ROOT=$(ROOT_DIR)/vrouter
export ACP_ROOT=$(ROOT_DIR)/acp
export OVSROOT=$(ROOT_DIR)/ovs
export OVSROOT_SRC=$(OVSROOT)/openvswitch-2.5.0
export LIBS_ROOT=$(ROOT_DIR)/libs
export DPDK_ROOT=$(ROOT_DIR)/dpdk-2.2.0
export DPDK_DIR=$(DPDK_ROOT)
export DPDK_BUILD=$(DPDK_ROOT)/x86_64-native-linuxapp-gcc
export SWITCH_ROOT=$(ROOT_DIR)/switch
export AOS_SWITCH_ROOT=$(SWITCH_ROOT)/adara
export LIB_SWITCH=$(SWITCH_ROOT)/build/lib
export LIBS_DPDK=$(DPDK_BUILD)/lib
export ANS_DPDK=$(LIBS_ROOT)/dpdk-ans

# Compile debug or release version (please use d or r)
export VER=d

export GLOBAL_INCLUDE_DIR=$(TOP_DIR)/include
export MK_DIR=$(TOP_DIR)/mk
export BLD_DIR=$(ROOT_DIR)/build

export IS_GCOV=n

all_targets += ovsbuild
all_targets += libs
all_targets += vrouter
#all_targets += acp
#all_targets += switch
#all_targets += dlsp

# for generate all in one image
#

.PHONY:  all_targets $(all_targets)
all: $(all_targets)

ovsbuild:
make -C $(OVSROOT)

libs:
make -C $(LIBS_ROOT)

vrouter:
make -C $(VROUTER_ROOT)

acp:
make -C $(ACP_ROOT)

switch:
make -C $(SWITCH_ROOT)

dlsp:
make -C $(DLSP_ROOT) -f Makefile.anos

clean_targets += clean_ovsbuild
clean_targets += clean_libs
#clean_targets += clean_vrouter
#clean_targets += clean_switch
#clean_targets += clean_dlsp

#clean_targets: $(addprefix clean_,$(all_targets))
.PHONY:  clean $(clean_targets)

clean: $(clean_targets)
@echo "Delete objs and binaries: $(BUILD_DIR)"
@rm -fr $(BLD_DIR)

clean_libs:
make -C $(LIBS_ROOT) clean

clean_vrouter:
make -C $(VROUTER_ROOT) clean

clean_acp:
    make -C $(ACP_ROOT) clean

clean_switch:
    make -C $(SWITCH_ROOT) clean

clean_dlsp:
    make -C $(DLSP_ROOT) -f Makefile.anos clean


.PHONY: FORCE
FORCE:

要包含我尝试过的库

export LDFLAGS=-L~/libuv/out/Debug -luv

export LDPATHS=-L~/libuv/out/Debug
export LDLIBS=-luv

以上方法均无效。我仍然收到如下所示的错误:

file.c:27.10:fatal error:'uv.h file not found
#include<uv.h>

请让我知道如何放置库。

0 个答案:

没有答案