xref: /titanic_50/usr/src/lib/libdisasm/Makefile.com (revision dc0093f44ee4fac928e006850f8ed53f68277af5)
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# Files specific to the library version of libdisasm
50OBJECTS_library =
51SRC_libary = $(OBJECTS_library:%.o=$(COMDIR)/%.c)
52
53#
54# Architecture-dependent files common to both versions of libdisasm
55#
56OBJECTS_common_i386 = dis_i386.o dis_tables.o
57OBJECTS_common_sparc = dis_sparc.o
58
59SRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
60SRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c
61
62#
63# Architecture-independent files common to both version of libdisasm
64#
65OBJECTS_common_common = libdisasm.o
66SRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)
67
68
69OBJECTS=				\
70	$(OBJECTS_$(CURTYPE))		\
71	$(OBJECTS_common_$(MACH))	\
72	$(OBJECTS_common_common)
73
74include $(SRC)/lib/Makefile.lib
75
76SRCS=					\
77	$(SRCS_$(CURTYPE))		\
78	$(SRCS_common_$(MACH))		\
79	$(SRCS_common_common)
80
81#
82# Used to verify that the standalone doesn't have any unexpected external
83# dependencies.
84#
85LINKTEST_OBJ = objs/linktest_stand.o
86
87CLOBBERFILES_standalone = $(LINKTEST_OBJ)
88CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
89
90LIBS_standalone	= $(STANDLIBRARY)
91LIBS_library = $(DYNLIB) $(LINTLIB)
92LIBS = $(LIBS_$(CURTYPE))
93
94MAPDIR=		$(SPECDIR)/$(TRANSMACH)
95SPECMAPFILE=	$(MAPDIR)/mapfile
96
97LDLIBS +=	-lc
98
99LDFLAGS_standalone = -znoversion -Breduce -dy -r
100LDFLAGS = $(LDFLAGS_$(CURTYPE))
101
102ASFLAGS_standalone = -DDIS_STANDALONE
103ASFLAGS_library =
104ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
105
106$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
107
108# We want the thread-specific errno in the library, but we don't want it in
109# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
110# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
111# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
112# doesn't get it.
113DTS_ERRNO=
114
115# We need to rename some standard functions so we can easily implement them
116# in consumers.
117STAND_RENAMED_FUNCS= \
118	snprintf
119
120CPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \
121	-I$(SRC)/cmd/mdb/common
122CPPFLAGS_library = -D_REENTRANT
123CPPFLAGS +=	-I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
124
125#
126# For x86, we have to link to sources in usr/src/common
127#
128CPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT
129CPPFLAGS_dis_sparc =
130CPPFLAGS +=	$(CPPFLAGS_dis_$(MACH))
131
132CFLAGS_standalone = $(STAND_FLAGS_32)
133CFLAGS_common =
134CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
135
136CFLAGS64_standalone = $(STAND_FLAGS_64)
137CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
138
139DYNFLAGS +=     $(ZINTERPOSE)
140
141.KEEP_STATE:
142