xref: /titanic_51/usr/src/cmd/mdb/Makefile.mdb (revision fb9f9b975cb9214fec5dab37d461199adab9b964)
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 2005 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
91LINTFLAGS += -n -errtags=yes
92LINTFILES = $(SRCS:%.c=%.ln)
93
94PROG = mdb
95OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
96
97LINK = adb
98ROOTLINK = $(ROOTBIN)/$(LINK)
99ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
100ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
101
102.NO_PARALLEL:
103.PARALLEL: $(OBJS) $(LINTFILES)
104
105all: $(PROG)
106
107$(PROG): $(OBJS)
108	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
109	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
110	$(POST_PROCESS)
111
112$(ROOTLINK32): $(ROOTPROG32)
113	$(RM) $@
114	$(LN) $(ROOTPROG32) $@
115
116$(ROOTLINK64): $(ROOTPROG64)
117	$(RM) $@
118	$(LN) $(ROOTPROG64) $@
119
120mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
121	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
122
123mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
124	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
125	@$(MV) y.tab.h mdb_grammar.h
126	@$(MV) y.tab.c mdb_grammar.c
127
128mdb_lex.o mdb_grammar.o := CCVERBOSE =
129
130mdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
131
132inet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
133
134%.o: ../../../common/mdb/%.c
135	$(COMPILE.c) $<
136	$(CTFCONVERT_O)
137
138%.o: ../../mdb/%.c
139	$(COMPILE.c) $<
140	$(CTFCONVERT_O)
141
142%.o: %.c
143	$(COMPILE.c) $<
144	$(CTFCONVERT_O)
145
146%.o: $(SRC)/common/net/util/%.c
147	$(COMPILE.c) $<
148	$(CTFCONVERT_O)
149
150clean.lint:
151	$(RM) $(LINTFILES)
152
153clean:
154	$(RM) $(OBJS)
155	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
156
157clobber: clean clean.lint
158	$(RM) $(PROG)
159
160%.ln: ../../../common/mdb/%.c
161	$(LINT.c) -c $<
162
163%.ln: ../../mdb/%.c
164	$(LINT.c) -c $<
165
166%.ln: %.c
167	$(LINT.c) -c $<
168
169%.ln: $(SRC)/common/net/util/%.c
170	$(LINT.c) -c $<
171
172lint: $(LINTFILES)
173	$(LINT) $(LINTFLAGS) $(LINTFILES)
174
175dmods:
176