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# 27# Copyright 2011 Nexenta Systems, Inc. All rights reserved. 28# Copyright (c) 2012 by Delphix. All rights reserved. 29# Copyright 2021 Joyent, Inc. 30# Copyright 2018 Jason King 31# 32 33.KEEP_STATE: 34.SUFFIXES: 35 36SRCS += \ 37 ffs.c \ 38 mdb.c \ 39 mdb_addrvec.c \ 40 mdb_argvec.c \ 41 mdb_callb.c \ 42 mdb_cmdbuf.c \ 43 mdb_cmds.c \ 44 mdb_conf.c \ 45 mdb_context.c \ 46 mdb_create.c \ 47 mdb_ctf.c \ 48 mdb_ctf_open.c \ 49 mdb_debug.c \ 50 mdb_demangle.c \ 51 mdb_disasm.c \ 52 mdb_dump.c \ 53 mdb_err.c \ 54 mdb_evset.c \ 55 mdb_fdio.c \ 56 mdb_fmt.c \ 57 mdb_frame.c \ 58 mdb_gelf.c \ 59 mdb_help.c \ 60 mdb_io.c \ 61 mdb_kb_kvm.c \ 62 mdb_kproc.c \ 63 mdb_kvm.c \ 64 mdb_linkerset.c \ 65 mdb_logio.c \ 66 mdb_list.c \ 67 mdb_macalias.c \ 68 mdb_main.c \ 69 mdb_memio.c \ 70 mdb_modapi.c \ 71 mdb_module.c \ 72 mdb_module_load.c \ 73 mdb_nm.c \ 74 mdb_nv.c \ 75 mdb_pipeio.c \ 76 mdb_print.c \ 77 mdb_proc.c \ 78 mdb_pservice.c \ 79 mdb_rawfile.c \ 80 mdb_set.c \ 81 mdb_shell.c \ 82 mdb_signal.c \ 83 mdb_stdlib.c \ 84 mdb_string.c \ 85 mdb_strio.c \ 86 mdb_tab.c \ 87 mdb_target.c \ 88 mdb_tdb.c \ 89 mdb_termio.c \ 90 mdb_typedef.c \ 91 mdb_umem.c \ 92 mdb_value.c \ 93 mdb_vcb.c \ 94 mdb_walkers.c \ 95 mdb_wcb.c \ 96 mdb_whatis.c 97 98$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG 99CPPFLAGS += -D_MDB -I. -I../.. -I../../../common 100 101CSTD= $(CSTD_GNU99) 102 103LDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf 104LDLIBS += -ldemangle-sys 105 106CERRWARN += $(CNOWARN_UNINIT) 107CERRWARN += -_gcc=-Wno-char-subscripts 108CERRWARN += -_gcc=-Wno-clobbered 109CERRWARN += -_gcc=-Wno-parentheses 110CERRWARN += -_gcc=-Wno-unused-label 111CERRWARN += -_gcc=-Wno-unused-variable 112 113PROG = mdb 114OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o 115 116LINK = adb 117ROOTLINK = $(ROOTBIN)/$(LINK) 118ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%) 119ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%) 120 121.NO_PARALLEL: 122.PARALLEL: $(OBJS) 123 124all: $(PROG) 125 126$(PROG): $(OBJS) 127 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 128 $(CTFMERGE) -L VERSION -o $@ $(OBJS) 129 $(POST_PROCESS) 130 131$(ROOTLINK32): $(ROOTPROG32) 132 $(RM) $@ 133 $(LN) $(ROOTPROG32) $@ 134 135$(ROOTLINK64): $(ROOTPROG64) 136 $(RM) $@ 137 $(LN) $(ROOTPROG64) $@ 138 139mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h 140 $(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@ 141 142mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y 143 $(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y 144 @$(MV) y.tab.h mdb_grammar.h 145 @$(MV) y.tab.c mdb_grammar.c 146 147mdb_lex.o mdb_grammar.o := CCVERBOSE = 148 149mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)' 150 151inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf 152 153ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs 154 155%.o: ../../../common/mdb/%.c 156 $(COMPILE.c) $< 157 $(CTFCONVERT_O) 158 159%.o: ../../mdb/%.c 160 $(COMPILE.c) $< 161 $(CTFCONVERT_O) 162 163%.o: %.c 164 $(COMPILE.c) $< 165 $(CTFCONVERT_O) 166 167%.o: $(SRC)/common/net/util/%.c 168 $(COMPILE.c) $< 169 $(CTFCONVERT_O) 170 171%.o: $(SRC)/common/util/%.c 172 $(COMPILE.c) $< 173 $(CTFCONVERT_O) 174 175clean: 176 $(RM) $(OBJS) 177 $(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output 178 179clobber: clean 180 $(RM) $(PROG) 181 182dmods: 183