我正在尝试运行以下生成文件

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/*

# DO NOT DELETE

并获取以下错误消息:
$ make
makedepend --  -- -M
make: makedepend: Command not found
make: *** [dep] Error 127

我认为我可能没有makedepend安装,就像我在输入make i get后按tab键一样:
$ make <TAB>
clean        default      dep          depend       executables  makefile

如果我没有安装makedepend,我该如何安装它并指向
makedepend -- $(CFLAGS) -- -I /usr/include/linux $(INCLUDES) $(LIB_SRC)

它需要指向什么?
谢谢!
更新:戴维德的回答解决了问题…
然而,我现在仍然坚持:
$ 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

我怀疑这是实际makefile的问题….

最佳答案

你错过了makedepend工具。
按照以下说明编译源代码(使您独立于发行版)来安装:
Download and install makedepend

09-08 01:46