1dc0093f4Seschrock# 2dc0093f4Seschrock# CDDL HEADER START 3dc0093f4Seschrock# 4dc0093f4Seschrock# 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. 7dc0093f4Seschrock# 8dc0093f4Seschrock# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9dc0093f4Seschrock# or http://www.opensolaris.org/os/licensing. 10dc0093f4Seschrock# See the License for the specific language governing permissions 11dc0093f4Seschrock# and limitations under the License. 12dc0093f4Seschrock# 13dc0093f4Seschrock# When distributing Covered Code, include this CDDL HEADER in each 14dc0093f4Seschrock# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15dc0093f4Seschrock# If applicable, add the following below this CDDL HEADER, with the 16dc0093f4Seschrock# fields enclosed by brackets "[]" replaced with your own identifying 17dc0093f4Seschrock# information: Portions Copyright [yyyy] [name of copyright owner] 18dc0093f4Seschrock# 19dc0093f4Seschrock# CDDL HEADER END 20dc0093f4Seschrock# 21dc0093f4Seschrock# 22*24da5b34Srie# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23dc0093f4Seschrock# Use is subject to license terms. 24dc0093f4Seschrock# 25dc0093f4Seschrock# ident "%Z%%M% %I% %E% SMI" 26f808c858Sraf# 27dc0093f4Seschrock 28dc0093f4Seschrock# 29dc0093f4Seschrock# The build process for libdisasm is sightly different from that used by other 30dc0093f4Seschrock# libraries, because libdisasm must be built in two flavors - as a standalone 31dc0093f4Seschrock# for use by kmdb and as a normal library. We use $(CURTYPE) to indicate the 32dc0093f4Seschrock# current flavor being built. 33dc0093f4Seschrock# 34dc0093f4Seschrock# The SPARC library is built from the closed gate. This Makefile is shared 35dc0093f4Seschrock# between both environments, so all paths must be absolute. 36dc0093f4Seschrock# 37dc0093f4Seschrock 38dc0093f4SeschrockLIBRARY= libdisasm.a 39dc0093f4SeschrockSTANDLIBRARY= libstanddisasm.so 40dc0093f4SeschrockVERS= .1 41dc0093f4Seschrock 42dc0093f4Seschrock# By default, we build the shared library. Construction of the standalone 43dc0093f4Seschrock# is specifically requested by architecture-specific Makefiles. 44dc0093f4SeschrockTYPES= library 45dc0093f4SeschrockCURTYPE= library 46dc0093f4Seschrock 47dc0093f4SeschrockCOMDIR= $(SRC)/lib/libdisasm/common 48dc0093f4Seschrock 49dc0093f4Seschrock# 50dc0093f4Seschrock# Architecture-dependent files common to both versions of libdisasm 51dc0093f4Seschrock# 52dc0093f4SeschrockOBJECTS_common_i386 = dis_i386.o dis_tables.o 53dc0093f4SeschrockOBJECTS_common_sparc = dis_sparc.o 54dc0093f4Seschrock 55dc0093f4SeschrockSRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c 56dc0093f4SeschrockSRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c 57dc0093f4Seschrock 58dc0093f4Seschrock# 59dc0093f4Seschrock# Architecture-independent files common to both version of libdisasm 60dc0093f4Seschrock# 61dc0093f4SeschrockOBJECTS_common_common = libdisasm.o 62dc0093f4SeschrockSRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c) 63dc0093f4Seschrock 64dc0093f4Seschrock 65dc0093f4SeschrockOBJECTS= \ 66dc0093f4Seschrock $(OBJECTS_common_$(MACH)) \ 67dc0093f4Seschrock $(OBJECTS_common_common) 68dc0093f4Seschrock 69dc0093f4Seschrockinclude $(SRC)/lib/Makefile.lib 70dc0093f4Seschrock 71dc0093f4SeschrockSRCS= \ 72dc0093f4Seschrock $(SRCS_$(CURTYPE)) \ 73dc0093f4Seschrock $(SRCS_common_$(MACH)) \ 74dc0093f4Seschrock $(SRCS_common_common) 75dc0093f4Seschrock 76dc0093f4Seschrock# 77dc0093f4Seschrock# Used to verify that the standalone doesn't have any unexpected external 78dc0093f4Seschrock# dependencies. 79dc0093f4Seschrock# 80dc0093f4SeschrockLINKTEST_OBJ = objs/linktest_stand.o 81dc0093f4Seschrock 82dc0093f4SeschrockCLOBBERFILES_standalone = $(LINKTEST_OBJ) 83dc0093f4SeschrockCLOBBERFILES += $(CLOBBERFILES_$(CURTYPE)) 84dc0093f4Seschrock 85dc0093f4SeschrockLIBS_standalone = $(STANDLIBRARY) 86dc0093f4SeschrockLIBS_library = $(DYNLIB) $(LINTLIB) 87dc0093f4SeschrockLIBS = $(LIBS_$(CURTYPE)) 88dc0093f4Seschrock 89f808c858SrafMAPFILES = $(COMDIR)/mapfile-vers 90dc0093f4Seschrock 91dc0093f4SeschrockLDLIBS += -lc 92dc0093f4Seschrock 93*24da5b34SrieLDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r 94dc0093f4SeschrockLDFLAGS = $(LDFLAGS_$(CURTYPE)) 95dc0093f4Seschrock 96dc0093f4SeschrockASFLAGS_standalone = -DDIS_STANDALONE 97dc0093f4SeschrockASFLAGS_library = 98dc0093f4SeschrockASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM 99dc0093f4Seschrock 100dc0093f4Seschrock$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC) 101dc0093f4Seschrock 102dc0093f4Seschrock# We want the thread-specific errno in the library, but we don't want it in 103dc0093f4Seschrock# the standalone. $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS), 104dc0093f4Seschrock# in order to enable this feature. Conveniently, -D_REENTRANT does the same 105dc0093f4Seschrock# thing. As such, we null out $(DTS_ERRNO) to ensure that the standalone 106dc0093f4Seschrock# doesn't get it. 107dc0093f4SeschrockDTS_ERRNO= 108dc0093f4Seschrock 109dc0093f4Seschrock# We need to rename some standard functions so we can easily implement them 110dc0093f4Seschrock# in consumers. 111dc0093f4SeschrockSTAND_RENAMED_FUNCS= \ 112dc0093f4Seschrock snprintf 113dc0093f4Seschrock 114dc0093f4SeschrockCPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \ 115dc0093f4Seschrock -I$(SRC)/cmd/mdb/common 116dc0093f4SeschrockCPPFLAGS_library = -D_REENTRANT 117dc0093f4SeschrockCPPFLAGS += -I$(COMDIR) $(CPPFLAGS_$(CURTYPE)) 118dc0093f4Seschrock 119dc0093f4Seschrock# 120dc0093f4Seschrock# For x86, we have to link to sources in usr/src/common 121dc0093f4Seschrock# 122dc0093f4SeschrockCPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT 123dc0093f4SeschrockCPPFLAGS_dis_sparc = 124dc0093f4SeschrockCPPFLAGS += $(CPPFLAGS_dis_$(MACH)) 125dc0093f4Seschrock 126dc0093f4SeschrockCFLAGS_standalone = $(STAND_FLAGS_32) 127dc0093f4SeschrockCFLAGS_common = 128dc0093f4SeschrockCFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common) 129dc0093f4Seschrock 130dc0093f4SeschrockCFLAGS64_standalone = $(STAND_FLAGS_64) 131dc0093f4SeschrockCFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common) 132dc0093f4Seschrock 133dc0093f4SeschrockDYNFLAGS += $(ZINTERPOSE) 134dc0093f4Seschrock 135dc0093f4Seschrock.KEEP_STATE: 136