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