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