make时 No rule to make target错误解决办法

时间:2021-07-28 14:51:07

make时出错如下:

make[1]: Entering directory `/home/leon/test/HiviewDtvUboot/U-boot/board/hs3000'

make[1]: *** No rule to make target `.depend', needed by `libhs3000.a'.  Stop.

make[1]: Leaving directory `/home/leon/test/HiviewDtvUboot/U-boot/board/hs3000'

解决:

改错误一般是因为Makefile中的 COBJS的路径或文件名错误:如下:

include $(TOPDIR)/config.mk


LIB = $(obj)lib$(BOARD).a


COBJS = $(BOARD).o flash.o  hs3000_delay.o spi.ospi_flash/spi_flash.o#net/net_lakers.o #cfb_console.o sound.o kbd.o usb_ehci_ls1b.o ac97.o dc.o
SOBJS = lowlevel_init.o #ddr2fconfig.o


SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))


$(LIB): $(obj).depend $(OBJS) $(SOBJS)
$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)


#########################################################################


# defines $(obj).depend target
include $(SRCTREE)/rules.mk


sinclude $(obj).depend


#########################################################################