xref: /titanic_52/usr/src/cmd/mdb/Makefile.mdb (revision 84ab085a13f931bc78e7415e7ce921dbaa14fcb3)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29.KEEP_STATE:
30.SUFFIXES:
31
32SRCS += 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_kproc.c \
56	mdb_kvm.c \
57	mdb_logio.c \
58	mdb_list.c \
59	mdb_macalias.c \
60	mdb_main.c \
61	mdb_modapi.c \
62	mdb_module.c \
63	mdb_module_load.c \
64	mdb_nm.c \
65	mdb_nv.c \
66	mdb_pipeio.c \
67	mdb_print.c \
68	mdb_proc.c \
69	mdb_pservice.c \
70	mdb_rawfile.c \
71	mdb_set.c \
72	mdb_shell.c \
73	mdb_signal.c \
74	mdb_stdlib.c \
75	mdb_string.c \
76	mdb_strio.c \
77	mdb_target.c \
78	mdb_tdb.c \
79	mdb_termio.c \
80	mdb_umem.c \
81	mdb_value.c \
82	mdb_vcb.c \
83	mdb_wcb.c
84
85$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
86CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
87
88LDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem \
89	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
90
91#
92# Reset STRIPFLAG to the empty string.  MDB is intentionally installed
93# with a symbol table in order to help module developers.
94#
95STRIPFLAG =
96
97LINTFLAGS += -n -errtags=yes
98LINTFILES = $(SRCS:%.c=%.ln)
99
100PROG = mdb
101OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
102
103LINK = adb
104ROOTLINK = $(ROOTBIN)/$(LINK)
105ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
106ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
107
108.NO_PARALLEL:
109.PARALLEL: $(OBJS) $(LINTFILES)
110
111all: $(PROG)
112
113$(PROG): $(OBJS)
114	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
115	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
116	$(POST_PROCESS)
117
118$(ROOTLINK32): $(ROOTPROG32)
119	$(RM) $@
120	$(LN) $(ROOTPROG32) $@
121
122$(ROOTLINK64): $(ROOTPROG64)
123	$(RM) $@
124	$(LN) $(ROOTPROG64) $@
125
126mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
127	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
128
129mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
130	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
131	@$(MV) y.tab.h mdb_grammar.h
132	@$(MV) y.tab.c mdb_grammar.c
133
134mdb_lex.o mdb_grammar.o := CCVERBOSE =
135
136mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
137
138inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
139
140%.o: ../../../common/mdb/%.c
141	$(COMPILE.c) $<
142	$(CTFCONVERT_O)
143
144%.o: ../../mdb/%.c
145	$(COMPILE.c) $<
146	$(CTFCONVERT_O)
147
148%.o: %.c
149	$(COMPILE.c) $<
150	$(CTFCONVERT_O)
151
152%.o: $(SRC)/common/net/util/%.c
153	$(COMPILE.c) $<
154	$(CTFCONVERT_O)
155
156clean.lint:
157	$(RM) $(LINTFILES)
158
159clean:
160	$(RM) $(OBJS)
161	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
162
163clobber: clean clean.lint
164	$(RM) $(PROG)
165
166%.ln: ../../../common/mdb/%.c
167	$(LINT.c) -c $<
168
169%.ln: ../../mdb/%.c
170	$(LINT.c) -c $<
171
172%.ln: %.c
173	$(LINT.c) -c $<
174
175%.ln: $(SRC)/common/net/util/%.c
176	$(LINT.c) -c $<
177
178lint: $(LINTFILES)
179	$(LINT) $(LINTFLAGS) $(LINTFILES)
180
181dmods:
182