xref: /titanic_41/usr/src/lib/libdisasm/Makefile.com (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
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.
24dc0093f4Seschrock#
25dc0093f4Seschrock
26dc0093f4Seschrock#
27dc0093f4Seschrock# The build process for libdisasm is sightly different from that used by other
28dc0093f4Seschrock# libraries, because libdisasm must be built in two flavors - as a standalone
29dc0093f4Seschrock# for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
30dc0093f4Seschrock# current flavor being built.
31dc0093f4Seschrock#
32dc0093f4Seschrock# The SPARC library is built from the closed gate.  This Makefile is shared
33dc0093f4Seschrock# between both environments, so all paths must be absolute.
34dc0093f4Seschrock#
35dc0093f4Seschrock
36dc0093f4SeschrockLIBRARY=	libdisasm.a
37dc0093f4SeschrockSTANDLIBRARY=	libstanddisasm.so
38dc0093f4SeschrockVERS=		.1
39dc0093f4Seschrock
40dc0093f4Seschrock# By default, we build the shared library.  Construction of the standalone
41dc0093f4Seschrock# is specifically requested by architecture-specific Makefiles.
42dc0093f4SeschrockTYPES=		library
43dc0093f4SeschrockCURTYPE=	library
44dc0093f4Seschrock
45dc0093f4SeschrockCOMDIR=		$(SRC)/lib/libdisasm/common
46dc0093f4Seschrock
47dc0093f4Seschrock#
48dc0093f4Seschrock# Architecture-dependent files common to both versions of libdisasm
49dc0093f4Seschrock#
50dc0093f4SeschrockOBJECTS_common_i386 = dis_i386.o dis_tables.o
51a2bb96e7SjmcpOBJECTS_common_sparc = dis_sparc.o instr.o dis_sparc_fmt.o
52dc0093f4Seschrock
53dc0093f4SeschrockSRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
54a2bb96e7SjmcpSRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c $(ISASRCDIR)/instr.c \
55a2bb96e7Sjmcp	$(ISASRCDIR)/dis_sparc_fmt.c
56dc0093f4Seschrock
57dc0093f4Seschrock#
58dc0093f4Seschrock# Architecture-independent files common to both version of libdisasm
59dc0093f4Seschrock#
60dc0093f4SeschrockOBJECTS_common_common = libdisasm.o
61dc0093f4SeschrockSRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)
62dc0093f4Seschrock
63dc0093f4Seschrock
64dc0093f4SeschrockOBJECTS=				\
65dc0093f4Seschrock	$(OBJECTS_common_$(MACH))	\
66dc0093f4Seschrock	$(OBJECTS_common_common)
67dc0093f4Seschrock
68dc0093f4Seschrockinclude $(SRC)/lib/Makefile.lib
69dc0093f4Seschrock
70dc0093f4SeschrockSRCS=					\
71dc0093f4Seschrock	$(SRCS_$(CURTYPE))		\
72dc0093f4Seschrock	$(SRCS_common_$(MACH))		\
73dc0093f4Seschrock	$(SRCS_common_common)
74dc0093f4Seschrock
75dc0093f4Seschrock#
76dc0093f4Seschrock# Used to verify that the standalone doesn't have any unexpected external
77dc0093f4Seschrock# dependencies.
78dc0093f4Seschrock#
79dc0093f4SeschrockLINKTEST_OBJ = objs/linktest_stand.o
80dc0093f4Seschrock
81dc0093f4SeschrockCLOBBERFILES_standalone = $(LINKTEST_OBJ)
82dc0093f4SeschrockCLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
83dc0093f4Seschrock
84dc0093f4SeschrockLIBS_standalone	= $(STANDLIBRARY)
85dc0093f4SeschrockLIBS_library = $(DYNLIB) $(LINTLIB)
86dc0093f4SeschrockLIBS = $(LIBS_$(CURTYPE))
87dc0093f4Seschrock
88f808c858SrafMAPFILES =	$(COMDIR)/mapfile-vers
89dc0093f4Seschrock
90dc0093f4SeschrockLDLIBS +=	-lc
91dc0093f4Seschrock
9224da5b34SrieLDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r
93dc0093f4SeschrockLDFLAGS = $(LDFLAGS_$(CURTYPE))
94dc0093f4Seschrock
95dc0093f4SeschrockASFLAGS_standalone = -DDIS_STANDALONE
96dc0093f4SeschrockASFLAGS_library =
97dc0093f4SeschrockASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
98dc0093f4Seschrock
99dc0093f4Seschrock$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
100dc0093f4Seschrock
101*7014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
102*7014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
103*7014882cSRichard Lowe
104dc0093f4Seschrock# We want the thread-specific errno in the library, but we don't want it in
105dc0093f4Seschrock# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
106dc0093f4Seschrock# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
107dc0093f4Seschrock# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
108dc0093f4Seschrock# doesn't get it.
109dc0093f4SeschrockDTS_ERRNO=
110dc0093f4Seschrock
111dc0093f4Seschrock# We need to rename some standard functions so we can easily implement them
112dc0093f4Seschrock# in consumers.
113dc0093f4SeschrockSTAND_RENAMED_FUNCS= \
114dc0093f4Seschrock	snprintf
115dc0093f4Seschrock
116dc0093f4SeschrockCPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \
117a2bb96e7Sjmcp	-Dvsnprintf=mdb_iob_vsnprintf -I$(SRC)/cmd/mdb/common
118dc0093f4SeschrockCPPFLAGS_library = -D_REENTRANT
119dc0093f4SeschrockCPPFLAGS +=	-I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
120dc0093f4Seschrock
121dc0093f4Seschrock#
122dc0093f4Seschrock# For x86, we have to link to sources in usr/src/common
123dc0093f4Seschrock#
124dc0093f4SeschrockCPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT
125dc0093f4SeschrockCPPFLAGS_dis_sparc =
126dc0093f4SeschrockCPPFLAGS +=	$(CPPFLAGS_dis_$(MACH))
127dc0093f4Seschrock
128dc0093f4SeschrockCFLAGS_standalone = $(STAND_FLAGS_32)
129dc0093f4SeschrockCFLAGS_common =
130dc0093f4SeschrockCFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
131dc0093f4Seschrock
132dc0093f4SeschrockCFLAGS64_standalone = $(STAND_FLAGS_64)
133dc0093f4SeschrockCFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
134dc0093f4Seschrock
135dc0093f4SeschrockDYNFLAGS +=     $(ZINTERPOSE)
136dc0093f4Seschrock
137dc0093f4Seschrock.KEEP_STATE:
138