xref: /titanic_41/usr/src/cmd/mdb/Makefile.mdb (revision dc0093f44ee4fac928e006850f8ed53f68277af5)
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 += mdb.c \
32	mdb_addrvec.c \
33	mdb_argvec.c \
34	mdb_callb.c \
35	mdb_cmdbuf.c \
36	mdb_cmds.c \
37	mdb_conf.c \
38	mdb_context.c \
39	mdb_create.c \
40	mdb_ctf.c \
41	mdb_ctf_open.c \
42	mdb_debug.c \
43	mdb_demangle.c \
44	mdb_disasm.c \
45	mdb_dump.c \
46	mdb_err.c \
47	mdb_evset.c \
48	mdb_fdio.c \
49	mdb_fmt.c \
50	mdb_frame.c \
51	mdb_gelf.c \
52	mdb_help.c \
53	mdb_io.c \
54	mdb_kproc.c \
55	mdb_kvm.c \
56	mdb_logio.c \
57	mdb_list.c \
58	mdb_macalias.c \
59	mdb_main.c \
60	mdb_modapi.c \
61	mdb_module.c \
62	mdb_module_load.c \
63	mdb_nm.c \
64	mdb_nv.c \
65	mdb_pipeio.c \
66	mdb_print.c \
67	mdb_proc.c \
68	mdb_pservice.c \
69	mdb_rawfile.c \
70	mdb_set.c \
71	mdb_shell.c \
72	mdb_signal.c \
73	mdb_stdlib.c \
74	mdb_string.c \
75	mdb_strio.c \
76	mdb_target.c \
77	mdb_tdb.c \
78	mdb_termio.c \
79	mdb_umem.c \
80	mdb_value.c \
81	mdb_vcb.c \
82	mdb_wcb.c
83
84$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
85CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
86
87LDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm \
88	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
89
90LINTFLAGS += -n -errtags=yes
91LINTFILES = $(SRCS:%.c=%.ln)
92
93PROG = mdb
94OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
95
96LINK = adb
97ROOTLINK = $(ROOTBIN)/$(LINK)
98ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
99ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
100
101.NO_PARALLEL:
102.PARALLEL: $(OBJS) $(LINTFILES)
103
104all: $(PROG)
105
106$(PROG): $(OBJS)
107	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
108	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
109	$(POST_PROCESS)
110
111$(ROOTLINK32): $(ROOTPROG32)
112	$(RM) $@
113	$(LN) $(ROOTPROG32) $@
114
115$(ROOTLINK64): $(ROOTPROG64)
116	$(RM) $@
117	$(LN) $(ROOTPROG64) $@
118
119mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
120	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
121
122mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
123	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
124	@$(MV) y.tab.h mdb_grammar.h
125	@$(MV) y.tab.c mdb_grammar.c
126
127mdb_lex.o mdb_grammar.o := CCVERBOSE =
128
129mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
130
131inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
132
133%.o: ../../../common/mdb/%.c
134	$(COMPILE.c) $<
135	$(CTFCONVERT_O)
136
137%.o: ../../mdb/%.c
138	$(COMPILE.c) $<
139	$(CTFCONVERT_O)
140
141%.o: %.c
142	$(COMPILE.c) $<
143	$(CTFCONVERT_O)
144
145%.o: $(SRC)/common/net/util/%.c
146	$(COMPILE.c) $<
147	$(CTFCONVERT_O)
148
149clean.lint:
150	$(RM) $(LINTFILES)
151
152clean:
153	$(RM) $(OBJS)
154	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
155
156clobber: clean clean.lint
157	$(RM) $(PROG)
158
159%.ln: ../../../common/mdb/%.c
160	$(LINT.c) -c $<
161
162%.ln: ../../mdb/%.c
163	$(LINT.c) -c $<
164
165%.ln: %.c
166	$(LINT.c) -c $<
167
168%.ln: $(SRC)/common/net/util/%.c
169	$(LINT.c) -c $<
170
171lint: $(LINTFILES)
172	$(LINT) $(LINTFLAGS) $(LINTFILES)
173
174dmods:
175