xref: /titanic_41/usr/src/cmd/mdb/Makefile.mdb (revision 8793b36b40d14ad0a0fecc97738dc118a928f46c)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5dc0093f4Seschrock# Common Development and Distribution License (the "License").
6dc0093f4Seschrock# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2267e3a03eSrie# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate.KEEP_STATE:
277c478bd9Sstevel@tonic-gate.SUFFIXES:
287c478bd9Sstevel@tonic-gate
2969bb4bb4ScarlsonjSRCS += \
3069bb4bb4Scarlsonj	ffs.c \
3169bb4bb4Scarlsonj	mdb.c \
327c478bd9Sstevel@tonic-gate	mdb_addrvec.c \
337c478bd9Sstevel@tonic-gate	mdb_argvec.c \
347c478bd9Sstevel@tonic-gate	mdb_callb.c \
357c478bd9Sstevel@tonic-gate	mdb_cmdbuf.c \
367c478bd9Sstevel@tonic-gate	mdb_cmds.c \
377c478bd9Sstevel@tonic-gate	mdb_conf.c \
387c478bd9Sstevel@tonic-gate	mdb_context.c \
397c478bd9Sstevel@tonic-gate	mdb_create.c \
407c478bd9Sstevel@tonic-gate	mdb_ctf.c \
417c478bd9Sstevel@tonic-gate	mdb_ctf_open.c \
427c478bd9Sstevel@tonic-gate	mdb_debug.c \
437c478bd9Sstevel@tonic-gate	mdb_demangle.c \
447c478bd9Sstevel@tonic-gate	mdb_disasm.c \
457c478bd9Sstevel@tonic-gate	mdb_dump.c \
467c478bd9Sstevel@tonic-gate	mdb_err.c \
477c478bd9Sstevel@tonic-gate	mdb_evset.c \
487c478bd9Sstevel@tonic-gate	mdb_fdio.c \
497c478bd9Sstevel@tonic-gate	mdb_fmt.c \
507c478bd9Sstevel@tonic-gate	mdb_frame.c \
517c478bd9Sstevel@tonic-gate	mdb_gelf.c \
527c478bd9Sstevel@tonic-gate	mdb_help.c \
537c478bd9Sstevel@tonic-gate	mdb_io.c \
54843e1988Sjohnlev	mdb_kb_kvm.c \
557c478bd9Sstevel@tonic-gate	mdb_kproc.c \
567c478bd9Sstevel@tonic-gate	mdb_kvm.c \
577c478bd9Sstevel@tonic-gate	mdb_logio.c \
587c478bd9Sstevel@tonic-gate	mdb_list.c \
597c478bd9Sstevel@tonic-gate	mdb_macalias.c \
607c478bd9Sstevel@tonic-gate	mdb_main.c \
61843e1988Sjohnlev	mdb_memio.c \
627c478bd9Sstevel@tonic-gate	mdb_modapi.c \
637c478bd9Sstevel@tonic-gate	mdb_module.c \
647c478bd9Sstevel@tonic-gate	mdb_module_load.c \
657c478bd9Sstevel@tonic-gate	mdb_nm.c \
667c478bd9Sstevel@tonic-gate	mdb_nv.c \
677c478bd9Sstevel@tonic-gate	mdb_pipeio.c \
687c478bd9Sstevel@tonic-gate	mdb_print.c \
697c478bd9Sstevel@tonic-gate	mdb_proc.c \
707c478bd9Sstevel@tonic-gate	mdb_pservice.c \
717c478bd9Sstevel@tonic-gate	mdb_rawfile.c \
727c478bd9Sstevel@tonic-gate	mdb_set.c \
737c478bd9Sstevel@tonic-gate	mdb_shell.c \
747c478bd9Sstevel@tonic-gate	mdb_signal.c \
757c478bd9Sstevel@tonic-gate	mdb_stdlib.c \
767c478bd9Sstevel@tonic-gate	mdb_string.c \
777c478bd9Sstevel@tonic-gate	mdb_strio.c \
787c478bd9Sstevel@tonic-gate	mdb_target.c \
797c478bd9Sstevel@tonic-gate	mdb_tdb.c \
807c478bd9Sstevel@tonic-gate	mdb_termio.c \
817c478bd9Sstevel@tonic-gate	mdb_umem.c \
827c478bd9Sstevel@tonic-gate	mdb_value.c \
837c478bd9Sstevel@tonic-gate	mdb_vcb.c \
847c478bd9Sstevel@tonic-gate	mdb_wcb.c
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
877c478bd9Sstevel@tonic-gateCPPFLAGS += -D_MDB -I. -I../.. -I../../../common
887c478bd9Sstevel@tonic-gate
89843e1988SjohnlevC99MODE=	-xc99=%all
90843e1988SjohnlevC99LMODE=	-Xc99=%all
91843e1988Sjohnlev
9267e3a03eSrieLDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
937c478bd9Sstevel@tonic-gate
94*8793b36bSNick Todd#
95*8793b36bSNick Todd# -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused
96*8793b36bSNick Todd# about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and
97*8793b36bSNick Todd# mdb_tgt_stack_iter_f(). Will be resolved as part of fix for CR 6749868.
98*8793b36bSNick Todd#
99*8793b36bSNick ToddLINTFLAGS += -n -errtags=yes -erroff=E_INCONS_ARG_DECL2
1007c478bd9Sstevel@tonic-gateLINTFILES = $(SRCS:%.c=%.ln)
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gatePROG = mdb
1037c478bd9Sstevel@tonic-gateOBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gateLINK = adb
1067c478bd9Sstevel@tonic-gateROOTLINK = $(ROOTBIN)/$(LINK)
1077c478bd9Sstevel@tonic-gateROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
1087c478bd9Sstevel@tonic-gateROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate.NO_PARALLEL:
1117c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LINTFILES)
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateall: $(PROG)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
1167c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1177c478bd9Sstevel@tonic-gate	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
1187c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate$(ROOTLINK32): $(ROOTPROG32)
1217c478bd9Sstevel@tonic-gate	$(RM) $@
1227c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG32) $@
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gate$(ROOTLINK64): $(ROOTPROG64)
1257c478bd9Sstevel@tonic-gate	$(RM) $@
1267c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG64) $@
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
1297c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
1327c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
1337c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
1347c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gatemdb_lex.o mdb_grammar.o := CCVERBOSE =
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gatemdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
1397c478bd9Sstevel@tonic-gate
1407c478bd9Sstevel@tonic-gateinet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
1417c478bd9Sstevel@tonic-gate
14269bb4bb4Scarlsonjffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
14369bb4bb4Scarlsonj
1447c478bd9Sstevel@tonic-gate%.o: ../../../common/mdb/%.c
1457c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1467c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate%.o: ../../mdb/%.c
1497c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1507c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate%.o: %.c
1537c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1547c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
1577c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1587c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1597c478bd9Sstevel@tonic-gate
16069bb4bb4Scarlsonj%.o: $(SRC)/common/util/%.c
16169bb4bb4Scarlsonj	$(COMPILE.c) $<
16269bb4bb4Scarlsonj	$(CTFCONVERT_O)
16369bb4bb4Scarlsonj
1647c478bd9Sstevel@tonic-gateclean.lint:
1657c478bd9Sstevel@tonic-gate	$(RM) $(LINTFILES)
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gateclean:
1687c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1697c478bd9Sstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gateclobber: clean clean.lint
1727c478bd9Sstevel@tonic-gate	$(RM) $(PROG)
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gate%.ln: ../../../common/mdb/%.c
1757c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate%.ln: ../../mdb/%.c
1787c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate%.ln: %.c
1817c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate%.ln: $(SRC)/common/net/util/%.c
1847c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1857c478bd9Sstevel@tonic-gate
18669bb4bb4Scarlsonj%.ln: $(SRC)/common/util/%.c
18769bb4bb4Scarlsonj	$(LINT.c) -c $<
18869bb4bb4Scarlsonj
1897c478bd9Sstevel@tonic-gatelint: $(LINTFILES)
1907c478bd9Sstevel@tonic-gate	$(LINT) $(LINTFLAGS) $(LINTFILES)
1917c478bd9Sstevel@tonic-gate
1927c478bd9Sstevel@tonic-gatedmods:
193