Home | History | Annotate | Download | only in snmprelayd
      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 #
     22 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 
     26 include ../../Makefile.vars
     27 
     28 MANIFEST = snmpdx.xml
     29 SVCMETHOD = svc-snmpdx
     30 
     31 include $(SRC)/cmd/Makefile.cmd
     32 
     33 #
     34 # In order to conform with the Solaris 2.6 way of packaging things,
     35 # we now need to put any deliverable that is specified in the
     36 # prototype file into a common "proto" area, so that their
     37 # packaging scheme knows where to obtain the input binaries.
     38 #
     39 
     40 AGENT = snmpdx
     41 BINPROG = $(AGENT)
     42 PROG=$(BINPROG)
     43 
     44 OPTBIN = $(ROOT)/usr/lib/snmp
     45 OPTPROG = $(PROG:%=$(OPTBIN)/%)
     46 
     47 $(OPTPROG):=	FILEMODE = 0755
     48 
     49 $(OPTBIN)/%: $(OPTBIN) %
     50 	$(INS.file)
     51 
     52 MYCONF = $(CONFIG_FILES)
     53 CONFLOC = $(ROOT)/etc/snmp/conf
     54 CONFRULE = $(MYCONF:%=$(CONFLOC)/%)
     55 
     56 $(CONFLOC)/%: $(CONFLOC) %
     57 	$(INS.file)
     58 
     59 $(OPTBIN) $(CONFLOC):
     60 	$(INS.dir)
     61 
     62 STUB.c = mib_handler.c $(AGENT)_tree.c $(AGENT)_appl.c $(AGENT)_trap.c
     63 STUB.h = $(AGENT)_stub.h
     64 
     65 SOURCES.c=\
     66 	agent.c\
     67 	subtree.c\
     68 	session.c\
     69 	dispatcher.c\
     70 	res.c\
     71 	sh_table.c\
     72 	$(STUB.c)
     73 
     74 SOURCES.h=\
     75 	../snmplib/impl.h\
     76 	../snmplib/error.h\
     77 	../snmplib/trace.h\
     78 	../snmplib/asn1.h\
     79 	../snmplib/signals.h\
     80 	../snmplib/snmp.h\
     81 	../snmplib/pdu.h\
     82 	../snmplib/request.h\
     83 	snmprelay_msg.h\
     84 	agent.h\
     85 	subtree.h\
     86 	session.h\
     87 	config.h\
     88 	dispatcher.h\
     89 	res.h\
     90 	$(STUB.h)\
     91 	../snmplib/trap.h\
     92 	../agent/access.h\
     93 	../agent/agent_msg.h\
     94 	sh_table.h\
     95 	name.h
     96 
     97 #
     98 # We need the config files to build the sacom directory,
     99 # so pull them out of SCCS.
    100 #
    101 
    102 CONFIG_FILES =\
    103 	mibiisa.rsrc-\
    104 	snmpdx.acl\
    105 	snmpdx.reg\
    106 	snmpdx.rsrc\
    107 	enterprises.oid
    108 
    109 OBJECTS= $(SOURCES.c:%.c=$(BIN)/%.o)
    110 
    111 EXT = 1
    112 MYLIBS=	../agent/$(MACH)/libssagent.so.$(EXT) ../snmplib/$(MACH)/libssasnmp.so.$(EXT)
    113 MYLINKLIBS += -L../agent/$(MACH) -lssagent -L../snmplib -lssasnmp
    114 
    115 LIBS=	-lsocket -lnsl -ll
    116 
    117 # snmpdx has a name clash with main() and libl.so.1.  However, snmpdx must
    118 # still export a number of "yy*" (libl) interfaces, and interfaces for
    119 # libssagent.so.1.  Reduce all other symbols to local scope.
    120 MAPFILES +=	$(MAPFILE.INT) $(MAPFILE.LEX) $(MAPFILE.NGB)
    121 MAPOPTS =	$(MAPFILES:%=-M%)
    122 
    123 CPPFLAGS +=	-I. -I../agent -I../snmplib -I../../include/netmgt -I${BIN}
    124 CFLAGS +=	-c -D$(TARG_SYS)
    125 LDFLAGS +=	$(MAPOPTS) $(LDLIBS)
    126 
    127 LINT=lint
    128 
    129 SNMP_ROOT= ..
    130 PARSER_HOME= $(SNMP_ROOT)/parser
    131 MIB_HOME= $(SNMP_ROOT)/mib
    132 PURIFY_HOME= /usr/soft/purify3.0
    133 
    134 
    135 MIBS= $(MIB_HOME)/mib_core.txt $(MIB_HOME)/snmpdx.mib
    136 PARSER= $(PARSER_HOME)/$(BIN)/mibcodegen
    137 
    138 .KEEP_STATE:
    139 
    140 #######################################################
    141 
    142 #
    143 # all
    144 #
    145 
    146 ROOTMANIFESTDIR = $(ROOTSVCAPPLICATIONMANAGEMENT)
    147 
    148 $(CONFRULE) := FILEMODE = 0644
    149 $(CONFLOC)/snmpdx.acl := FILEMODE = 0600
    150 
    151 CLOBBERFILES += y.tab.c $(BINPROG)
    152 
    153 all: $(SOURCES.h) $(BINPROG) $(CONFIG_FILES)
    154 
    155 install: all $(OPTPROG) $(CONFRULE) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
    156 
    157 check:	$(CHKMANIFEST)
    158 
    159 $(BINPROG): $(BIN) $(OBJECTS) $(BIN)/config.o $(MYLIBS) $(MAPFILES)
    160 	$(CC) -o $(BINPROG) $(LDFLAGS) $(OBJECTS) $(BIN)/config.o \
    161 	    $(MYLINKLIBS) $(LIBS)
    162 	$(POST_PROCESS)
    163 
    164 $(BIN)/%.o: %.c
    165 	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $*.c -o $@
    166 
    167 ${BIN}/config.c: config.y
    168 	$(YACC.y) config.y
    169 	$(CAT) name.h y.tab.c > ${BIN}/config.c
    170 
    171 ${BIN}/config.lex.c: config.l
    172 	$(LEX.l) config.l > ${BIN}/config.lex.c
    173 
    174 $(BIN)/config.o: ${BIN}/config.c ${BIN}/config.lex.c
    175 	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) ${BIN}/config.c -o $(BIN)/config.o
    176 
    177 
    178 #
    179 # parse
    180 #
    181 parse:	$(MIBS)
    182 	$(PARSER) -b $(AGENT) -f $(MIBS)
    183 
    184 #
    185 # lint
    186 #
    187 
    188 lint:
    189 	$(LINT) $(LDFLAGS) $(CPPFLAGS) $(DEFINES) $(SOURCES.c) $(MYLINKLIBS) $(LIBS)
    190 
    191 
    192 #
    193 # purify
    194 #
    195 
    196 purify:
    197 	$(PURIFY) $(CC) -o $(BINPROG) $(LDFLAGS) $(OBJECTS) $(MYLINKLIBS) $(LIBS)
    198 
    199 
    200 #
    201 # directories
    202 #
    203 
    204 $(BIN):
    205 	@$(TEST) -d $@ || mkdir $@
    206 
    207 
    208 #
    209 # clean
    210 #
    211 gen:	
    212 	$(RM) $(AGENT)_stub.h
    213 	$(RM) $(AGENT)_stub.c
    214 	$(RM) $(AGENT)_appl.c
    215 	$(RM) $(AGENT)_tree.c
    216 	$(RM) $(AGENT)_trap.c
    217 
    218 clean:
    219 	$(RM) $(OBJECTS)
    220 	$(RM) $(BIN)/config.lex.c $(BIN)/config.c $(BIN)/config.o
    221 
    222 include $(SRC)/cmd/Makefile.targ
    223