xref: /titanic_52/usr/src/cmd/mdb/Makefile.mdb (revision b60f2a0b921611326383e4789e0874e9e8a2e708)
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# 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_kb_kvm.c \
57	mdb_kproc.c \
58	mdb_kvm.c \
59	mdb_logio.c \
60	mdb_list.c \
61	mdb_macalias.c \
62	mdb_main.c \
63	mdb_memio.c \
64	mdb_modapi.c \
65	mdb_module.c \
66	mdb_module_load.c \
67	mdb_nm.c \
68	mdb_nv.c \
69	mdb_pipeio.c \
70	mdb_print.c \
71	mdb_proc.c \
72	mdb_pservice.c \
73	mdb_rawfile.c \
74	mdb_set.c \
75	mdb_shell.c \
76	mdb_signal.c \
77	mdb_stdlib.c \
78	mdb_string.c \
79	mdb_strio.c \
80	mdb_target.c \
81	mdb_tdb.c \
82	mdb_termio.c \
83	mdb_umem.c \
84	mdb_value.c \
85	mdb_vcb.c \
86	mdb_wcb.c
87
88$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
89CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
90
91C99MODE=	-xc99=%all
92C99LMODE=	-Xc99=%all
93
94LDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
95
96LINTFLAGS += -n -errtags=yes
97LINTFILES = $(SRCS:%.c=%.ln)
98
99PROG = mdb
100OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
101
102LINK = adb
103ROOTLINK = $(ROOTBIN)/$(LINK)
104ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
105ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
106
107.NO_PARALLEL:
108.PARALLEL: $(OBJS) $(LINTFILES)
109
110all: $(PROG)
111
112$(PROG): $(OBJS)
113	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
114	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
115	$(POST_PROCESS)
116
117$(ROOTLINK32): $(ROOTPROG32)
118	$(RM) $@
119	$(LN) $(ROOTPROG32) $@
120
121$(ROOTLINK64): $(ROOTPROG64)
122	$(RM) $@
123	$(LN) $(ROOTPROG64) $@
124
125mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
126	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
127
128mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
129	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
130	@$(MV) y.tab.h mdb_grammar.h
131	@$(MV) y.tab.c mdb_grammar.c
132
133mdb_lex.o mdb_grammar.o := CCVERBOSE =
134
135mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
136
137inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
138
139ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
140
141%.o: ../../../common/mdb/%.c
142	$(COMPILE.c) $<
143	$(CTFCONVERT_O)
144
145%.o: ../../mdb/%.c
146	$(COMPILE.c) $<
147	$(CTFCONVERT_O)
148
149%.o: %.c
150	$(COMPILE.c) $<
151	$(CTFCONVERT_O)
152
153%.o: $(SRC)/common/net/util/%.c
154	$(COMPILE.c) $<
155	$(CTFCONVERT_O)
156
157%.o: $(SRC)/common/util/%.c
158	$(COMPILE.c) $<
159	$(CTFCONVERT_O)
160
161clean.lint:
162	$(RM) $(LINTFILES)
163
164clean:
165	$(RM) $(OBJS)
166	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
167
168clobber: clean clean.lint
169	$(RM) $(PROG)
170
171%.ln: ../../../common/mdb/%.c
172	$(LINT.c) -c $<
173
174%.ln: ../../mdb/%.c
175	$(LINT.c) -c $<
176
177%.ln: %.c
178	$(LINT.c) -c $<
179
180%.ln: $(SRC)/common/net/util/%.c
181	$(LINT.c) -c $<
182
183%.ln: $(SRC)/common/util/%.c
184	$(LINT.c) -c $<
185
186lint: $(LINTFILES)
187	$(LINT) $(LINTFLAGS) $(LINTFILES)
188
189dmods:
190