xref: /titanic_41/usr/src/cmd/mdb/Makefile.mdb (revision edafac1f8203a7de1490688213c118b03215c89d)
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.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	mdb_whatis.c
86
87$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
88CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
89
90C99MODE=	-xc99=%all
91C99LMODE=	-Xc99=%all
92
93LDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
94
95#
96# -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused
97# about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and
98# mdb_tgt_stack_iter_f(). Will be resolved as part of fix for CR 6749868.
99#
100LINTFLAGS += -n -errtags=yes -erroff=E_INCONS_ARG_DECL2
101LINTFILES = $(SRCS:%.c=%.ln)
102
103PROG = mdb
104OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
105
106LINK = adb
107ROOTLINK = $(ROOTBIN)/$(LINK)
108ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
109ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
110
111.NO_PARALLEL:
112.PARALLEL: $(OBJS) $(LINTFILES)
113
114all: $(PROG)
115
116$(PROG): $(OBJS)
117	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
118	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
119	$(POST_PROCESS)
120
121$(ROOTLINK32): $(ROOTPROG32)
122	$(RM) $@
123	$(LN) $(ROOTPROG32) $@
124
125$(ROOTLINK64): $(ROOTPROG64)
126	$(RM) $@
127	$(LN) $(ROOTPROG64) $@
128
129mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
130	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
131
132mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
133	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
134	@$(MV) y.tab.h mdb_grammar.h
135	@$(MV) y.tab.c mdb_grammar.c
136
137mdb_lex.o mdb_grammar.o := CCVERBOSE =
138
139mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
140
141inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
142
143ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
144
145%.o: ../../../common/mdb/%.c
146	$(COMPILE.c) $<
147	$(CTFCONVERT_O)
148
149%.o: ../../mdb/%.c
150	$(COMPILE.c) $<
151	$(CTFCONVERT_O)
152
153%.o: %.c
154	$(COMPILE.c) $<
155	$(CTFCONVERT_O)
156
157%.o: $(SRC)/common/net/util/%.c
158	$(COMPILE.c) $<
159	$(CTFCONVERT_O)
160
161%.o: $(SRC)/common/util/%.c
162	$(COMPILE.c) $<
163	$(CTFCONVERT_O)
164
165clean.lint:
166	$(RM) $(LINTFILES)
167
168clean:
169	$(RM) $(OBJS)
170	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
171
172clobber: clean clean.lint
173	$(RM) $(PROG)
174
175%.ln: ../../../common/mdb/%.c
176	$(LINT.c) -c $<
177
178%.ln: ../../mdb/%.c
179	$(LINT.c) -c $<
180
181%.ln: %.c
182	$(LINT.c) -c $<
183
184%.ln: $(SRC)/common/net/util/%.c
185	$(LINT.c) -c $<
186
187%.ln: $(SRC)/common/util/%.c
188	$(LINT.c) -c $<
189
190lint: $(LINTFILES)
191	$(LINT) $(LINTFLAGS) $(LINTFILES)
192
193dmods:
194