xref: /illumos-gate/usr/src/cmd/mdb/Makefile.kmdb (revision 48bc00d6814e04ff3edb32cafe7d1bc580baff68)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26.KEEP_STATE:
27.SUFFIXES:
28
29PROG = kmdbmod
30
31include ../Makefile.kmdb
32include ../../Makefile.kmdb
33include ../../../Makefile.versions
34include ../../../Makefile.tools
35include ../../../Makefile.kmdb.files
36
37OBJS += mdb_lex.o mdb_grammar.o
38
39.NO_PARALLEL:
40.PARALLEL: kmdb_modlinktest.o kmdb_terminfo.c $(ALLOBJS) $(ALLOBJS:%.o=%.ln)
41
42SRCINCDIRS	+= . .. ../.. ../../../common ../../../common/libstand
43OSINCDIRS	+= $(SRC)/uts/$(MMU) $(SRC)/uts/$(ISADIR)
44
45INCDIRS	= $(SRCINCDIRS) $(OSINCDIRS)
46
47# We don't want thread-specific errno's in kmdb, as we're single-threaded.
48DTS_ERRNO=
49
50$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
51CPPFLAGS += -D_MDB -D_KMDB $(INCDIRS:%=-I%) $(ARCHOPTS)
52
53#
54# kmdb is a kernel module, so we'll use the kernel's build flags.
55CFLAGS += $(STAND_FLAGS_32)
56CFLAGS64 += $(STAND_FLAGS_64)
57
58ASFLAGS += -P -D_ASM $(INCDIRS:%=-I%) $(ARCHOPTS)
59
60SUBDIR64_sparc		= sparcv9
61SUBDIR64_i386		= amd64
62SUBDIR64		= $(SUBDIR64_$(MACH))
63
64#
65# Terminal types supported by kmdb
66#
67SUPPORTED_TERMS	= \
68	ansi \
69	at386 \
70	AT386 \
71	dtterm \
72	h19 \
73	sun \
74	sun-cmd \
75	sun-color \
76	vt100 \
77	vt52 \
78	wyse30 \
79	wyse50 \
80	wyse60 \
81	xterm \
82	xterms
83
84LINTFLAGS += -n -errtags=yes
85
86# The prom interfaces (the prom_* files) are compiled with -D_KERNEL, which
87# teaches them about the kernel version of the synchronization functions, while
88# the core of kmdb, which is compiled without -D_KERNEL, knows about the
89# userland versions.  Even though nobody actually uses either one, lint
90# complains that both know about different versions.  The same thing applies
91# to the driver, parts of which are executed directly by the kernel, and other
92# parts which are called by kmdb via the auxv.
93ALLLINTFLAGS = $(LINTFLAGS) \
94	-xerroff=E_FUNC_DECL_VAR_ARG2 \
95	-xerroff=E_INCONS_ARG_DECL \
96	-xerroff=E_INCONS_ARG_DECL2 \
97	-xerroff=E_INCONS_ARG_USED2 \
98	-xerroff=E_INCONS_VAL_TYPE_DECL2 \
99	-xerroff=E_INCONS_VAL_TYPE_USED2
100
101MAPFILE = mapfile
102MAPFILE_INTERMEDIATE = $(MAPFILE).i
103MAPFILE_TEMPLATE = ../../../common/kmdb/mapfile_skel
104MAPFILE_SOURCES_COMMON = \
105	../../../common/kmdb/kmdb_dpi.h \
106	../../../common/kmdb/kmdb_kctl.h \
107	../../../common/kmdb/kmdb_kdi.h \
108	../../../common/kmdb/kmdb_wr.h \
109	../../../common/mdb/mdb_ctf.h \
110	../../../common/mdb/mdb_ks.h \
111	../../../common/mdb/mdb_modapi.h \
112	../../../common/mdb/mdb_param.h \
113	../../../common/mdb/mdb_whatis.h
114
115mdb_lex.o mdb_grammar.o := CCVERBOSE =
116
117kmdb_ctf_open.o kmdb_ctf_open.ln	:= CPPFLAGS += -I$(SRC)/common/ctf
118
119PROMTGTS	= $(PROMOBJS) $(PROMOBJS:%.o=%.ln)
120VERSTGTS	= $(VERSOBJS) $(VERSOBJS:%.o=%.ln)
121KCTLTGTS	= $(KCTLOBJS) $(KCTLOBJS:%.o=%.ln)
122
123$(PROMTGTS) := CPPFLAGS += -D_BOOT -D_KERNEL -D_MACHDEP $(PROMINCDIRS:%=-I%) \
124	-Dassfail=kmdb_prom_assfail
125
126$(VERSTGTS) := CPPFLAGS += -DKMDB_VERSION='$(KMDB_VERSION)'
127
128$(KCTLTGTS) := CPPFLAGS += -D_KERNEL
129$(KCTLTGTS) := ASFLAGS += -D_KERNEL
130
131ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
132
133$(ROOTMISC) $(ROOTMISC64) := FILEMODE = 0755
134
135include ../../../Makefile.kmdb.targ
136