Makefile revision 4604:5989fb2cb1d5
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 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28include ../../Makefile.vars
29
30include $(SRC)/cmd/Makefile.cmd
31
32#
33# In order to conform with the Solaris 2.6 way of packaging things,
34# we now need to put any deliverable that is specified in the
35# prototype file into a common "proto" area, so that their
36# packaging scheme knows where to obtain the input binaries.
37#
38
39AGENT =	snmp_trapsend
40BINPROG = $(AGENT)
41OPTBIN = $(ROOT)/usr/sbin
42OPTPROG = $(PROG:%=$(OPTBIN)/%)
43
44$(OPTBIN)/%: $(OPTBIN) %
45	$(INS.file)
46
47$(OPTBIN):
48	$(INS.dir)
49
50SOURCES.c=\
51	trapsend.c \
52	oid.c \
53	usage.c
54
55SOURCES.h=\
56	../snmplib/impl.h\
57	../snmplib/error.h\
58	../snmplib/trace.h\
59	../snmplib/asn1.h\
60	../snmplib/snmp.h\
61	../snmplib/pdu.h \
62	./oid.h \
63	./usage.h
64
65OBJECTS= $(SOURCES.c:%.c=$(BIN)/%.o)
66
67MYLINKLIBS += $(LDLIBS) -L../snmplib -lssasnmp
68
69LIBS=	-lnsl
70
71CPPFLAGS += -I. -I../snmplib -I../../include/netmgt -I${BIN}
72
73CFLAGS += -c
74
75LINT=lint
76
77.KEEP_STATE:
78
79#######################################################
80
81#
82# all
83#
84
85FILEMODE = 0755
86
87PROG=$(BINPROG)
88
89CLOBBERFILES=$(AGENT)
90
91all: $(SOURCES.h) $(BINPROG)
92
93install: all $(OPTPROG)
94
95
96$(BINPROG): $(BIN) $(OBJECTS)
97	$(CC) -o $(BINPROG) $(LDFLAGS) $(OBJECTS) $(MYLINKLIBS) $(LIBS)
98	$(POST_PROCESS)
99
100$(BIN)/%.o: %.c
101	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $*.c -o $@
102	$(POST_PROCESS_O)
103
104
105#
106# lint
107#
108
109lint:
110	$(LINT) $(LDFLAGS) $(CPPFLAGS) $(DEFINES) $(SOURCES.c) $(MYLINKLIBS) $(LIBS)
111
112
113#
114# purify
115#
116
117purify:
118	$(PURIFY) $(CC) -o $(BINPROG) $(LDFLAGS) $(OBJECTS) $(MYLINKLIBS) $(LIBS)
119
120
121#
122# directories
123#
124
125$(BIN):
126	@$(TEST) -d $@ || mkdir $@
127
128
129#
130# clean
131#
132
133clean:
134	$(RM) $(OBJECTS)
135
136include $(SRC)/cmd/Makefile.targ
137