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 2007 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> 25# Copyright 2015 Nexenta Systems, Inc. All rights reserved. 26# 27 28# 29# The build process for libdisasm is sightly different from that used by other 30# libraries, because libdisasm must be built in two flavors - as a standalone 31# for use by kmdb and as a normal library. We use $(CURTYPE) to indicate the 32# current flavor being built. 33# 34 35LIBRARY= libdisasm.a 36STANDLIBRARY= libstanddisasm.so 37VERS= .1 38 39# By default, we build the shared library. Construction of the standalone 40# is specifically requested by architecture-specific Makefiles. 41TYPES= library 42CURTYPE= library 43 44COMDIR= $(SRC)/lib/libdisasm/common 45 46# 47# Architecture-independent files 48# 49SRCS_common= $(COMDIR)/libdisasm.c 50OBJECTS_common= libdisasm.o 51 52# 53# Architecture-dependent disassembly files 54# 55SRCS_i386= $(COMDIR)/dis_i386.c \ 56 $(SRC)/common/dis/i386/dis_tables.c 57SRCS_sparc= $(COMDIR)/dis_sparc.c \ 58 $(COMDIR)/dis_sparc_fmt.c \ 59 $(COMDIR)/dis_sparc_instr.c 60 61OBJECTS_i386= dis_i386.o \ 62 dis_tables.o 63OBJECTS_sparc= dis_sparc.o \ 64 dis_sparc_fmt.o \ 65 dis_sparc_instr.o 66 67# 68# We build the regular shared library with support for all architectures. 69# The standalone version should only contain code for the native 70# architecture to reduce the memory footprint of kmdb. 71# 72OBJECTS_library= $(OBJECTS_common) \ 73 $(OBJECTS_i386) \ 74 $(OBJECTS_sparc) 75OBJECTS_standalone= $(OBJECTS_common) \ 76 $(OBJECTS_$(MACH)) 77OBJECTS= $(OBJECTS_$(CURTYPE)) 78 79include $(SRC)/lib/Makefile.lib 80 81SRCS_library= $(SRCS_common) \ 82 $(SRCS_i386) \ 83 $(SRCS_sparc) 84SRCS_standalone= $(SRCS_common) \ 85 $(SRCS_$(MACH)) 86SRCS= $(SRCS_$(CURTYPE)) 87 88# 89# Used to verify that the standalone doesn't have any unexpected external 90# dependencies. 91# 92LINKTEST_OBJ = objs/linktest_stand.o 93 94CLOBBERFILES_standalone = $(LINKTEST_OBJ) 95CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE)) 96 97LIBS_standalone = $(STANDLIBRARY) 98LIBS_library = $(DYNLIB) $(LINTLIB) 99LIBS = $(LIBS_$(CURTYPE)) 100 101MAPFILES = $(COMDIR)/mapfile-vers 102 103LDLIBS += -lc 104 105LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r 106LDFLAGS = $(LDFLAGS_$(CURTYPE)) 107 108ASFLAGS_standalone = -DDIS_STANDALONE 109ASFLAGS_library = 110ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM 111 112$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC) 113 114CERRWARN += -_gcc=-Wno-parentheses 115CERRWARN += -_gcc=-Wno-uninitialized 116 117# We want the thread-specific errno in the library, but we don't want it in 118# the standalone. $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS), 119# in order to enable this feature. Conveniently, -D_REENTRANT does the same 120# thing. As such, we null out $(DTS_ERRNO) to ensure that the standalone 121# doesn't get it. 122DTS_ERRNO= 123 124CPPFLAGS_standalone = -DDIS_STANDALONE -I$(SRC)/cmd/mdb/common 125CPPFLAGS_library = -D_REENTRANT 126CPPFLAGS += -I$(COMDIR) $(CPPFLAGS_$(CURTYPE)) 127 128# For the x86 disassembler we have to include sources from usr/src/common 129CPPFLAGS += -I$(SRC)/common/dis/i386 -DDIS_TEXT 130 131CFLAGS_standalone = $(STAND_FLAGS_32) 132CFLAGS_common = 133CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common) 134 135CFLAGS64_standalone = $(STAND_FLAGS_64) 136CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common) 137 138C99MODE = $(C99_ENABLE) 139 140DYNFLAGS += $(ZINTERPOSE) 141 142.KEEP_STATE: 143