xref: /illumos-gate/usr/src/cmd/sgs/libld/Makefile.targ (revision 3665ce8aeee26b1a84fb98951ef011e0779e1ae2)
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# Copyright 2016 RackTop Systems.
26# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
27#
28
29pics/%.o:	$(SRCDIR)/common/%.c
30		$(COMPILE.c) -o $@ $<
31		$(POST_PROCESS_O)
32
33pics/%32.o:	$(SRCDIR)/common/%.c
34		$(COMPILE.c) -o $@ $<
35		$(POST_PROCESS_O)
36
37pics/%64.o:	$(SRCDIR)/common/%.c
38		$(COMPILE.c) -o $@ -D_ELF64 $<
39		$(POST_PROCESS_O)
40
41pics/%32.o:	%.c
42		$(COMPILE.c) -o $@ $<
43		$(POST_PROCESS_O)
44
45pics/%64.o:	%.c
46		$(COMPILE.c) -o $@ -D_ELF64 $<
47		$(POST_PROCESS_O)
48
49pics/%.o:	$(SGSCOMMON)/%.c
50		$(COMPILE.c) -o $@ $<
51		$(POST_PROCESS_O)
52
53pics/%.o:	$(VAR_AVLDIR)/%.c
54		$(COMPILE.c) -o $@ $<
55		$(POST_PROCESS_O)
56
57#
58# We use the shared elfcap code under usr/src/common/elfcap
59#
60pics/elfcap.o:	$(ELFCAP)/elfcap.c
61		$(COMPILE.c) -o  $@ $(ELFCAP)/elfcap.c
62		$(POST_PROCESS_O)
63
64# Rules for compiling the shared relocation engines (doreloc.c) maintained
65# under usr/src/uts. To support cross linking, We compile and link
66# all of these into every copy of libld. Each one requires a separate rule:
67#	- The source files are in different subtrees under usr/src/uts
68#	- The output file needs to include the platform name to
69#		keep the object files from colliding
70# The DO_RELOC_LIBLD definition is needed to generate the libld version
71# of the doreloc code.
72#
73pics/%_x86_32.o: $(KRTLD_I386)/%.c
74		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
75		$(POST_PROCESS_O)
76
77pics/%_x86_64.o: $(KRTLD_AMD64)/%.c
78		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
79		$(POST_PROCESS_O)
80
81pics/%_sparc_32.o: $(KRTLD_SPARC)/%.c
82		$(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
83		$(POST_PROCESS_O)
84
85pics/%_sparc_64.o: \
86		$(KRTLD_SPARC)/%.c
87		$(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
88		$(POST_PROCESS_O)
89
90
91$(LIBLINKS):
92		$(RM) $@; $(SYMLINK) $(DYNLIB) $@
93
94delete:
95		$(RM) $(DYNLIB)
96
97$(PICS):	pics
98
99include		$(SRC)/lib/Makefile.targ
100include		$(SRC)/cmd/sgs/Makefile.targ
101
102# Derived source and header files (messaging).
103
104catalog:	$(BLTMESG)
105
106chkmsg:		$(LIBSRCS) $(CHKSRCS)
107		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
108
109$(BLTDEFS) + \
110$(BLTDATA):	$(SGSMSGTARG)
111		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
112
113$(BLTMESG):	$(SGSMSGALL)
114		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
115