xref: /titanic_50/usr/src/lib/libdisasm/Makefile.com (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26
27#
28# The build process for libdisasm is sightly different from that used by other
29# libraries, because libdisasm must be built in two flavors - as a standalone
30# for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
31# current flavor being built.
32#
33# The SPARC library is built from the closed gate.  This Makefile is shared
34# between both environments, so all paths must be absolute.
35#
36
37LIBRARY=	libdisasm.a
38STANDLIBRARY=	libstanddisasm.so
39VERS=		.1
40
41# By default, we build the shared library.  Construction of the standalone
42# is specifically requested by architecture-specific Makefiles.
43TYPES=		library
44CURTYPE=	library
45
46COMDIR=		$(SRC)/lib/libdisasm/common
47SPECDIR=	$(SRC)/lib/libdisasm/spec
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
54
55SRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
56SRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c
57
58#
59# Architecture-independent files common to both version of libdisasm
60#
61OBJECTS_common_common = libdisasm.o
62SRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)
63
64
65OBJECTS=				\
66	$(OBJECTS_common_$(MACH))	\
67	$(OBJECTS_common_common)
68
69include $(SRC)/lib/Makefile.lib
70
71SRCS=					\
72	$(SRCS_$(CURTYPE))		\
73	$(SRCS_common_$(MACH))		\
74	$(SRCS_common_common)
75
76#
77# Used to verify that the standalone doesn't have any unexpected external
78# dependencies.
79#
80LINKTEST_OBJ = objs/linktest_stand.o
81
82CLOBBERFILES_standalone = $(LINKTEST_OBJ)
83CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
84
85LIBS_standalone	= $(STANDLIBRARY)
86LIBS_library = $(DYNLIB) $(LINTLIB)
87LIBS = $(LIBS_$(CURTYPE))
88
89MAPDIR=		$(SPECDIR)/$(TRANSMACH)
90SPECMAPFILE=	$(MAPDIR)/mapfile
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	-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