xref: /titanic_51/usr/src/lib/libdisasm/Makefile.com (revision 193974072f41a843678abf5f61979c748687e66b)
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#
25# ident	"%Z%%M%	%I%	%E% SMI"
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# The SPARC library is built from the closed gate.  This Makefile is shared
35# between both environments, so all paths must be absolute.
36#
37
38LIBRARY=	libdisasm.a
39STANDLIBRARY=	libstanddisasm.so
40VERS=		.1
41
42# By default, we build the shared library.  Construction of the standalone
43# is specifically requested by architecture-specific Makefiles.
44TYPES=		library
45CURTYPE=	library
46
47COMDIR=		$(SRC)/lib/libdisasm/common
48
49#
50# Architecture-dependent files common to both versions of libdisasm
51#
52OBJECTS_common_i386 = dis_i386.o dis_tables.o
53OBJECTS_common_sparc = dis_sparc.o instr.o dis_sparc_fmt.o
54
55SRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
56SRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c $(ISASRCDIR)/instr.c \
57	$(ISASRCDIR)/dis_sparc_fmt.c
58
59#
60# Architecture-independent files common to both version of libdisasm
61#
62OBJECTS_common_common = libdisasm.o
63SRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)
64
65
66OBJECTS=				\
67	$(OBJECTS_common_$(MACH))	\
68	$(OBJECTS_common_common)
69
70include $(SRC)/lib/Makefile.lib
71
72SRCS=					\
73	$(SRCS_$(CURTYPE))		\
74	$(SRCS_common_$(MACH))		\
75	$(SRCS_common_common)
76
77#
78# Used to verify that the standalone doesn't have any unexpected external
79# dependencies.
80#
81LINKTEST_OBJ = objs/linktest_stand.o
82
83CLOBBERFILES_standalone = $(LINKTEST_OBJ)
84CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
85
86LIBS_standalone	= $(STANDLIBRARY)
87LIBS_library = $(DYNLIB) $(LINTLIB)
88LIBS = $(LIBS_$(CURTYPE))
89
90MAPFILES =	$(COMDIR)/mapfile-vers
91
92LDLIBS +=	-lc
93
94LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r
95LDFLAGS = $(LDFLAGS_$(CURTYPE))
96
97ASFLAGS_standalone = -DDIS_STANDALONE
98ASFLAGS_library =
99ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
100
101$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
102
103# We want the thread-specific errno in the library, but we don't want it in
104# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
105# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
106# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
107# doesn't get it.
108DTS_ERRNO=
109
110# We need to rename some standard functions so we can easily implement them
111# in consumers.
112STAND_RENAMED_FUNCS= \
113	snprintf
114
115CPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \
116	-Dvsnprintf=mdb_iob_vsnprintf -I$(SRC)/cmd/mdb/common
117CPPFLAGS_library = -D_REENTRANT
118CPPFLAGS +=	-I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
119
120#
121# For x86, we have to link to sources in usr/src/common
122#
123CPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT
124CPPFLAGS_dis_sparc =
125CPPFLAGS +=	$(CPPFLAGS_dis_$(MACH))
126
127CFLAGS_standalone = $(STAND_FLAGS_32)
128CFLAGS_common =
129CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
130
131CFLAGS64_standalone = $(STAND_FLAGS_64)
132CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
133
134DYNFLAGS +=     $(ZINTERPOSE)
135
136.KEEP_STATE:
137