xref: /titanic_44/usr/src/cmd/mdb/Makefile.mdb (revision 160abee025ef30c34521b981edd40ffcaab560aa)
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 2007 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 \
95	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
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
140ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
141
142%.o: ../../../common/mdb/%.c
143	$(COMPILE.c) $<
144	$(CTFCONVERT_O)
145
146%.o: ../../mdb/%.c
147	$(COMPILE.c) $<
148	$(CTFCONVERT_O)
149
150%.o: %.c
151	$(COMPILE.c) $<
152	$(CTFCONVERT_O)
153
154%.o: $(SRC)/common/net/util/%.c
155	$(COMPILE.c) $<
156	$(CTFCONVERT_O)
157
158%.o: $(SRC)/common/util/%.c
159	$(COMPILE.c) $<
160	$(CTFCONVERT_O)
161
162clean.lint:
163	$(RM) $(LINTFILES)
164
165clean:
166	$(RM) $(OBJS)
167	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
168
169clobber: clean clean.lint
170	$(RM) $(PROG)
171
172%.ln: ../../../common/mdb/%.c
173	$(LINT.c) -c $<
174
175%.ln: ../../mdb/%.c
176	$(LINT.c) -c $<
177
178%.ln: %.c
179	$(LINT.c) -c $<
180
181%.ln: $(SRC)/common/net/util/%.c
182	$(LINT.c) -c $<
183
184%.ln: $(SRC)/common/util/%.c
185	$(LINT.c) -c $<
186
187lint: $(LINTFILES)
188	$(LINT) $(LINTFLAGS) $(LINTFILES)
189
190dmods:
191