xref: /titanic_44/usr/src/lib/libdisasm/Makefile.com (revision f7184619589931c4b827180c213074c470f08a8f)
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#
2224da5b34Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23dc0093f4Seschrock# Use is subject to license terms.
24*f7184619SJoshua M. Clulow# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
25*f7184619SJoshua M. Clulow# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
26dc0093f4Seschrock#
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
35dc0093f4SeschrockLIBRARY=	libdisasm.a
36dc0093f4SeschrockSTANDLIBRARY=	libstanddisasm.so
37dc0093f4SeschrockVERS=		.1
38dc0093f4Seschrock
39dc0093f4Seschrock# By default, we build the shared library.  Construction of the standalone
40dc0093f4Seschrock# is specifically requested by architecture-specific Makefiles.
41dc0093f4SeschrockTYPES=		library
42dc0093f4SeschrockCURTYPE=	library
43dc0093f4Seschrock
44dc0093f4SeschrockCOMDIR=		$(SRC)/lib/libdisasm/common
45dc0093f4Seschrock
46dc0093f4Seschrock#
47*f7184619SJoshua M. Clulow# Architecture-independent files
48dc0093f4Seschrock#
49*f7184619SJoshua M. ClulowSRCS_common=		$(COMDIR)/libdisasm.c
50*f7184619SJoshua M. ClulowOBJECTS_common=		libdisasm.o
51dc0093f4Seschrock
52dc0093f4Seschrock#
53*f7184619SJoshua M. Clulow# Architecture-dependent disassembly files
54dc0093f4Seschrock#
55*f7184619SJoshua M. ClulowSRCS_i386=		$(COMDIR)/dis_i386.c \
56*f7184619SJoshua M. Clulow			$(SRC)/common/dis/i386/dis_tables.c
57*f7184619SJoshua M. ClulowSRCS_sparc=		$(COMDIR)/dis_sparc.c \
58*f7184619SJoshua M. Clulow			$(COMDIR)/dis_sparc_fmt.c \
59*f7184619SJoshua M. Clulow			$(COMDIR)/dis_sparc_instr.c
60dc0093f4Seschrock
61*f7184619SJoshua M. ClulowOBJECTS_i386=		dis_i386.o \
62*f7184619SJoshua M. Clulow			dis_tables.o
63*f7184619SJoshua M. ClulowOBJECTS_sparc=		dis_sparc.o \
64*f7184619SJoshua M. Clulow			dis_sparc_fmt.o \
65*f7184619SJoshua M. Clulow			dis_sparc_instr.o
66dc0093f4Seschrock
67*f7184619SJoshua M. Clulow#
68*f7184619SJoshua M. Clulow# We build the regular shared library with support for all architectures.
69*f7184619SJoshua M. Clulow# The standalone version should only contain code for the native
70*f7184619SJoshua M. Clulow# architecture to reduce the memory footprint of kmdb.
71*f7184619SJoshua M. Clulow#
72*f7184619SJoshua M. ClulowOBJECTS_library=	$(OBJECTS_common) \
73*f7184619SJoshua M. Clulow			$(OBJECTS_i386) \
74*f7184619SJoshua M. Clulow			$(OBJECTS_sparc)
75*f7184619SJoshua M. ClulowOBJECTS_standalone=	$(OBJECTS_common) \
76*f7184619SJoshua M. Clulow			$(OBJECTS_$(MACH))
77*f7184619SJoshua M. ClulowOBJECTS=		$(OBJECTS_$(CURTYPE))
78dc0093f4Seschrock
79dc0093f4Seschrockinclude $(SRC)/lib/Makefile.lib
80dc0093f4Seschrock
81*f7184619SJoshua M. ClulowSRCS_library=		$(SRCS_common) \
82*f7184619SJoshua M. Clulow			$(SRCS_i386) \
83*f7184619SJoshua M. Clulow			$(SRCS_sparc)
84*f7184619SJoshua M. ClulowSRCS_standalone=	$(SRCS_common) \
85*f7184619SJoshua M. Clulow			$(SRCS_$(MACH))
86*f7184619SJoshua M. ClulowSRCS=			$(SRCS_$(CURTYPE))
87dc0093f4Seschrock
88dc0093f4Seschrock#
89dc0093f4Seschrock# Used to verify that the standalone doesn't have any unexpected external
90dc0093f4Seschrock# dependencies.
91dc0093f4Seschrock#
92dc0093f4SeschrockLINKTEST_OBJ = objs/linktest_stand.o
93dc0093f4Seschrock
94dc0093f4SeschrockCLOBBERFILES_standalone = $(LINKTEST_OBJ)
95dc0093f4SeschrockCLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
96dc0093f4Seschrock
97dc0093f4SeschrockLIBS_standalone	= $(STANDLIBRARY)
98dc0093f4SeschrockLIBS_library = $(DYNLIB) $(LINTLIB)
99dc0093f4SeschrockLIBS = $(LIBS_$(CURTYPE))
100dc0093f4Seschrock
101f808c858SrafMAPFILES =	$(COMDIR)/mapfile-vers
102dc0093f4Seschrock
103dc0093f4SeschrockLDLIBS +=	-lc
104dc0093f4Seschrock
10524da5b34SrieLDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r
106dc0093f4SeschrockLDFLAGS = $(LDFLAGS_$(CURTYPE))
107dc0093f4Seschrock
108dc0093f4SeschrockASFLAGS_standalone = -DDIS_STANDALONE
109dc0093f4SeschrockASFLAGS_library =
110dc0093f4SeschrockASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
111dc0093f4Seschrock
112dc0093f4Seschrock$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
113dc0093f4Seschrock
1147014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
1157014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
1167014882cSRichard Lowe
117dc0093f4Seschrock# We want the thread-specific errno in the library, but we don't want it in
118dc0093f4Seschrock# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
119dc0093f4Seschrock# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
120dc0093f4Seschrock# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
121dc0093f4Seschrock# doesn't get it.
122dc0093f4SeschrockDTS_ERRNO=
123dc0093f4Seschrock
124*f7184619SJoshua M. ClulowCPPFLAGS_standalone = -DDIS_STANDALONE -I$(SRC)/cmd/mdb/common
125dc0093f4SeschrockCPPFLAGS_library = -D_REENTRANT
126dc0093f4SeschrockCPPFLAGS +=	-I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
127dc0093f4Seschrock
128*f7184619SJoshua M. Clulow# For the x86 disassembler we have to include sources from usr/src/common
129*f7184619SJoshua M. ClulowCPPFLAGS += -I$(SRC)/common/dis/i386 -DDIS_TEXT
130dc0093f4Seschrock
131dc0093f4SeschrockCFLAGS_standalone = $(STAND_FLAGS_32)
132dc0093f4SeschrockCFLAGS_common =
133dc0093f4SeschrockCFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
134dc0093f4Seschrock
135dc0093f4SeschrockCFLAGS64_standalone = $(STAND_FLAGS_64)
136dc0093f4SeschrockCFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
137dc0093f4Seschrock
138dc0093f4SeschrockDYNFLAGS +=     $(ZINTERPOSE)
139dc0093f4Seschrock
140dc0093f4Seschrock.KEEP_STATE:
141