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