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