xref: /titanic_44/usr/src/cmd/sgs/libld/Makefile.targ (revision ba2be53024c0b999e74ba9adcd7d80fec5df8c57)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
55aefb655Srie# Common Development and Distribution License (the "License").
65aefb655Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
215aefb655Srie#
22*ba2be530Sab196087# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
235aefb655Srie# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatepics/%.o:	../common/%.c
297c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
307c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
317c478bd9Sstevel@tonic-gate
325aefb655Sriepics/%32.o:	../common/%.c
33*ba2be530Sab196087		$(COMPILE.c) -o $@ $<
345aefb655Srie		$(POST_PROCESS_O)
355aefb655Srie
365aefb655Sriepics/%64.o:	../common/%.c
37*ba2be530Sab196087		$(COMPILE.c) -o $@ -D_ELF64 $<
385aefb655Srie		$(POST_PROCESS_O)
395aefb655Srie
405aefb655Sriepics/%32.o:	%.c
41*ba2be530Sab196087		$(COMPILE.c) -o $@ $<
425aefb655Srie		$(POST_PROCESS_O)
435aefb655Srie
445aefb655Sriepics/%64.o:	%.c
45*ba2be530Sab196087		$(COMPILE.c) -o $@ -D_ELF64 $<
465aefb655Srie		$(POST_PROCESS_O)
475aefb655Srie
485aefb655Sriepics/%.o:	$(SGSTOOLS)/common/%.c
497c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
507c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
517c478bd9Sstevel@tonic-gate
525aefb655Sriepics/%.o:	$(VAR_AVLDIR)/%.c
537c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
547c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
557c478bd9Sstevel@tonic-gate
565aefb655Srie#
57*ba2be530Sab196087# We use the shared elfcap code under usr/src/common/elfcap
58*ba2be530Sab196087#
595aefb655Sriepics/elfcap.o:	$(ELFCAP)/elfcap.c
6099f63845Sab196087		$(COMPILE.c) -o  $@ $(ELFCAP)/elfcap.c
617c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
627c478bd9Sstevel@tonic-gate
63*ba2be530Sab196087# Rules for compiling the shared relocation engines (doreloc.c) maintained
64*ba2be530Sab196087# under usr/src/uts. To support cross linking, We compile and link
65*ba2be530Sab196087# all of these into every copy of libld. Each one requires a separate rule:
66*ba2be530Sab196087#	- The source files are in different subtrees under usr/src/uts
67*ba2be530Sab196087#	- The output file needs to include the platform name to
68*ba2be530Sab196087#		keep the object files from colliding
69*ba2be530Sab196087# The DO_RELOC_LIBLD definition is needed to generate the libld version
70*ba2be530Sab196087# of the doreloc code.
71*ba2be530Sab196087#
72*ba2be530Sab196087pics/%_x86_32.o: $(KRTLD_I386)/%.c
73*ba2be530Sab196087		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
74*ba2be530Sab196087		$(POST_PROCESS_O)
75*ba2be530Sab196087
76*ba2be530Sab196087pics/%_x86_64.o: $(KRTLD_AMD64)/%.c
77*ba2be530Sab196087		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
78*ba2be530Sab196087		$(POST_PROCESS_O)
79*ba2be530Sab196087
80*ba2be530Sab196087pics/%_sparc_32.o: $(KRTLD_SPARC)/%.c
81*ba2be530Sab196087		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
82*ba2be530Sab196087		$(POST_PROCESS_O)
83*ba2be530Sab196087
84*ba2be530Sab196087pics/%_sparc_64.o: \
85*ba2be530Sab196087		$(KRTLD_SPARC)/%.c
86*ba2be530Sab196087		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
87*ba2be530Sab196087		$(POST_PROCESS_O)
88*ba2be530Sab196087
89*ba2be530Sab196087
907c478bd9Sstevel@tonic-gate$(LIBLINKS):
917c478bd9Sstevel@tonic-gate		$(RM) $@; $(SYMLINK) $(DYNLIB) $@
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gatedelete:
947c478bd9Sstevel@tonic-gate		$(RM) $(DYNLIB)
957c478bd9Sstevel@tonic-gate
965aefb655Srie.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
975aefb655Srie
985aefb655Srielint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
995aefb655Srie		    .WAIT $(SGSLINTOUT)
1005aefb655Srie
1017c478bd9Sstevel@tonic-gate# Special target for native builds (ie. when we need to build a version of ld
1027c478bd9Sstevel@tonic-gate# to build a version of ld :-).
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gatenative:		$(SGSPROTO)/$(DYNLIB)
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate$(SGSPROTO)/$(DYNLIB): \
107f808c858Sraf		pics .WAIT $$(PICS)
1087c478bd9Sstevel@tonic-gate		$(BUILD.SO)
1097c478bd9Sstevel@tonic-gate		$(POST_PROCESS_SO)
1107c478bd9Sstevel@tonic-gate		@$(RM) $(SGSPROTO)/$(LIBLINKS)
1117c478bd9Sstevel@tonic-gate		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateinclude		$(SRC)/lib/Makefile.targ
1147c478bd9Sstevel@tonic-gateinclude		$(SRC)/cmd/sgs/Makefile.targ
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate# Derived source and header files (messaging).
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gatecatalog:	$(BLTMESG)
1197c478bd9Sstevel@tonic-gate
1205aefb655Sriechkmsg:		$(LIBSRCS) $(CHKSRCS)
1217c478bd9Sstevel@tonic-gate		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gate$(BLTDEFS) + \
1247c478bd9Sstevel@tonic-gate$(BLTDATA):	$(SGSMSGTARG)
1257c478bd9Sstevel@tonic-gate		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate$(BLTMESG):	$(SGSMSGALL)
1287c478bd9Sstevel@tonic-gate		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
129