xref: /titanic_44/usr/src/cmd/sgs/libelf/Makefile.targ (revision 0398691684c2596072212e4ca9d7033ad7ccfa54)
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 2007 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, 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.PARALLEL: $(WARLOCKFILES)
106warlock: wlocks .WAIT warlock_files
107	warlock -c ../common/libelf.wlcmd $(WARLOCKFILES)
108
109warlock_files: $(BLTSRCS) .WAIT $(WARLOCKFILES)
110
111wlocks:
112	-@mkdir -p $@
113
114wlocks/%.ll:	%.c
115	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
116
117wlocks/%.ll:	../misc/%.c
118	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
119
120wlocks/%.ll:	../common/%.c
121	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
122
123
124# Special target for native builds (ie. when we need to build a version of ld
125# to build a version of ld :-).
126
127native:		$(SGSPROTO)/$(DYNLIB)
128
129native :=	CPPFLAGS += -DNATIVE_BUILD
130
131$(SGSPROTO)/$(DYNLIB): \
132		pics .WAIT $$(PICS)
133		$(BUILD.SO)
134		$(POST_PROCESS_SO)
135		-@$(RM) $(SGSPROTO)/$(LIBLINKS)
136		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
137
138
139# Derived source and header files (messaging).  Make sure that the sgsmsg
140# command is constructed - libelf might not be built with the whole sgs.
141
142catalog:	$(BLTMESG)
143
144chkmsg:		$(LIBSRCS)
145		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
146
147$(BLTDEFS) + \
148$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
149		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
150
151$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
152		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
153
154$(SGSMSG):	FRC
155		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
156		@ pwd
157
158FRC:
159