gpt4 book ai didi

c - makefile(可执行文件)错误

转载 作者:太空宇宙 更新时间:2023-11-04 06:36:16 25 4
gpt4 key购买 nike

您好,在之前没有安装 makedepend 的问题(现在已解决)之后,我现在在尝试运行我的 makefile 时遇到以下错误:

$ make
makedepend -- -- -I /usr/include/linux -I include
cp executables
cp: missing destination file operand after `executables'
Try `cp --help' for more information.
make: *** [executables] Error 1

这是我的生成文件:

CMDLINE_SRC=$(wildcard commandLine/*.c)
CMDLINE_OBJS = $(CMDLINE_SRC:.c=.o)
EXECUTABLES = $(CMDLINE_SRC:.c=)

LIB_SRC=$(wildcard c/*.c)
LIB_OBJ = $(LIB_SRC:.c=.o)
LIB_OUT = lib/libclinrisk.a

INCLUDES = -I include

# compiler
CC = gcc
CCFLAGS =
LDFLAGS =

# library paths
LIBS = -Llib -lclinrisk -lm

.SUFFIXES: .c

default: dep executables

executables: $(EXECUTABLES)
cp $(EXECUTABLES) executables

$(EXECUTABLES): $(LIB_OUT)

.c:
$(CC) $(INCLUDES) $(LDFLAGS) $< -o $@ $(LIBS)

.c.o:
$(CC) $(INCLUDES) $(CCFLAGS) -c $< -o $@

$(LIB_OUT): $(LIB_OBJ)
ar rcs $(LIB_OUT) $(LIB_OBJ)

depend: dep

dep:
makedepend -- $(CFLAGS) -- -I /usr/include/linux $(INCLUDES) $(LIB_SRC)

clean:
rm -f $(LIB_OBJ) $(LIB_OUT) Makefile.bak
rm -f $(CMDLINE_OBJ) $(CMDLINE_PROGS)
rm -f executables/*

这里有什么问题?我是 makefile 的新手!同时会尝试解决这个问题。

问题看起来与以下问题有关:

cp $(EXECUTABLES) executables

但是我不知道通往可执行文件的正确路径...

谢谢。

最佳答案

您的 Makefile 代码中没有任何内容设置 EXECUTABLES 变量,因此它替换为一个空字符串,它仅使用一个参数调用 cp,从而产生错误。

关于c - makefile(可执行文件)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14728397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com