xref: /titanic_41/usr/src/cmd/mdb/Makefile.mdb (revision d583b39bfb4e2571d3e41097c5c357ffe353ad45)
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 (c) 2012 Joyent, Inc. All rights reserved.
30#
31
32.KEEP_STATE:
33.SUFFIXES:
34
35SRCS += \
36	ffs.c \
37	mdb.c \
38	mdb_addrvec.c \
39	mdb_argvec.c \
40	mdb_callb.c \
41	mdb_cmdbuf.c \
42	mdb_cmds.c \
43	mdb_conf.c \
44	mdb_context.c \
45	mdb_create.c \
46	mdb_ctf.c \
47	mdb_ctf_open.c \
48	mdb_debug.c \
49	mdb_demangle.c \
50	mdb_disasm.c \
51	mdb_dump.c \
52	mdb_err.c \
53	mdb_evset.c \
54	mdb_fdio.c \
55	mdb_fmt.c \
56	mdb_frame.c \
57	mdb_gelf.c \
58	mdb_help.c \
59	mdb_io.c \
60	mdb_kb_kvm.c \
61	mdb_kproc.c \
62	mdb_kvm.c \
63	mdb_logio.c \
64	mdb_list.c \
65	mdb_macalias.c \
66	mdb_main.c \
67	mdb_memio.c \
68	mdb_modapi.c \
69	mdb_module.c \
70	mdb_module_load.c \
71	mdb_nm.c \
72	mdb_nv.c \
73	mdb_pipeio.c \
74	mdb_print.c \
75	mdb_proc.c \
76	mdb_pservice.c \
77	mdb_rawfile.c \
78	mdb_set.c \
79	mdb_shell.c \
80	mdb_signal.c \
81	mdb_stdlib.c \
82	mdb_string.c \
83	mdb_strio.c \
84	mdb_tab.c \
85	mdb_target.c \
86	mdb_tdb.c \
87	mdb_termio.c \
88	mdb_umem.c \
89	mdb_value.c \
90	mdb_vcb.c \
91	mdb_wcb.c \
92	mdb_whatis.c
93
94$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
95CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
96
97C99MODE=	-xc99=%all
98C99LMODE=	-Xc99=%all
99
100LDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
101
102CERRWARN += -_gcc=-Wno-uninitialized
103CERRWARN += -_gcc=-Wno-char-subscripts
104CERRWARN += -_gcc=-Wno-clobbered
105CERRWARN += -_gcc=-Wno-parentheses
106CERRWARN += -_gcc=-Wno-unused-label
107CERRWARN += -_gcc=-Wno-unused-variable
108
109#
110# -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused
111# about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and
112# mdb_tgt_stack_iter_f(). Will be resolved as part of fix for CR 6749868.
113#
114LINTFLAGS += -n -errtags=yes -erroff=E_INCONS_ARG_DECL2
115LINTFILES = $(SRCS:%.c=%.ln)
116
117PROG = mdb
118OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
119
120LINK = adb
121ROOTLINK = $(ROOTBIN)/$(LINK)
122ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
123ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
124
125.NO_PARALLEL:
126.PARALLEL: $(OBJS) $(LINTFILES)
127
128all: $(PROG)
129
130$(PROG): $(OBJS)
131	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
132	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
133	$(POST_PROCESS)
134
135$(ROOTLINK32): $(ROOTPROG32)
136	$(RM) $@
137	$(LN) $(ROOTPROG32) $@
138
139$(ROOTLINK64): $(ROOTPROG64)
140	$(RM) $@
141	$(LN) $(ROOTPROG64) $@
142
143mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
144	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
145
146mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
147	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
148	@$(MV) y.tab.h mdb_grammar.h
149	@$(MV) y.tab.c mdb_grammar.c
150
151mdb_lex.o mdb_grammar.o := CCVERBOSE =
152
153mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
154
155inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
156
157ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
158
159%.o: ../../../common/mdb/%.c
160	$(COMPILE.c) $<
161	$(CTFCONVERT_O)
162
163%.o: ../../mdb/%.c
164	$(COMPILE.c) $<
165	$(CTFCONVERT_O)
166
167%.o: %.c
168	$(COMPILE.c) $<
169	$(CTFCONVERT_O)
170
171%.o: $(SRC)/common/net/util/%.c
172	$(COMPILE.c) $<
173	$(CTFCONVERT_O)
174
175%.o: $(SRC)/common/util/%.c
176	$(COMPILE.c) $<
177	$(CTFCONVERT_O)
178
179clean.lint:
180	$(RM) $(LINTFILES)
181
182clean:
183	$(RM) $(OBJS)
184	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
185
186clobber: clean clean.lint
187	$(RM) $(PROG)
188
189%.ln: ../../../common/mdb/%.c
190	$(LINT.c) -c $<
191
192%.ln: ../../mdb/%.c
193	$(LINT.c) -c $<
194
195%.ln: %.c
196	$(LINT.c) -c $<
197
198%.ln: $(SRC)/common/net/util/%.c
199	$(LINT.c) -c $<
200
201%.ln: $(SRC)/common/util/%.c
202	$(LINT.c) -c $<
203
204lint: $(LINTFILES)
205	$(LINT) $(LINTFLAGS) $(LINTFILES)
206
207dmods:
208