xref: /titanic_51/usr/src/cmd/mdb/Makefile.mdb (revision 8a8d276f8934b606981d1c46b57c2eda30c67610)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28.KEEP_STATE:
29.SUFFIXES:
30
31SRCS += \
32	ffs.c \
33	mdb.c \
34	mdb_addrvec.c \
35	mdb_argvec.c \
36	mdb_callb.c \
37	mdb_cmdbuf.c \
38	mdb_cmds.c \
39	mdb_conf.c \
40	mdb_context.c \
41	mdb_create.c \
42	mdb_ctf.c \
43	mdb_ctf_open.c \
44	mdb_debug.c \
45	mdb_demangle.c \
46	mdb_disasm.c \
47	mdb_dump.c \
48	mdb_err.c \
49	mdb_evset.c \
50	mdb_fdio.c \
51	mdb_fmt.c \
52	mdb_frame.c \
53	mdb_gelf.c \
54	mdb_help.c \
55	mdb_io.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_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
89LDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm \
90	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
91
92LINTFLAGS += -n -errtags=yes
93LINTFILES = $(SRCS:%.c=%.ln)
94
95PROG = mdb
96OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
97
98LINK = adb
99ROOTLINK = $(ROOTBIN)/$(LINK)
100ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
101ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
102
103.NO_PARALLEL:
104.PARALLEL: $(OBJS) $(LINTFILES)
105
106all: $(PROG)
107
108$(PROG): $(OBJS)
109	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
110	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
111	$(POST_PROCESS)
112
113$(ROOTLINK32): $(ROOTPROG32)
114	$(RM) $@
115	$(LN) $(ROOTPROG32) $@
116
117$(ROOTLINK64): $(ROOTPROG64)
118	$(RM) $@
119	$(LN) $(ROOTPROG64) $@
120
121mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
122	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
123
124mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
125	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
126	@$(MV) y.tab.h mdb_grammar.h
127	@$(MV) y.tab.c mdb_grammar.c
128
129mdb_lex.o mdb_grammar.o := CCVERBOSE =
130
131mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
132
133inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
134
135ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
136
137%.o: ../../../common/mdb/%.c
138	$(COMPILE.c) $<
139	$(CTFCONVERT_O)
140
141%.o: ../../mdb/%.c
142	$(COMPILE.c) $<
143	$(CTFCONVERT_O)
144
145%.o: %.c
146	$(COMPILE.c) $<
147	$(CTFCONVERT_O)
148
149%.o: $(SRC)/common/net/util/%.c
150	$(COMPILE.c) $<
151	$(CTFCONVERT_O)
152
153%.o: $(SRC)/common/util/%.c
154	$(COMPILE.c) $<
155	$(CTFCONVERT_O)
156
157clean.lint:
158	$(RM) $(LINTFILES)
159
160clean:
161	$(RM) $(OBJS)
162	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
163
164clobber: clean clean.lint
165	$(RM) $(PROG)
166
167%.ln: ../../../common/mdb/%.c
168	$(LINT.c) -c $<
169
170%.ln: ../../mdb/%.c
171	$(LINT.c) -c $<
172
173%.ln: %.c
174	$(LINT.c) -c $<
175
176%.ln: $(SRC)/common/net/util/%.c
177	$(LINT.c) -c $<
178
179%.ln: $(SRC)/common/util/%.c
180	$(LINT.c) -c $<
181
182lint: $(LINTFILES)
183	$(LINT) $(LINTFLAGS) $(LINTFILES)
184
185dmods:
186