xref: /titanic_44/usr/src/lib/libumem/Makefile.com (revision ea8dc4b6d2251b437950c0056bc626b311c73c27)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29#
30# The build process for libumem is sightly different from that used by other
31# libraries, because libumem must be built in two flavors - as a standalone
32# for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
33# current flavor being built.
34#
35
36LIBRARY = libumem.a
37STANDLIBRARY = libstandumem.so
38VERS = .1
39
40# By default, we build the shared library.  Construction of the standalone
41# is specifically requested by architecture-specific Makefiles.
42TYPES = library
43CURTYPE = library
44
45# This would be much prettier if a) Makefile.lib didn't reqire both $(SRCS) and
46# $(OBJECTS) to be set or b) make gave us a nice way to do basename in pattern
47# replacement definitions.
48
49# Files specific to the library version of libumem
50OBJECTS_library = \
51	init_lib.o \
52	umem_agent_support.o \
53	umem_fail.o \
54	umem_fork.o \
55	umem_update_thread.o \
56	vmem_mmap.o \
57	vmem_sbrk.o
58
59SRCS_library = $(OBJECTS_library:%.o=../common/%.c)
60
61# Files specific to the standalone version of libumem
62OBJECTS_standalone = \
63	init_stand.o \
64	stub_stand.o \
65	vmem_stand.o
66
67SRCS_standalone = $(OBJECTS_standalone:%.o=../common/%.c)
68
69# Architecture-dependent files common to both versions of libumem
70OBJECTS_common_isadep = \
71	asm_subr.o
72
73SRCS_common_isadep = \
74	$(ISASRCDIR)/asm_subr.s
75
76# Architecture-independent files common to both versions  of libumem
77OBJECTS_common_common = \
78	envvar.o \
79	getpcstack.o \
80	malloc.o \
81	misc.o \
82	vmem_base.o \
83	umem.o \
84	vmem.o
85
86SRCS_common_common = $(OBJECTS_common_common:%.o=../common/%.c)
87
88OBJECTS = \
89	$(OBJECTS_$(CURTYPE)) \
90	$(OBJECTS_common_isadep) \
91	$(OBJECTS_common_common)
92
93include ../../Makefile.lib
94include ../../Makefile.rootfs
95
96SRCS = \
97	$(SRCS_$(CURTYPE)) \
98	$(SRCS_common_isadep) \
99	$(SRCS_common_common)
100
101SRCDIR = ../common
102
103#
104# Used to verify that the standalone doesn't have any unexpected external
105# dependencies.
106#
107LINKTEST_OBJ = objs/linktest_stand.o
108
109CLOBBERFILES_standalone = $(LINKTEST_OBJ)
110CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
111
112LIBS_standalone = $(STANDLIBRARY)
113LIBS_library = $(DYNLIB) $(LINTLIB)
114LIBS =	$(LIBS_$(CURTYPE))
115
116MAPFILE_SUPPLEMENTAL_standalone = ../common/stand_mapfile
117MAPFILE_SUPPLEMENTAL = $(MAPFILE_SUPPLEMENTAL_$(CURTYPE))
118
119MAPDIR =	../spec/$(TRANSMACH)
120SPECMAPFILE =	$(MAPDIR)/mapfile
121
122LDLIBS +=	-lc
123
124LDFLAGS_standalone = -znoversion -Breduce -M $(SPECMAPFILE) \
125	-M $(MAPFILE_SUPPLEMENTAL) -dy -r
126LDFLAGS = $(LDFLAGS_$(CURTYPE))
127
128ASFLAGS_standalone = -DUMEM_STANDALONE
129ASFLAGS_library =
130ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
131
132$(LINTLIB) := SRCS = ../common/$(LINTSRC)
133
134# We want the thread-specific errno in the library, but we don't want it in
135# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
136# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
137# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
138# doesn't get it.
139DTS_ERRNO=
140
141# We need to rename some standard functions so we can easily implement them
142# in consumers.
143STAND_RENAMED_FUNCS= \
144	_atomic_add_64 \
145	_atomic_add_32_nv \
146	snprintf \
147	vsnprintf
148
149CPPFLAGS_standalone = -DUMEM_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=umem_%)
150CPPFLAGS_library = -D_REENTRANT
151CPPFLAGS +=	-I../common -I../../common/inc $(CPPFLAGS_$(CURTYPE))
152
153CFLAGS_standalone = $(STAND_FLAGS_32)
154CFLAGS_common =
155CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
156
157CFLAGS64_standalone = $(STAND_FLAGS_64)
158CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
159
160INSTALL_DEPS_library =		$(ROOTLINKS) $(ROOTLINT) $(ROOTLIBS)
161
162#
163# turn off ptr-cast warnings, since we do them all the time
164#
165LINTFLAGS +=	-erroff=E_BAD_PTR_CAST_ALIGN
166LINTFLAGS64 +=	-erroff=E_BAD_PTR_CAST_ALIGN
167
168DYNFLAGS +=     $(ZINTERPOSE)
169
170.KEEP_STATE:
171