xref: /illumos-gate/usr/src/cmd/mdb/Makefile.mdb (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate#
2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate#
4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate# with the License.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate# and limitations under the License.
13*7c478bd9Sstevel@tonic-gate#
14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate#
26*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gate.KEEP_STATE:
30*7c478bd9Sstevel@tonic-gate.SUFFIXES:
31*7c478bd9Sstevel@tonic-gate
32*7c478bd9Sstevel@tonic-gateSRCS += mdb.c \
33*7c478bd9Sstevel@tonic-gate	mdb_addrvec.c \
34*7c478bd9Sstevel@tonic-gate	mdb_argvec.c \
35*7c478bd9Sstevel@tonic-gate	mdb_callb.c \
36*7c478bd9Sstevel@tonic-gate	mdb_cmdbuf.c \
37*7c478bd9Sstevel@tonic-gate	mdb_cmds.c \
38*7c478bd9Sstevel@tonic-gate	mdb_conf.c \
39*7c478bd9Sstevel@tonic-gate	mdb_context.c \
40*7c478bd9Sstevel@tonic-gate	mdb_create.c \
41*7c478bd9Sstevel@tonic-gate	mdb_ctf.c \
42*7c478bd9Sstevel@tonic-gate	mdb_ctf_open.c \
43*7c478bd9Sstevel@tonic-gate	mdb_debug.c \
44*7c478bd9Sstevel@tonic-gate	mdb_demangle.c \
45*7c478bd9Sstevel@tonic-gate	mdb_disasm.c \
46*7c478bd9Sstevel@tonic-gate	mdb_dump.c \
47*7c478bd9Sstevel@tonic-gate	mdb_err.c \
48*7c478bd9Sstevel@tonic-gate	mdb_evset.c \
49*7c478bd9Sstevel@tonic-gate	mdb_fdio.c \
50*7c478bd9Sstevel@tonic-gate	mdb_fmt.c \
51*7c478bd9Sstevel@tonic-gate	mdb_frame.c \
52*7c478bd9Sstevel@tonic-gate	mdb_gelf.c \
53*7c478bd9Sstevel@tonic-gate	mdb_help.c \
54*7c478bd9Sstevel@tonic-gate	mdb_io.c \
55*7c478bd9Sstevel@tonic-gate	mdb_kproc.c \
56*7c478bd9Sstevel@tonic-gate	mdb_kvm.c \
57*7c478bd9Sstevel@tonic-gate	mdb_logio.c \
58*7c478bd9Sstevel@tonic-gate	mdb_list.c \
59*7c478bd9Sstevel@tonic-gate	mdb_macalias.c \
60*7c478bd9Sstevel@tonic-gate	mdb_main.c \
61*7c478bd9Sstevel@tonic-gate	mdb_modapi.c \
62*7c478bd9Sstevel@tonic-gate	mdb_module.c \
63*7c478bd9Sstevel@tonic-gate	mdb_module_load.c \
64*7c478bd9Sstevel@tonic-gate	mdb_nm.c \
65*7c478bd9Sstevel@tonic-gate	mdb_nv.c \
66*7c478bd9Sstevel@tonic-gate	mdb_pipeio.c \
67*7c478bd9Sstevel@tonic-gate	mdb_print.c \
68*7c478bd9Sstevel@tonic-gate	mdb_proc.c \
69*7c478bd9Sstevel@tonic-gate	mdb_pservice.c \
70*7c478bd9Sstevel@tonic-gate	mdb_rawfile.c \
71*7c478bd9Sstevel@tonic-gate	mdb_set.c \
72*7c478bd9Sstevel@tonic-gate	mdb_shell.c \
73*7c478bd9Sstevel@tonic-gate	mdb_signal.c \
74*7c478bd9Sstevel@tonic-gate	mdb_stdlib.c \
75*7c478bd9Sstevel@tonic-gate	mdb_string.c \
76*7c478bd9Sstevel@tonic-gate	mdb_strio.c \
77*7c478bd9Sstevel@tonic-gate	mdb_target.c \
78*7c478bd9Sstevel@tonic-gate	mdb_tdb.c \
79*7c478bd9Sstevel@tonic-gate	mdb_termio.c \
80*7c478bd9Sstevel@tonic-gate	mdb_umem.c \
81*7c478bd9Sstevel@tonic-gate	mdb_value.c \
82*7c478bd9Sstevel@tonic-gate	mdb_vcb.c \
83*7c478bd9Sstevel@tonic-gate	mdb_wcb.c
84*7c478bd9Sstevel@tonic-gate
85*7c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
86*7c478bd9Sstevel@tonic-gateCPPFLAGS += -D_MDB -I. -I../.. -I../../../common
87*7c478bd9Sstevel@tonic-gate
88*7c478bd9Sstevel@tonic-gateLDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem \
89*7c478bd9Sstevel@tonic-gate	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
90*7c478bd9Sstevel@tonic-gate
91*7c478bd9Sstevel@tonic-gate#
92*7c478bd9Sstevel@tonic-gate# Reset STRIPFLAG to the empty string.  MDB is intentionally installed
93*7c478bd9Sstevel@tonic-gate# with a symbol table in order to help module developers.
94*7c478bd9Sstevel@tonic-gate#
95*7c478bd9Sstevel@tonic-gateSTRIPFLAG =
96*7c478bd9Sstevel@tonic-gate
97*7c478bd9Sstevel@tonic-gateLINTFLAGS += -n -errtags=yes
98*7c478bd9Sstevel@tonic-gateLINTFILES = $(SRCS:%.c=%.ln)
99*7c478bd9Sstevel@tonic-gate
100*7c478bd9Sstevel@tonic-gatePROG = mdb
101*7c478bd9Sstevel@tonic-gateOBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
102*7c478bd9Sstevel@tonic-gate
103*7c478bd9Sstevel@tonic-gateLINK = adb
104*7c478bd9Sstevel@tonic-gateROOTLINK = $(ROOTBIN)/$(LINK)
105*7c478bd9Sstevel@tonic-gateROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
106*7c478bd9Sstevel@tonic-gateROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
107*7c478bd9Sstevel@tonic-gate
108*7c478bd9Sstevel@tonic-gate.NO_PARALLEL:
109*7c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LINTFILES)
110*7c478bd9Sstevel@tonic-gate
111*7c478bd9Sstevel@tonic-gateall: $(PROG)
112*7c478bd9Sstevel@tonic-gate
113*7c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
114*7c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
115*7c478bd9Sstevel@tonic-gate	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
116*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
117*7c478bd9Sstevel@tonic-gate
118*7c478bd9Sstevel@tonic-gate$(ROOTLINK32): $(ROOTPROG32)
119*7c478bd9Sstevel@tonic-gate	$(RM) $@
120*7c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG32) $@
121*7c478bd9Sstevel@tonic-gate
122*7c478bd9Sstevel@tonic-gate$(ROOTLINK64): $(ROOTPROG64)
123*7c478bd9Sstevel@tonic-gate	$(RM) $@
124*7c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG64) $@
125*7c478bd9Sstevel@tonic-gate
126*7c478bd9Sstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
127*7c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
128*7c478bd9Sstevel@tonic-gate
129*7c478bd9Sstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
130*7c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
131*7c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
132*7c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
133*7c478bd9Sstevel@tonic-gate
134*7c478bd9Sstevel@tonic-gatemdb_lex.o mdb_grammar.o := CCVERBOSE =
135*7c478bd9Sstevel@tonic-gate
136*7c478bd9Sstevel@tonic-gatemdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
137*7c478bd9Sstevel@tonic-gate
138*7c478bd9Sstevel@tonic-gateinet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
139*7c478bd9Sstevel@tonic-gate
140*7c478bd9Sstevel@tonic-gate%.o: ../../../common/mdb/%.c
141*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
142*7c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
143*7c478bd9Sstevel@tonic-gate
144*7c478bd9Sstevel@tonic-gate%.o: ../../mdb/%.c
145*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
146*7c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
147*7c478bd9Sstevel@tonic-gate
148*7c478bd9Sstevel@tonic-gate%.o: %.c
149*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
150*7c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
151*7c478bd9Sstevel@tonic-gate
152*7c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
153*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
154*7c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
155*7c478bd9Sstevel@tonic-gate
156*7c478bd9Sstevel@tonic-gateclean.lint:
157*7c478bd9Sstevel@tonic-gate	$(RM) $(LINTFILES)
158*7c478bd9Sstevel@tonic-gate
159*7c478bd9Sstevel@tonic-gateclean:
160*7c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
161*7c478bd9Sstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
162*7c478bd9Sstevel@tonic-gate
163*7c478bd9Sstevel@tonic-gateclobber: clean clean.lint
164*7c478bd9Sstevel@tonic-gate	$(RM) $(PROG)
165*7c478bd9Sstevel@tonic-gate
166*7c478bd9Sstevel@tonic-gate%.ln: ../../../common/mdb/%.c
167*7c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
168*7c478bd9Sstevel@tonic-gate
169*7c478bd9Sstevel@tonic-gate%.ln: ../../mdb/%.c
170*7c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
171*7c478bd9Sstevel@tonic-gate
172*7c478bd9Sstevel@tonic-gate%.ln: %.c
173*7c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
174*7c478bd9Sstevel@tonic-gate
175*7c478bd9Sstevel@tonic-gate%.ln: $(SRC)/common/net/util/%.c
176*7c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
177*7c478bd9Sstevel@tonic-gate
178*7c478bd9Sstevel@tonic-gatelint: $(LINTFILES)
179*7c478bd9Sstevel@tonic-gate	$(LINT) $(LINTFLAGS) $(LINTFILES)
180*7c478bd9Sstevel@tonic-gate
181*7c478bd9Sstevel@tonic-gatedmods:
182