xref: /titanic_50/usr/src/cmd/sgs/libelf/Makefile.targ (revision fe62dec3a38f1f79ffe68417df75dbbb58135bb7)
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
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) \
53		$(ROOTFS_LINTLIB) \
54		.WAIT $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES) \
55		$(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$(LIBLINKS):
70		$(RM) $(LIBLINKS)
71		$(SYMLINK) $(DYNLIB) $(LIBLINKS)
72
73# include common library targets
74#
75include		$(SRC)/lib/Makefile.targ
76include		$(SRC)/cmd/sgs/Makefile.targ
77
78xlate.c:	../common/xlate.m4
79		$(M4) < ../common/xlate.m4 > xlate.c
80
81xlate64.c:	../common/xlate64.m4
82		$(M4) < ../common/xlate64.m4 > xlate64.c
83
84
85objs/msg.o \
86pics/msg.o:	msg.c
87
88objs/error.o \
89pics/error.o:	msg.h
90
91objs/ar.o \
92pics/ar.o:	msg.h
93
94objs/xlate.o \
95pics/xlate.o:	xlate.c
96
97#
98# Targets needed to support running of Warlock. The old warlock can be
99# located at:
100#	suntools.eng:/export/tools/internal/warlock
101#
102# to use add the following to your path:
103#	export PATH=/net/suntools.eng/export/tools/internal/warlock/bin:$PATH
104#
105# The newer warlock is at:
106#	export PATH=/ws/onnv-gate/public/warlock/$MACH:$PATH
107#
108# This target has value for manual debugging, but is not suitable
109# for production use. For this reason, the necessary rules are commented
110# out with '###'. Remove the comments to use it.
111#
112###warlock := CFLAGS=
113###
114###.PARALLEL: $(WARLOCKFILES)
115###warlock: wlocks .WAIT warlock_files
116###	warlock -c ../common/libelf.wlcmd $(WARLOCKFILES)
117###
118###warlock_files: $(BLTSRCS) .WAIT $(WARLOCKFILES)
119###
120###wlocks:
121###	-@mkdir -p $@
122###
123###wlocks/%.ll:	%.c
124###	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
125###
126###wlocks/%.ll:	../misc/%.c
127###	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
128###
129###wlocks/%.ll:	../common/%.c
130###	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
131###
132###wlocks/%64.ll:	../common/%.c
133###	wlcc -D_ELF64 $(CFLAGS) $(CPPFLAGS) -o $@ $<
134
135
136# Special target for native builds (ie. when we need to build a version of ld
137# to build a version of ld :-).
138
139native:		$(SGSPROTO)/$(DYNLIB)
140
141native :=	CPPFLAGS += -DNATIVE_BUILD
142
143$(SGSPROTO)/$(DYNLIB): \
144		pics .WAIT $$(PICS)
145		$(BUILD.SO)
146		$(POST_PROCESS_SO)
147		-@$(RM) $(SGSPROTO)/$(LIBLINKS)
148		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
149
150
151# Derived source and header files (messaging).  Make sure that the sgsmsg
152# command is constructed - libelf might not be built with the whole sgs.
153
154catalog:	$(BLTMESG)
155
156chkmsg:		$(LIBSRCS)
157		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
158
159$(BLTDEFS) + \
160$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
161		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
162
163$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
164		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
165
166$(SGSMSG):	FRC
167		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
168		@ pwd
169
170FRC:
171