xref: /titanic_51/usr/src/cmd/sgs/libelf/Makefile.targ (revision 20e0c306d13b54840b7f8b12a43090fcb2bdbc04)
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#
23# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29$(VAR_POUND_2)LIBS +=	$(LIBRARY)
30
31objs/%.o \
32pics/%.o:	%.c
33		$(COMPILE.c) -o $@ $<
34		$(POST_PROCESS_O)
35
36objs/%64.o \
37pics/%64.o:	../common/%.c
38		$(COMPILE.c) -D_ELF64 -o $@ $<
39		$(POST_PROCESS_O)
40
41objs/%.o \
42pics/%.o:	../misc/%.c
43		$(COMPILE.c) -DELF -o $@ $<
44		$(POST_PROCESS_O)
45
46objs/%.o \
47pics/%.o:	../common/%.c
48		$(COMPILE.c) -o $@ $<
49		$(POST_PROCESS_O)
50
51all:		$(BLTSRCS) .WAIT $(LIBS) $(LIBLINKS)
52
53install:	all .WAIT $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTDEMODIR) \
54		$(ROOTFS_LINTLIB) \
55		.WAIT $(ROOTDEMOFILES) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
56
57$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
58$(VAR_POUND_1)	$(INS.file) ../common/$(LINTLIBSRC)
59
60lint:		$(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT)
61
62$(VAR_POUND_2)lint :=		LIBTHREADFLAG=-lthread
63
64.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
65
66delete:
67		$(RM) $(DYNLIB)
68
69$(DYNLIB):	$$(MAPFILES)
70
71$(LIBLINKS):
72		$(RM) $(LIBLINKS)
73		$(SYMLINK) $(DYNLIB) $(LIBLINKS)
74
75# include common library targets
76#
77include		$(SRC)/lib/Makefile.targ
78include		$(SRC)/cmd/sgs/Makefile.targ
79
80
81$(ROOTDEMODIR):
82		$(INS.dir)
83
84$(ROOTDEMODIR)/%:	../demo/%
85		$(INS.file)
86
87xlate.c:	../common/xlate.m4
88		$(M4) < ../common/xlate.m4 > xlate.c
89
90xlate64.c:	../common/xlate64.m4
91		$(M4) < ../common/xlate64.m4 > xlate64.c
92
93
94objs/msg.o \
95pics/msg.o:	msg.c
96
97objs/error.o \
98pics/error.o:	msg.h
99
100objs/ar.o \
101pics/ar.o:	msg.h
102
103objs/xlate.o \
104pics/xlate.o:	xlate.c
105
106#
107# Targets needed to support running of Warlock, warlock can be
108# located at:
109#	suntools.eng:/export/tools/internal/warlock
110#
111# to use add the following to your path:
112#	export PATH=/net/suntools.eng/export/tools/internal/warlock/bin:$PATH
113#
114.PARALLEL: $(WARLOCKFILES)
115warlock: wlocks .WAIT warlock_files
116	warlock -c ../common/libelf.wlcmd $(WARLOCKFILES)
117
118warlock_files: $(BLTSRCS) .WAIT $(WARLOCKFILES)
119
120wlocks:
121	-@mkdir -p $@
122
123wlocks/%.ll:	%.c
124	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
125
126wlocks/%.ll:	../misc/%.c
127	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
128
129wlocks/%.ll:	../common/%.c
130	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
131
132
133# Special target for native builds (ie. when we need to build a version of ld
134# to build a version of ld :-).
135
136native:		$(SGSPROTO)/$(DYNLIB)
137
138$(SGSPROTO)/$(DYNLIB): \
139		pics .WAIT $$(PICS) $(MAPFILES)
140		$(BUILD.SO)
141		$(POST_PROCESS_SO)
142		-@$(RM) $(SGSPROTO)/$(LIBLINKS)
143		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
144
145
146# Derived source and header files (messaging).  Make sure that the sgsmsg
147# command is constructed - libelf might not be built with the whole sgs.
148
149catalog:	$(BLTMESG)
150
151chkmsg:		$(LIBSRCS)
152		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
153
154$(BLTDEFS) + \
155$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
156		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
157
158$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
159		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
160
161$(SGSMSG):	FRC
162		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
163		@ pwd
164
165FRC:
166