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