xref: /titanic_52/usr/src/cmd/sgs/libld/amd64/Makefile (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29BASEPLAT=	amd64
30
31include		$(SRC)/cmd/sgs/libld/Makefile.com
32
33#
34# Share machsym.c with the 32-bit i386 directory since
35# they both need the Elf32 and the Elf64 code.
36#
37L_MACHSRCS32=	../i386/machrel.c ../i386/machsym.c
38L_MACHSRCS64 =	machrel.c ../i386/machsym.c \
39		amd64unwind.c ../../tools/common/leb128.c
40
41CHKSRCS +=	machrel.c ../i386/machrel.c amd64unwind.c \
42		../../tools/common/leb128.c
43
44LIB64=		libld.so.3
45$(LIB64) :=	SONAME = $(LIB64)
46
47DBGLIB =	-L ../../liblddbg/$(MACH64)
48CONVLIB =	-L ../../libconv/$(MACH64)
49ELFLIB =	-L ../../libelf/$(MACH64)
50DYNFLAGS +=	$(DBGLIB) $(CONVLIB) $(ELFLIB)
51
52SGSMSGTARG +=	$(SGSMSGINTEL)
53
54.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
55
56PICS64=		$(OBJECTS:%=pics64/%) pics64/amd64unwind.o pics64/leb128.o
57$(PICS64) :=	amd64_CFLAGS += $(C_PICFLAGS)
58CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64)
59$(PICS64)  :=	CFLAGS += $(CTF_FLAGS)
60$(PICS64)  :=	CFLAGS64 += $(CTF_FLAGS)
61$(PICS64)  :=	CTFCONVERT_POST = $(CTFCONVERT_O)
62$(LIB64)   :=	CTFMERGE_POST = $(CTFMERGE_LIB64)
63$(PICS64) :=    CPPFLAGS += -I../../../../uts/intel/amd64/krtld
64$(PICS64) :=	CPPFLAGS += -DELF_TARGET_AMD64
65$(PICS) :=      CPPFLAGS += -I../../../../uts/intel/ia32/krtld
66$(PICS) :=	CPPFLAGS += -DELF_TARGET_386
67
68.PARALLEL:	$(PICS64)
69
70ROOTFS_LIBDIR=		$(VAR_LIBLD_64_ROOTFS_LIBDIR)
71ROOTFS_DYNLIB64=	$(ROOTFS_LIBDIR)/$(LIB64)
72$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
73
74$(LINTOUT32) :=	CPPFLAGS += -I../../../../uts/intel/ia32/krtld \
75		-DELF_TARGET_386
76$(LINTOUT64) :=	CPPFLAGS += -I../../../../uts/intel/amd64/krtld \
77		-DELF_TARGET_AMD64
78.KEEP_STATE:
79
80all:		$(DYNLIB) $(LIBLINKS) $(LIB64)
81
82
83LINK.LIB64 = $(CC) $(amd64_CFLAGS) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS)
84$(LIB64) $(SGSPROTO)/$(LIB64): pics64 .WAIT $$(PICS64) $(MAPFILES)
85	$(LINK.LIB64)
86	$(POST_PROCESS_SO)
87
88lint:		$(LINTLIB64) $(LINTOUT64)
89
90native:		$(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64)
91
92native-proto:
93		-@mkdir -p proto/$(MACH) proto/$(MACH64)
94
95pics64:
96		-@mkdir -p $@
97
98
99install package:	all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64)
100
101
102clean: clean64
103
104clean64:
105	-$(RM) $(PICS64)
106
107clobber: clobber64
108clobber64:
109	-$(RM) $(LIB64)
110
111delete:
112		$(RM) $(DYNLIB) $(LIB64)
113
114#
115# Grab 32bit i386 files for libld.so.2
116#
117pics/machrel.o:	../i386/machrel.c
118		$(COMPILE.c) -o $@ -D_ELF32 ../i386/machrel.c
119		$(POST_PROCESS_O)
120
121pics/machsym.o:	../i386/machsym.c
122		$(COMPILE.c) -o $@ -D_ELF32 ../i386/machsym.c
123		$(POST_PROCESS_O)
124
125pics64/machsym.o:	../i386/machsym.c
126		$(COMPILE.c) -o $@ -D_ELF64 ../i386/machsym.c
127		$(POST_PROCESS_O)
128
129
130include		$(SRC)/cmd/sgs/libld/Makefile.targ
131include		../../Makefile.sub.64
132
133$(LIBLINKS) :=	DYNLIB=$(LIB64)
134
135pics64/%.o:	$(SRCBASE)/uts/intel/amd64/krtld/%.c
136		$(COMPILE.c) -o $@ -D_ELF64 $<
137		$(POST_PROCESS_O)
138
139pics/%.o:	$(SRCBASE)/uts/intel/ia32/krtld/%.c
140		$(COMPILE.c) -o $@ $<
141		$(POST_PROCESS_O)
142