linux - 生成文件错误 - "***missing separator"& "***recipe commences before first target"

标签 linux os161 makefile

我正在尝试为 os161 构建用户空间。当我在命令行中键入 make 时,出现以下错误:

Makefile 24: ***missing separator (did you mean TAB instead of 8 spaces?). Stop.

我检查了第 24 行的 Makefile 并尝试在该行的开头添加一个 TAB,但这没有用,因为我随后收到另一个错误:

Makefile 24: ***recipe commences before first target. Stop.

这里是完整的 makefile 以供引用:

#
# Toplevel makefile for OS/161.
#
#
# Main rules:
#    all (default):  depend and compile system; install into staging area
#    rebuild:        likewise, but start with a clean slate.
#    fullrebuild:    likewise, but start with a very clean slate.
#
# What all does, in order:
#    tools:          depend and compile the tools used in build.
#    includes:       install header files.
#    build:          depend and compile the system.
#
# Other targets:
#    depend:         just update make dependency information.
#    tags:           generate/regenerate "tags" files.
#    install:        install into $(OSTREE).
#    clean:          remove generated files.
#    distclean:      remove all generated files.
#

TOP=.
.include "$(TOP)/mk/os161.config.mk"

all:;  # make this first

MKDIRS=$(OSTREE)

.include "$(TOP)/mk/os161.mkdirs.mk"

all: tools .WAIT includes .WAIT build

rebuild:
    $(MAKE) clean
    $(MAKE) all

fullrebuild:
    $(MAKE) distclean
    $(MAKE) all

# currently no tools required, hence no tools/ dir or work to do
tools:
    @true

build:
    (cd userland && $(MAKE) build)
    (cd man && $(MAKE) install-staging)
    (cd testscripts && $(MAKE) build)

includes tags depend:
    (cd kern && $(MAKE) $@)
    (cd userland && $(MAKE) $@)

clean:
    (cd kern && $(MAKE) $@)
    (cd userland && $(MAKE) $@)
    rm -rf $(INSTALLTOP)

distclean: clean
    rm -rf $(WORKDIR)

install: $(OSTREE)
    (cd $(INSTALLTOP) && tar -cf - .) | (cd $(OSTREE) && tar -xvf -)


.PHONY: all rebuild fullrebuild tools build includes tags depend
.PHONY: clean distclean

# old BSD name, same as distclean
cleandir: distclean
.PHONY: cleandir

第(24)行是:

.include "$(TOP)/mk/os161.config.mk"

如有任何帮助,我们将不胜感激。我检查了类似的 makefile 错误,但我似乎找不到问题所在。

最佳答案

仔细阅读documentation of GNU make ,特别是关于 include directive .

你的

.include "$(TOP)/mk/os161.config.mk"

(错误地)请求包含一个路径以双引号开头的文件(您可能没有任何文件,因此 include 失败...)

你想要

-include $(TOP)/mk/os161.config.mk

并且该行以减号或破折号开头,而不是点。

一定要使用保持 tab 字符完整的编辑器。

顺便说一句,FreeBSD make接受带有起始点的 .include 指令并需要双引号中的路径。

关于linux - 生成文件错误 - "***missing separator"& "***recipe commences before first target",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44081364/

相关文章:

java - Java中更改当前目录在linux中实现 "cd"命令

makefile - 使用 GNU make 的 $(foreach) 迭代一个空项目

linux - 在末尾添加摘要的问题/失败数量的计数器

linux - 如何自动获得IP地址更改通知

python - (centos6.6) 更新python2.7.3之前,是python 2.6.6。运行 pybot --version 时出现错误

c - 如何在 OS/161 中添加新的系统调用?

c - OS161 错误前应为 '=' 、 ',' 、 ';' 、 'asm' 或 '__attribute__'

c - thread_fork 在内核上工作

c - 制作简单的linux内核模块

linux - Win32 InterlockedIncrement 和 InterlockedExchange 是跨进程的原子吗?