xref: /illumos-gate/usr/src/cmd/mdb/Makefile.mdb (revision 843e1988)
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#
223893cb7fStomee# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate.KEEP_STATE:
297c478bd9Sstevel@tonic-gate.SUFFIXES:
307c478bd9Sstevel@tonic-gate
3169bb4bb4ScarlsonjSRCS += \
3269bb4bb4Scarlsonj	ffs.c \
3369bb4bb4Scarlsonj	mdb.c \
347c478bd9Sstevel@tonic-gate	mdb_addrvec.c \
357c478bd9Sstevel@tonic-gate	mdb_argvec.c \
367c478bd9Sstevel@tonic-gate	mdb_callb.c \
377c478bd9Sstevel@tonic-gate	mdb_cmdbuf.c \
387c478bd9Sstevel@tonic-gate	mdb_cmds.c \
397c478bd9Sstevel@tonic-gate	mdb_conf.c \
407c478bd9Sstevel@tonic-gate	mdb_context.c \
417c478bd9Sstevel@tonic-gate	mdb_create.c \
427c478bd9Sstevel@tonic-gate	mdb_ctf.c \
437c478bd9Sstevel@tonic-gate	mdb_ctf_open.c \
447c478bd9Sstevel@tonic-gate	mdb_debug.c \
457c478bd9Sstevel@tonic-gate	mdb_demangle.c \
467c478bd9Sstevel@tonic-gate	mdb_disasm.c \
477c478bd9Sstevel@tonic-gate	mdb_dump.c \
487c478bd9Sstevel@tonic-gate	mdb_err.c \
497c478bd9Sstevel@tonic-gate	mdb_evset.c \
507c478bd9Sstevel@tonic-gate	mdb_fdio.c \
517c478bd9Sstevel@tonic-gate	mdb_fmt.c \
527c478bd9Sstevel@tonic-gate	mdb_frame.c \
537c478bd9Sstevel@tonic-gate	mdb_gelf.c \
547c478bd9Sstevel@tonic-gate	mdb_help.c \
557c478bd9Sstevel@tonic-gate	mdb_io.c \
56*843e1988Sjohnlev	mdb_kb_kvm.c \
577c478bd9Sstevel@tonic-gate	mdb_kproc.c \
587c478bd9Sstevel@tonic-gate	mdb_kvm.c \
597c478bd9Sstevel@tonic-gate	mdb_logio.c \
607c478bd9Sstevel@tonic-gate	mdb_list.c \
617c478bd9Sstevel@tonic-gate	mdb_macalias.c \
627c478bd9Sstevel@tonic-gate	mdb_main.c \
63*843e1988Sjohnlev	mdb_memio.c \
647c478bd9Sstevel@tonic-gate	mdb_modapi.c \
657c478bd9Sstevel@tonic-gate	mdb_module.c \
667c478bd9Sstevel@tonic-gate	mdb_module_load.c \
677c478bd9Sstevel@tonic-gate	mdb_nm.c \
687c478bd9Sstevel@tonic-gate	mdb_nv.c \
697c478bd9Sstevel@tonic-gate	mdb_pipeio.c \
707c478bd9Sstevel@tonic-gate	mdb_print.c \
717c478bd9Sstevel@tonic-gate	mdb_proc.c \
727c478bd9Sstevel@tonic-gate	mdb_pservice.c \
737c478bd9Sstevel@tonic-gate	mdb_rawfile.c \
747c478bd9Sstevel@tonic-gate	mdb_set.c \
757c478bd9Sstevel@tonic-gate	mdb_shell.c \
767c478bd9Sstevel@tonic-gate	mdb_signal.c \
777c478bd9Sstevel@tonic-gate	mdb_stdlib.c \
787c478bd9Sstevel@tonic-gate	mdb_string.c \
797c478bd9Sstevel@tonic-gate	mdb_strio.c \
807c478bd9Sstevel@tonic-gate	mdb_target.c \
817c478bd9Sstevel@tonic-gate	mdb_tdb.c \
827c478bd9Sstevel@tonic-gate	mdb_termio.c \
837c478bd9Sstevel@tonic-gate	mdb_umem.c \
847c478bd9Sstevel@tonic-gate	mdb_value.c \
857c478bd9Sstevel@tonic-gate	mdb_vcb.c \
867c478bd9Sstevel@tonic-gate	mdb_wcb.c
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
897c478bd9Sstevel@tonic-gateCPPFLAGS += -D_MDB -I. -I../.. -I../../../common
907c478bd9Sstevel@tonic-gate
91*843e1988SjohnlevC99MODE=	-xc99=%all
92*843e1988SjohnlevC99LMODE=	-Xc99=%all
93*843e1988Sjohnlev
94087e1372StomeeLDLIBS += -ltermcap -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm \
957c478bd9Sstevel@tonic-gate	$(ZLAZYLOAD) -lscf $(ZNOLAZYLOAD)
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gateLINTFLAGS += -n -errtags=yes
987c478bd9Sstevel@tonic-gateLINTFILES = $(SRCS:%.c=%.ln)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gatePROG = mdb
1017c478bd9Sstevel@tonic-gateOBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gateLINK = adb
1047c478bd9Sstevel@tonic-gateROOTLINK = $(ROOTBIN)/$(LINK)
1057c478bd9Sstevel@tonic-gateROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
1067c478bd9Sstevel@tonic-gateROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate.NO_PARALLEL:
1097c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LINTFILES)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateall: $(PROG)
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
1147c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1157c478bd9Sstevel@tonic-gate	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
1167c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gate$(ROOTLINK32): $(ROOTPROG32)
1197c478bd9Sstevel@tonic-gate	$(RM) $@
1207c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG32) $@
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gate$(ROOTLINK64): $(ROOTPROG64)
1237c478bd9Sstevel@tonic-gate	$(RM) $@
1247c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG64) $@
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
1277c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
1307c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
1317c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
1327c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gatemdb_lex.o mdb_grammar.o := CCVERBOSE =
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gatemdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gateinet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
1397c478bd9Sstevel@tonic-gate
14069bb4bb4Scarlsonjffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
14169bb4bb4Scarlsonj
1427c478bd9Sstevel@tonic-gate%.o: ../../../common/mdb/%.c
1437c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1447c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gate%.o: ../../mdb/%.c
1477c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1487c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate%.o: %.c
1517c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1527c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
1557c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1567c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1577c478bd9Sstevel@tonic-gate
15869bb4bb4Scarlsonj%.o: $(SRC)/common/util/%.c
15969bb4bb4Scarlsonj	$(COMPILE.c) $<
16069bb4bb4Scarlsonj	$(CTFCONVERT_O)
16169bb4bb4Scarlsonj
1627c478bd9Sstevel@tonic-gateclean.lint:
1637c478bd9Sstevel@tonic-gate	$(RM) $(LINTFILES)
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gateclean:
1667c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1677c478bd9Sstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gateclobber: clean clean.lint
1707c478bd9Sstevel@tonic-gate	$(RM) $(PROG)
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gate%.ln: ../../../common/mdb/%.c
1737c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gate%.ln: ../../mdb/%.c
1767c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gate%.ln: %.c
1797c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate%.ln: $(SRC)/common/net/util/%.c
1827c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1837c478bd9Sstevel@tonic-gate
18469bb4bb4Scarlsonj%.ln: $(SRC)/common/util/%.c
18569bb4bb4Scarlsonj	$(LINT.c) -c $<
18669bb4bb4Scarlsonj
1877c478bd9Sstevel@tonic-gatelint: $(LINTFILES)
1887c478bd9Sstevel@tonic-gate	$(LINT) $(LINTFLAGS) $(LINTFILES)
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gatedmods:
191