stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 1 | # |
| 2 | # CDDL HEADER START |
| 3 | # |
| 4 | # The contents of this file are subject to the terms of the |
eschrock | dc0093f | 2006-03-03 22:38:03 -0800 | [diff] [blame] | 5 | # Common Development and Distribution License (the "License"). |
| 6 | # You may not use this file except in compliance with the License. |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 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 | # |
Jonathan Adams | 4a1c243 | 2009-09-22 13:42:17 -0700 | [diff] [blame] | 22 | # Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 23 | # Use is subject to license terms. |
| 24 | # |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 25 | |
Matt Amdur | 3b6e0a5 | 2012-05-11 22:38:13 -0400 | [diff] [blame] | 26 | # |
| 27 | # Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
| 28 | # Copyright (c) 2012 by Delphix. All rights reserved. |
| 29 | # Copyright (c) 2012 Joyent, Inc. All rights reserved. |
Jason King | 4226f63 | 2017-05-27 18:46:17 -0500 | [diff] [blame^] | 30 | # Copyright 2018 Jason King |
Matt Amdur | 3b6e0a5 | 2012-05-11 22:38:13 -0400 | [diff] [blame] | 31 | # |
| 32 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 33 | .KEEP_STATE: |
| 34 | .SUFFIXES: |
| 35 | |
carlsonj | 69bb4bb | 2006-08-14 14:10:48 -0700 | [diff] [blame] | 36 | SRCS += \ |
| 37 | ffs.c \ |
| 38 | mdb.c \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 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 \ |
johnlev | 843e198 | 2007-09-18 15:46:43 -0700 | [diff] [blame] | 61 | mdb_kb_kvm.c \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 62 | mdb_kproc.c \ |
| 63 | mdb_kvm.c \ |
| 64 | mdb_logio.c \ |
| 65 | mdb_list.c \ |
| 66 | mdb_macalias.c \ |
| 67 | mdb_main.c \ |
johnlev | 843e198 | 2007-09-18 15:46:43 -0700 | [diff] [blame] | 68 | mdb_memio.c \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 69 | mdb_modapi.c \ |
| 70 | mdb_module.c \ |
| 71 | mdb_module_load.c \ |
| 72 | mdb_nm.c \ |
| 73 | mdb_nv.c \ |
| 74 | mdb_pipeio.c \ |
| 75 | mdb_print.c \ |
| 76 | mdb_proc.c \ |
| 77 | mdb_pservice.c \ |
| 78 | mdb_rawfile.c \ |
| 79 | mdb_set.c \ |
| 80 | mdb_shell.c \ |
| 81 | mdb_signal.c \ |
| 82 | mdb_stdlib.c \ |
| 83 | mdb_string.c \ |
| 84 | mdb_strio.c \ |
Matt Amdur | 3b6e0a5 | 2012-05-11 22:38:13 -0400 | [diff] [blame] | 85 | mdb_tab.c \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 86 | mdb_target.c \ |
| 87 | mdb_tdb.c \ |
| 88 | mdb_termio.c \ |
Robert Mustacchi | 0a47c91 | 2013-04-03 15:25:37 -0700 | [diff] [blame] | 89 | mdb_typedef.c \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 90 | mdb_umem.c \ |
| 91 | mdb_value.c \ |
| 92 | mdb_vcb.c \ |
Jonathan Adams | 4a1c243 | 2009-09-22 13:42:17 -0700 | [diff] [blame] | 93 | mdb_wcb.c \ |
| 94 | mdb_whatis.c |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 95 | |
| 96 | $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG |
| 97 | CPPFLAGS += -D_MDB -I. -I../.. -I../../../common |
| 98 | |
Yuri Pankov | bd0ce62 | 2018-02-05 08:52:36 +0300 | [diff] [blame] | 99 | CSTD= $(CSTD_GNU99) |
johnlev | 843e198 | 2007-09-18 15:46:43 -0700 | [diff] [blame] | 100 | C99LMODE= -Xc99=%all |
| 101 | |
Gordon Ross | 7c1d354 | 2011-07-15 10:20:38 -0400 | [diff] [blame] | 102 | LDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf |
Jason King | 4226f63 | 2017-05-27 18:46:17 -0500 | [diff] [blame^] | 103 | LDLIBS += -ldemangle-sys |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 104 | |
Richard Lowe | 7014882 | 2012-07-22 16:03:46 -0400 | [diff] [blame] | 105 | CERRWARN += -_gcc=-Wno-uninitialized |
| 106 | CERRWARN += -_gcc=-Wno-char-subscripts |
| 107 | CERRWARN += -_gcc=-Wno-clobbered |
| 108 | CERRWARN += -_gcc=-Wno-parentheses |
| 109 | CERRWARN += -_gcc=-Wno-unused-label |
| 110 | CERRWARN += -_gcc=-Wno-unused-variable |
| 111 | |
Nick Todd | 8793b36 | 2008-09-18 20:50:09 +0100 | [diff] [blame] | 112 | # |
| 113 | # -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused |
| 114 | # about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and |
| 115 | # mdb_tgt_stack_iter_f(). Will be resolved as part of fix for CR 6749868. |
| 116 | # |
| 117 | LINTFLAGS += -n -errtags=yes -erroff=E_INCONS_ARG_DECL2 |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 118 | LINTFILES = $(SRCS:%.c=%.ln) |
| 119 | |
| 120 | PROG = mdb |
| 121 | OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o |
| 122 | |
| 123 | LINK = adb |
| 124 | ROOTLINK = $(ROOTBIN)/$(LINK) |
| 125 | ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%) |
| 126 | ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%) |
| 127 | |
| 128 | .NO_PARALLEL: |
| 129 | .PARALLEL: $(OBJS) $(LINTFILES) |
| 130 | |
| 131 | all: $(PROG) |
| 132 | |
| 133 | $(PROG): $(OBJS) |
| 134 | $(LINK.c) $(OBJS) -o $@ $(LDLIBS) |
| 135 | $(CTFMERGE) -L VERSION -o $@ $(OBJS) |
| 136 | $(POST_PROCESS) |
| 137 | |
| 138 | $(ROOTLINK32): $(ROOTPROG32) |
| 139 | $(RM) $@ |
| 140 | $(LN) $(ROOTPROG32) $@ |
| 141 | |
| 142 | $(ROOTLINK64): $(ROOTPROG64) |
| 143 | $(RM) $@ |
| 144 | $(LN) $(ROOTPROG64) $@ |
| 145 | |
| 146 | mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h |
| 147 | $(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@ |
| 148 | |
| 149 | mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y |
| 150 | $(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y |
| 151 | @$(MV) y.tab.h mdb_grammar.h |
| 152 | @$(MV) y.tab.c mdb_grammar.c |
| 153 | |
| 154 | mdb_lex.o mdb_grammar.o := CCVERBOSE = |
| 155 | |
| 156 | mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)' |
| 157 | |
| 158 | inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf |
| 159 | |
carlsonj | 69bb4bb | 2006-08-14 14:10:48 -0700 | [diff] [blame] | 160 | ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs |
| 161 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 162 | %.o: ../../../common/mdb/%.c |
| 163 | $(COMPILE.c) $< |
| 164 | $(CTFCONVERT_O) |
| 165 | |
| 166 | %.o: ../../mdb/%.c |
| 167 | $(COMPILE.c) $< |
| 168 | $(CTFCONVERT_O) |
| 169 | |
| 170 | %.o: %.c |
| 171 | $(COMPILE.c) $< |
| 172 | $(CTFCONVERT_O) |
| 173 | |
| 174 | %.o: $(SRC)/common/net/util/%.c |
| 175 | $(COMPILE.c) $< |
| 176 | $(CTFCONVERT_O) |
| 177 | |
carlsonj | 69bb4bb | 2006-08-14 14:10:48 -0700 | [diff] [blame] | 178 | %.o: $(SRC)/common/util/%.c |
| 179 | $(COMPILE.c) $< |
| 180 | $(CTFCONVERT_O) |
| 181 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 182 | clean.lint: |
| 183 | $(RM) $(LINTFILES) |
| 184 | |
| 185 | clean: |
| 186 | $(RM) $(OBJS) |
| 187 | $(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output |
| 188 | |
| 189 | clobber: clean clean.lint |
| 190 | $(RM) $(PROG) |
| 191 | |
| 192 | %.ln: ../../../common/mdb/%.c |
| 193 | $(LINT.c) -c $< |
| 194 | |
| 195 | %.ln: ../../mdb/%.c |
| 196 | $(LINT.c) -c $< |
| 197 | |
| 198 | %.ln: %.c |
| 199 | $(LINT.c) -c $< |
| 200 | |
| 201 | %.ln: $(SRC)/common/net/util/%.c |
| 202 | $(LINT.c) -c $< |
| 203 | |
carlsonj | 69bb4bb | 2006-08-14 14:10:48 -0700 | [diff] [blame] | 204 | %.ln: $(SRC)/common/util/%.c |
| 205 | $(LINT.c) -c $< |
| 206 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 207 | lint: $(LINTFILES) |
| 208 | $(LINT) $(LINTFLAGS) $(LINTFILES) |
| 209 | |
| 210 | dmods: |