15.5. Makefile Revisited

In "Section 15.1" on page 262, we used a Makefile to generate our agent. Now we just have to modify this Makefile to include our LAD-MIB code.

NETSNMP_VERSION = 5.2.1
BUILD_DIR       = ./net-snmp-$(NETSNMP_VERSION)

#
# Targets
#
all:  clean setup config build

clean:
        rm -rf $(BUILD_DIR)
        rm -rf /opt/snmp/*

setup:
        tar zxvf net-snmp-$(NETSNMP_VERSION).tar.gz; \
❶         mkdir $(BUILD_DIR)/agent/mibgroup/lad; \
❷         cp ladProject.[ch] $(BUILD_DIR)/agent/mibgroup/lad
config:
        cd $(BUILD_DIR); \
❸         export LDFLAGS="-lpq"; \
        ./configure --prefix=/opt/snmp \
❹                     --with-mib-modules="lad/ladProject"<../configure.input; \
        cd ..

build:
        cd $(BUILD_DIR); \
        make
install:
        cd $(BUILD_DIR); \
        install

The changes are fairly minor. We've added two lines to the ...

Get Linux Appliance Design now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.