> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man7/bsd.snmpmod.mk.7.md).

# bsd.snmpmod.mk.7

`bsd.snmpmod.mk` — 为 bsnmpd(1) 构建模块

## 名称

`bsd.snmpmod.mk` bsnmpd(1)

## 概要

`Fd .include <bsd.snmpmod.mk>`

## 描述

文件

`#include <bsd.snmpmod.mk>`

简化了 Begemot SNMP 守护进程 bsnmpd(1) 的模块构建。它提供了一些构建模块的通用功能，并依赖于

`#include <bsd.lib.mk>`

该文件由

`#include <bsd.snmpmod.mk>`

包含，用于实际构建共享库。

以下 [make(1)](/man/man1/make.1.md) 变量控制这些特殊功能：

**`MOD`** 模块的短名称。共享库名称将为 `snmp_${MOD}.so`。必须存在文件 `${MOD}_tree.def` 用于与 gensnmptree(1) 一起编译，该文件包含模块所实现的 MIB 树定义。

**`EXTRAMIBDEFS`** gensnmptree(1) 的额外 MIB 定义文件列表。此项可选。此文件列表会传递给 gensnmptree(1) 的两次调用——一次从 MIB 定义中提取 `XSYM` 中的符号，另一次生成由此模块提供的 OID 表。

**`EXTRAMIBSYMS`** gensnmptree(1) 的额外 MIB 定义文件列表。此项可选。此文件列表仅传递给从 MIB 定义文件中提取符号的 gensnmptree(1) 调用。当存在对其他 MIB 的依赖或需要为枚举常量提取全局定义时很有用。

**`XSYM`** 由 gensnmptree(1) 从 MIB 定义文件中提取的符号列表。此项可选。

**`DEFS`** 要安装的 MIB 定义文件列表。此项可选。

**`BMIBS`** 要安装的文本 MIB 列表。此项可选。

根据 MIB 定义文件和 `XSYM` 变量，自动创建三个文件：

**`${MOD}_tree.c`** 包含模块所实现树结构的表。它会自动包含到 `SRCS` 变量中。

**`${MOD}_tree.h`** 包含模块定义的所有 OID 的预处理器定义，可包含在模块的源代码中。

**`${MOD}_oid.h`** `XSYMS` 中列出的所有符号的 OID 预处理器定义。此文件应包含在模块的源代码中。

## 参见

bsnmpd(1), gensnmptree(1), snmpmod(3)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man7/bsd.snmpmod.mk.7.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
