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