xref: /illumos-gate/usr/src/cmd/mdb/Makefile.mdb (revision 1e8d79d2)
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#
224a1c2431SJonathan Adams# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
263b6e0a59SMatt Amdur#
273b6e0a59SMatt Amdur# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
283b6e0a59SMatt Amdur# Copyright (c) 2012 by Delphix. All rights reserved.
29089ef9c1SJason King# Copyright 2021 Joyent, Inc.
304226f635SJason King# Copyright 2018 Jason King
313b6e0a59SMatt Amdur#
323b6e0a59SMatt Amdur
337c478bd9Sstevel@tonic-gate.KEEP_STATE:
347c478bd9Sstevel@tonic-gate.SUFFIXES:
357c478bd9Sstevel@tonic-gate
3669bb4bb4ScarlsonjSRCS += \
3769bb4bb4Scarlsonj	ffs.c \
3869bb4bb4Scarlsonj	mdb.c \
397c478bd9Sstevel@tonic-gate	mdb_addrvec.c \
407c478bd9Sstevel@tonic-gate	mdb_argvec.c \
417c478bd9Sstevel@tonic-gate	mdb_callb.c \
427c478bd9Sstevel@tonic-gate	mdb_cmdbuf.c \
437c478bd9Sstevel@tonic-gate	mdb_cmds.c \
447c478bd9Sstevel@tonic-gate	mdb_conf.c \
457c478bd9Sstevel@tonic-gate	mdb_context.c \
467c478bd9Sstevel@tonic-gate	mdb_create.c \
477c478bd9Sstevel@tonic-gate	mdb_ctf.c \
487c478bd9Sstevel@tonic-gate	mdb_ctf_open.c \
497c478bd9Sstevel@tonic-gate	mdb_debug.c \
507c478bd9Sstevel@tonic-gate	mdb_demangle.c \
517c478bd9Sstevel@tonic-gate	mdb_disasm.c \
527c478bd9Sstevel@tonic-gate	mdb_dump.c \
537c478bd9Sstevel@tonic-gate	mdb_err.c \
547c478bd9Sstevel@tonic-gate	mdb_evset.c \
557c478bd9Sstevel@tonic-gate	mdb_fdio.c \
567c478bd9Sstevel@tonic-gate	mdb_fmt.c \
577c478bd9Sstevel@tonic-gate	mdb_frame.c \
587c478bd9Sstevel@tonic-gate	mdb_gelf.c \
597c478bd9Sstevel@tonic-gate	mdb_help.c \
607c478bd9Sstevel@tonic-gate	mdb_io.c \
61843e1988Sjohnlev	mdb_kb_kvm.c \
627c478bd9Sstevel@tonic-gate	mdb_kproc.c \
637c478bd9Sstevel@tonic-gate	mdb_kvm.c \
64089ef9c1SJason King	mdb_linkerset.c \
657c478bd9Sstevel@tonic-gate	mdb_logio.c \
667c478bd9Sstevel@tonic-gate	mdb_list.c \
677c478bd9Sstevel@tonic-gate	mdb_macalias.c \
687c478bd9Sstevel@tonic-gate	mdb_main.c \
69843e1988Sjohnlev	mdb_memio.c \
707c478bd9Sstevel@tonic-gate	mdb_modapi.c \
717c478bd9Sstevel@tonic-gate	mdb_module.c \
727c478bd9Sstevel@tonic-gate	mdb_module_load.c \
737c478bd9Sstevel@tonic-gate	mdb_nm.c \
747c478bd9Sstevel@tonic-gate	mdb_nv.c \
757c478bd9Sstevel@tonic-gate	mdb_pipeio.c \
767c478bd9Sstevel@tonic-gate	mdb_print.c \
777c478bd9Sstevel@tonic-gate	mdb_proc.c \
787c478bd9Sstevel@tonic-gate	mdb_pservice.c \
797c478bd9Sstevel@tonic-gate	mdb_rawfile.c \
807c478bd9Sstevel@tonic-gate	mdb_set.c \
817c478bd9Sstevel@tonic-gate	mdb_shell.c \
827c478bd9Sstevel@tonic-gate	mdb_signal.c \
837c478bd9Sstevel@tonic-gate	mdb_stdlib.c \
847c478bd9Sstevel@tonic-gate	mdb_string.c \
857c478bd9Sstevel@tonic-gate	mdb_strio.c \
863b6e0a59SMatt Amdur	mdb_tab.c \
877c478bd9Sstevel@tonic-gate	mdb_target.c \
887c478bd9Sstevel@tonic-gate	mdb_tdb.c \
897c478bd9Sstevel@tonic-gate	mdb_termio.c \
900a47c91cSRobert Mustacchi	mdb_typedef.c \
917c478bd9Sstevel@tonic-gate	mdb_umem.c \
927c478bd9Sstevel@tonic-gate	mdb_value.c \
937c478bd9Sstevel@tonic-gate	mdb_vcb.c \
94089ef9c1SJason King	mdb_walkers.c \
954a1c2431SJonathan Adams	mdb_wcb.c \
964a1c2431SJonathan Adams	mdb_whatis.c
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
997c478bd9Sstevel@tonic-gateCPPFLAGS += -D_MDB -I. -I../.. -I../../../common
1007c478bd9Sstevel@tonic-gate
101bd0ce624SYuri PankovCSTD=	$(CSTD_GNU99)
102843e1988Sjohnlev
1037c1d3545SGordon RossLDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
1044226f635SJason KingLDLIBS += -ldemangle-sys
1057c478bd9Sstevel@tonic-gate
106d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT)
1077014882cSRichard LoweCERRWARN += -_gcc=-Wno-char-subscripts
1087014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered
1097014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses
1107014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label
1117014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable
1127014882cSRichard Lowe
1137c478bd9Sstevel@tonic-gatePROG = mdb
1147c478bd9Sstevel@tonic-gateOBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gateLINK = adb
1177c478bd9Sstevel@tonic-gateROOTLINK = $(ROOTBIN)/$(LINK)
1187c478bd9Sstevel@tonic-gateROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
1197c478bd9Sstevel@tonic-gateROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate.NO_PARALLEL:
122*1e8d79d2SYuri Pankov.PARALLEL: $(OBJS)
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gateall: $(PROG)
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
1277c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1287c478bd9Sstevel@tonic-gate	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
1297c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate$(ROOTLINK32): $(ROOTPROG32)
1327c478bd9Sstevel@tonic-gate	$(RM) $@
1337c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG32) $@
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gate$(ROOTLINK64): $(ROOTPROG64)
1367c478bd9Sstevel@tonic-gate	$(RM) $@
1377c478bd9Sstevel@tonic-gate	$(LN) $(ROOTPROG64) $@
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gatemdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
1407c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gatemdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
1437c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
1447c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h mdb_grammar.h
1457c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c mdb_grammar.c
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gatemdb_lex.o mdb_grammar.o := CCVERBOSE =
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gatemdb_conf.o := CPPFLAGS += -DMDB_VERSION='$(MDB_VERSION)'
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateinet_ntop.o := CPPFLAGS += -Dsnprintf=mdb_snprintf
1527c478bd9Sstevel@tonic-gate
15369bb4bb4Scarlsonjffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
15469bb4bb4Scarlsonj
1557c478bd9Sstevel@tonic-gate%.o: ../../../common/mdb/%.c
1567c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1577c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate%.o: ../../mdb/%.c
1607c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1617c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate%.o: %.c
1647c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1657c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gate%.o: $(SRC)/common/net/util/%.c
1687c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1697c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1707c478bd9Sstevel@tonic-gate
17169bb4bb4Scarlsonj%.o: $(SRC)/common/util/%.c
17269bb4bb4Scarlsonj	$(COMPILE.c) $<
17369bb4bb4Scarlsonj	$(CTFCONVERT_O)
17469bb4bb4Scarlsonj
1757c478bd9Sstevel@tonic-gateclean:
1767c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1777c478bd9Sstevel@tonic-gate	$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
1787c478bd9Sstevel@tonic-gate
179*1e8d79d2SYuri Pankovclobber: clean
1807c478bd9Sstevel@tonic-gate	$(RM) $(PROG)
1817c478bd9Sstevel@tonic-gate
1827c478bd9Sstevel@tonic-gatedmods:
183