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 parser
30#
31##############################################
32
33#
34# Makefile.vars
35#
36
37include ../../Makefile.vars
38
39include $(SRC)/cmd/Makefile.cmd
40
41TARGET=	mibcodegen
42
43# 
44OPTBIN = $(ROOT)/usr/bin
45OPTPROG = $(PROG:%=$(OPTBIN)/%)
46
47#
48# other variables
49#
50
51.KEEP_STATE:
52
53SOURCES.c=\
54	parse.c\
55	backend.c
56
57SOURCES.h=\
58	../snmplib/impl.h\
59	../snmplib/error.h\
60	../snmplib/asn1.h\
61	parse.h
62
63OBJECTS= $(SOURCES.c:%.c=$(BIN)/%.o)
64
65EXT = 1
66MYLIBS= ../snmplib/$(MACH)/libssasnmp.so.$(EXT)
67MYLINKLIBS += -L../snmplib -lssasnmp
68
69LIBS= -lsocket -lnsl
70
71DEFINES= -D$(TARG_SYS)
72
73CPPFLAGS += -I. -I../snmplib -I../../include/netmgt
74
75CFLAGS += -c 
76
77LDFLAGS += $(LDLIBS)
78
79LINT= lint
80
81MIB_HOME=	../mib
82
83MIBS=		$(MIB_HOME)/mib_core.txt $(MIB_HOME)/mib_example.txt
84
85LINTFLAGS= -aumx
86
87LINT=   lint
88
89CLOBBERFILES += $(TARGET)
90
91##############################################
92
93#
94# all
95#
96
97all: $(SOURCES.h) $(TARGET)
98
99install: all
100
101$(TARGET): $(BIN) $(OBJECTS) $(MYLIBS)
102	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(MYLINKLIBS) $(LIBS)
103
104$(BIN)/%.o: %.c
105	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $*.c -o $@
106
107#
108# lint
109#
110
111lint:
112	$(LINT) $(CPPFLAGS) $(DEFINES) $(SOURCES.c)
113
114lintlib: $(BIN) $(LINTTARGET)
115
116$(LINTTARGET) : $(LINTOBJECTS)
117	$(LINT) $(LINTOBJECTS) -o $(LIBNAME)
118	mv llib-l$(LIBNAME).ln $(LINTTARGET)
119
120$(BIN)/%.ln: %.c
121	$(LINT) $(CPPFLAGS) $(DEFINES) $*.c -C $(BIN)/$*
122
123#
124# example
125#
126
127example:
128	$(TARGET) example $(MIBS);
129
130
131#
132# directories
133#
134
135$(BIN):
136	@$(TEST) -d $@ || mkdir $@
137
138
139#
140# clean
141#
142
143clean:
144	$(RM) $(OBJECTS)
145
146include $(SRC)/cmd/Makefile.targ
147