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