Home | History | Annotate | Download | only in snmpdemod
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     22 # Use is subject to license terms.
     23 #
     24 # ident	"%Z%%M%	%I%	%E% SMI"
     25 #
     26 
     27 #####################################################
     28 #
     29 # Makefile for a SNMP Agent
     30 #
     31 #####################################################
     32 
     33 #
     34 # Makefile.vars
     35 #
     36 
     37 #####################################################
     38 # Edit the following variables as needed
     39 #####################################################
     40 
     41 BIN=		bin
     42 
     43 SNMP_ROOT=	/usr
     44 
     45 SNMP_LIB=	$(SNMP_ROOT)/lib
     46 
     47 SNMP_INC=	$(SNMP_ROOT)/include/snmp
     48 
     49 PURIFY_HOME=	/usr/soft/purify3.0
     50 
     51 
     52 AGENT=		snmpdemo
     53 
     54 MIBS=		mib_demo.txt
     55 
     56 
     57 #####################################################
     58 
     59 TARGET=		$(AGENT)d
     60 
     61 
     62 .KEEP_STATE:
     63 
     64 SOURCES.c=\
     65 	$(AGENT)_tree.c\
     66 	$(AGENT)_stub.c\
     67 	$(AGENT)_trap.c\
     68 	$(AGENT)_appl.c\
     69 	$(AGENT)_demoEntry.c
     70 
     71 SOURCES.h=\
     72 	$(SNMP_INC)/impl.h\
     73 	$(SNMP_INC)/asn1.h\
     74 	$(SNMP_INC)/error.h\
     75 	$(SNMP_INC)/pdu.h\
     76 	$(SNMP_INC)/trap.h\
     77 	$(SNMP_INC)/node.h\
     78 	$(AGENT)_stub.h
     79 
     80 OBJECTS= $(SOURCES.c:%.c=$(BIN)/%.o)
     81 
     82 
     83 #
     84 #  CC flags
     85 #
     86 
     87 DEFINES=
     88 
     89 MY_INCLUDE=	-I. -I$(SNMP_INC)
     90 
     91 CPPFLAGS +=	$(MY_INCLUDE)
     92 
     93 CFLAGS=		-c
     94 
     95 
     96 #
     97 # LD flags
     98 #
     99 
    100 EXT = 1
    101 
    102 MYLINKLIBS += $(LDLIBS) -L$(SNMP_LIB) -lssagent -L$(SNMP_LIB) -lssasnmp
    103 
    104 LIBS=	$(MYLINKLIBS) -lsocket -lnsl -ly -ll -lelf -lgen
    105 
    106 TEST=	test
    107 
    108 PURIFY= $(PURIFY_HOME)/purify
    109 
    110 PARSER=	$(SNMP_ROOT)/$(BIN)/mibcodegen
    111 
    112 
    113 #####################################################
    114 
    115 #
    116 # all
    117 #
    118 
    119 all: $(SOURCES.h) $(TARGET)   
    120 
    121 install: all
    122 
    123 $(TARGET): $(BIN) $(OBJECTS) $(MYLIBS)
    124 	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(MYLIBS) $(LIBS)
    125 
    126 $(BIN)/%.o: %.c  
    127 	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $*.c -o $@
    128 
    129 
    130 #
    131 # parse
    132 #
    133 
    134 parse:	$(MIBS)
    135 	$(PARSER) -b $(AGENT) -f $(MIBS)
    136 
    137 
    138 #
    139 # lint
    140 #
    141 
    142 lint:
    143 	$(LINT) $(LDFLAGS) $(CPPFLAGS) $(DEFINES) $(SOURCES.c) $(MYLIBS) $(LIBS)
    144 
    145 
    146 #
    147 # purify
    148 #
    149 
    150 purify:
    151 	$(PURIFY) $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(MYLIBS) $(LIBS)
    152 
    153 
    154 #
    155 # directories
    156 #
    157 
    158 $(BIN):
    159 	@$(TEST) -d $@ || mkdir $@
    160 
    161 
    162 #
    163 # clean
    164 #
    165 
    166 clean:
    167 	$(RM) $(OBJECTS)
    168 
    169 clobber: clean
    170 	$(RM) $(TARGET)
    171