xref: /titanic_44/usr/src/cmd/sgs/libld/Makefile.targ (revision db8b037b5616a366b7dfdc01ef9552f02f9adfdd)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28pics/%.o:	../common/%.c
29		$(COMPILE.c) -o $@ $<
30		$(POST_PROCESS_O)
31
32pics/%32.o:	../common/%.c
33		$(COMPILE.c) -o $@ $<
34		$(POST_PROCESS_O)
35
36pics/%64.o:	../common/%.c
37		$(COMPILE.c) -o $@ -D_ELF64 $<
38		$(POST_PROCESS_O)
39
40pics/%32.o:	%.c
41		$(COMPILE.c) -o $@ $<
42		$(POST_PROCESS_O)
43
44pics/%64.o:	%.c
45		$(COMPILE.c) -o $@ -D_ELF64 $<
46		$(POST_PROCESS_O)
47
48pics/%.o:	$(SGSTOOLS)/common/%.c
49		$(COMPILE.c) -o $@ $<
50		$(POST_PROCESS_O)
51
52pics/%.o:	$(VAR_AVLDIR)/%.c
53		$(COMPILE.c) -o $@ $<
54		$(POST_PROCESS_O)
55
56#
57# We use the shared elfcap code under usr/src/common/elfcap
58#
59pics/elfcap.o:	$(ELFCAP)/elfcap.c
60		$(COMPILE.c) -o  $@ $(ELFCAP)/elfcap.c
61		$(POST_PROCESS_O)
62
63# Rules for compiling the shared relocation engines (doreloc.c) maintained
64# under usr/src/uts. To support cross linking, We compile and link
65# all of these into every copy of libld. Each one requires a separate rule:
66#	- The source files are in different subtrees under usr/src/uts
67#	- The output file needs to include the platform name to
68#		keep the object files from colliding
69# The DO_RELOC_LIBLD definition is needed to generate the libld version
70# of the doreloc code.
71#
72pics/%_x86_32.o: $(KRTLD_I386)/%.c
73		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
74		$(POST_PROCESS_O)
75
76pics/%_x86_64.o: $(KRTLD_AMD64)/%.c
77		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
78		$(POST_PROCESS_O)
79
80pics/%_sparc_32.o: $(KRTLD_SPARC)/%.c
81		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
82		$(POST_PROCESS_O)
83
84pics/%_sparc_64.o: \
85		$(KRTLD_SPARC)/%.c
86		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
87		$(POST_PROCESS_O)
88
89
90$(LIBLINKS):
91		$(RM) $@; $(SYMLINK) $(DYNLIB) $@
92
93delete:
94		$(RM) $(DYNLIB)
95
96.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
97
98lint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
99		    .WAIT $(SGSLINTOUT)
100
101# Special target for native builds (ie. when we need to build a version of ld
102# to build a version of ld :-).
103
104native:		$(SGSPROTO)/$(DYNLIB)
105
106$(SGSPROTO)/$(DYNLIB): \
107		pics .WAIT $$(PICS)
108		$(BUILD.SO)
109		$(POST_PROCESS_SO)
110		@$(RM) $(SGSPROTO)/$(LIBLINKS)
111		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
112
113include		$(SRC)/lib/Makefile.targ
114include		$(SRC)/cmd/sgs/Makefile.targ
115
116# Derived source and header files (messaging).
117
118catalog:	$(BLTMESG)
119
120chkmsg:		$(LIBSRCS) $(CHKSRCS)
121		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
122
123$(BLTDEFS) + \
124$(BLTDATA):	$(SGSMSGTARG)
125		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
126
127$(BLTMESG):	$(SGSMSGALL)
128		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
129