1*7c478bd9Sstevel@tonic-gate#
2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate#
4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate# with the License.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate# and limitations under the License.
13*7c478bd9Sstevel@tonic-gate#
14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate# Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate#
26*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate# sgs/libelf/Makefile.targ
29*7c478bd9Sstevel@tonic-gate
30*7c478bd9Sstevel@tonic-gate$(VAR_POUND_2)LIBS +=	$(LIBRARY)
31*7c478bd9Sstevel@tonic-gate
32*7c478bd9Sstevel@tonic-gateobjs/%.o \
33*7c478bd9Sstevel@tonic-gatepics/%.o:	%.c
34*7c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
35*7c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
36*7c478bd9Sstevel@tonic-gate
37*7c478bd9Sstevel@tonic-gateobjs/%64.o \
38*7c478bd9Sstevel@tonic-gatepics/%64.o:	../common/%.c
39*7c478bd9Sstevel@tonic-gate		$(COMPILE.c) -D_ELF64 -o $@ $<
40*7c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
41*7c478bd9Sstevel@tonic-gate
42*7c478bd9Sstevel@tonic-gateobjs/%.o \
43*7c478bd9Sstevel@tonic-gatepics/%.o:	../misc/%.c
44*7c478bd9Sstevel@tonic-gate		$(COMPILE.c) -DELF -o $@ $<
45*7c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
46*7c478bd9Sstevel@tonic-gate
47*7c478bd9Sstevel@tonic-gateobjs/%.o \
48*7c478bd9Sstevel@tonic-gatepics/%.o:	../common/%.c
49*7c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
50*7c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
51*7c478bd9Sstevel@tonic-gate
52*7c478bd9Sstevel@tonic-gateall:		$(BLTSRCS) .WAIT $(LIBS) $(LIBLINKS)
53*7c478bd9Sstevel@tonic-gate
54*7c478bd9Sstevel@tonic-gateinstall:	all .WAIT $(ROOTFS_LIBS) $(ROOTFS_LINKS) $(ROOTDEMODIR) \
55*7c478bd9Sstevel@tonic-gate		$(ROOTFS_LINTLIB) \
56*7c478bd9Sstevel@tonic-gate		.WAIT $(ROOTDEMOFILES) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
57*7c478bd9Sstevel@tonic-gate
58*7c478bd9Sstevel@tonic-gate$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
59*7c478bd9Sstevel@tonic-gate$(VAR_POUND_1)	$(INS.file) ../common/$(LINTLIBSRC)
60*7c478bd9Sstevel@tonic-gate
61*7c478bd9Sstevel@tonic-gatelint:		$(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT)
62*7c478bd9Sstevel@tonic-gate
63*7c478bd9Sstevel@tonic-gate$(VAR_POUND_2)lint :=		LIBTHREADFLAG=-lthread
64*7c478bd9Sstevel@tonic-gate
65*7c478bd9Sstevel@tonic-gate.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
66*7c478bd9Sstevel@tonic-gate
67*7c478bd9Sstevel@tonic-gatedelete:
68*7c478bd9Sstevel@tonic-gate		$(RM) $(DYNLIB)
69*7c478bd9Sstevel@tonic-gate
70*7c478bd9Sstevel@tonic-gate$(DYNLIB):	$(MAPFILES)
71*7c478bd9Sstevel@tonic-gate
72*7c478bd9Sstevel@tonic-gate$(VAR_SPEC_ON)$(MAPFILE):
73*7c478bd9Sstevel@tonic-gate$(VAR_SPEC_ON)		@ cd $(MAPDIR); $(MAKE) mapfile
74*7c478bd9Sstevel@tonic-gate$(VAR_SPEC_OFF)$(MAPFILE):
75*7c478bd9Sstevel@tonic-gate$(VAR_SPEC_OFF)		@ sccs get mapfile
76*7c478bd9Sstevel@tonic-gate
77*7c478bd9Sstevel@tonic-gate$(LIBLINKS):
78*7c478bd9Sstevel@tonic-gate		$(RM) $(LIBLINKS)
79*7c478bd9Sstevel@tonic-gate		$(SYMLINK) $(DYNLIB) $(LIBLINKS)
80*7c478bd9Sstevel@tonic-gate
81*7c478bd9Sstevel@tonic-gate# include common library targets
82*7c478bd9Sstevel@tonic-gate#
83*7c478bd9Sstevel@tonic-gateinclude		$(SRC)/lib/Makefile.targ
84*7c478bd9Sstevel@tonic-gateinclude		$(SRC)/cmd/sgs/Makefile.targ
85*7c478bd9Sstevel@tonic-gate
86*7c478bd9Sstevel@tonic-gate
87*7c478bd9Sstevel@tonic-gate$(ROOTDEMODIR):
88*7c478bd9Sstevel@tonic-gate		$(INS.dir)
89*7c478bd9Sstevel@tonic-gate
90*7c478bd9Sstevel@tonic-gate$(ROOTDEMODIR)/%:	../demo/%
91*7c478bd9Sstevel@tonic-gate		$(INS.file)
92*7c478bd9Sstevel@tonic-gate
93*7c478bd9Sstevel@tonic-gatexlate.c:	../common/xlate.m4
94*7c478bd9Sstevel@tonic-gate		$(M4) < ../common/xlate.m4 > xlate.c
95*7c478bd9Sstevel@tonic-gate
96*7c478bd9Sstevel@tonic-gatexlate64.c:	../common/xlate64.m4
97*7c478bd9Sstevel@tonic-gate		$(M4) < ../common/xlate64.m4 > xlate64.c
98*7c478bd9Sstevel@tonic-gate
99*7c478bd9Sstevel@tonic-gate
100*7c478bd9Sstevel@tonic-gateobjs/msg.o \
101*7c478bd9Sstevel@tonic-gatepics/msg.o:	msg.c
102*7c478bd9Sstevel@tonic-gate
103*7c478bd9Sstevel@tonic-gateobjs/error.o \
104*7c478bd9Sstevel@tonic-gatepics/error.o:	msg.h
105*7c478bd9Sstevel@tonic-gate
106*7c478bd9Sstevel@tonic-gateobjs/ar.o \
107*7c478bd9Sstevel@tonic-gatepics/ar.o:	msg.h
108*7c478bd9Sstevel@tonic-gate
109*7c478bd9Sstevel@tonic-gateobjs/xlate.o \
110*7c478bd9Sstevel@tonic-gatepics/xlate.o:	xlate.c
111*7c478bd9Sstevel@tonic-gate
112*7c478bd9Sstevel@tonic-gate#
113*7c478bd9Sstevel@tonic-gate# Targets needed to support running of Warlock, warlock can be
114*7c478bd9Sstevel@tonic-gate# located at:
115*7c478bd9Sstevel@tonic-gate#	suntools.eng:/export/tools/internal/warlock
116*7c478bd9Sstevel@tonic-gate#
117*7c478bd9Sstevel@tonic-gate# to use add the following to your path:
118*7c478bd9Sstevel@tonic-gate#	export PATH=/net/suntools.eng/export/tools/internal/warlock/bin:$PATH
119*7c478bd9Sstevel@tonic-gate#
120*7c478bd9Sstevel@tonic-gate.PARALLEL: $(WARLOCKFILES)
121*7c478bd9Sstevel@tonic-gatewarlock: wlocks .WAIT warlock_files
122*7c478bd9Sstevel@tonic-gate	warlock -c ../common/libelf.wlcmd $(WARLOCKFILES)
123*7c478bd9Sstevel@tonic-gate
124*7c478bd9Sstevel@tonic-gatewarlock_files: $(BLTSRCS) .WAIT $(WARLOCKFILES)
125*7c478bd9Sstevel@tonic-gate
126*7c478bd9Sstevel@tonic-gatewlocks:
127*7c478bd9Sstevel@tonic-gate	-@mkdir -p $@
128*7c478bd9Sstevel@tonic-gate
129*7c478bd9Sstevel@tonic-gatewlocks/%.ll:	%.c
130*7c478bd9Sstevel@tonic-gate	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
131*7c478bd9Sstevel@tonic-gate
132*7c478bd9Sstevel@tonic-gatewlocks/%.ll:	../misc/%.c
133*7c478bd9Sstevel@tonic-gate	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
134*7c478bd9Sstevel@tonic-gate
135*7c478bd9Sstevel@tonic-gatewlocks/%.ll:	../common/%.c
136*7c478bd9Sstevel@tonic-gate	wlcc $(CFLAGS) $(CPPFLAGS) -o $@ $<
137*7c478bd9Sstevel@tonic-gate
138*7c478bd9Sstevel@tonic-gate
139*7c478bd9Sstevel@tonic-gate# Special target for native builds (ie. when we need to build a version of ld
140*7c478bd9Sstevel@tonic-gate# to build a version of ld :-).
141*7c478bd9Sstevel@tonic-gate
142*7c478bd9Sstevel@tonic-gatenative:		$(SGSPROTO)/$(DYNLIB)
143*7c478bd9Sstevel@tonic-gate
144*7c478bd9Sstevel@tonic-gate$(SGSPROTO)/$(DYNLIB): \
145*7c478bd9Sstevel@tonic-gate		pics .WAIT $$(PICS) $(MAPFILES)
146*7c478bd9Sstevel@tonic-gate		$(BUILD.SO)
147*7c478bd9Sstevel@tonic-gate		$(POST_PROCESS_SO)
148*7c478bd9Sstevel@tonic-gate		-@$(RM) $(SGSPROTO)/$(LIBLINKS)
149*7c478bd9Sstevel@tonic-gate		$(SYMLINK) $(DYNLIB) $(SGSPROTO)/$(LIBLINKS)
150*7c478bd9Sstevel@tonic-gate
151*7c478bd9Sstevel@tonic-gate
152*7c478bd9Sstevel@tonic-gate# Derived source and header files (messaging).  Make sure that the sgsmsg
153*7c478bd9Sstevel@tonic-gate# command is constructed - libelf might not be built with the whole sgs.
154*7c478bd9Sstevel@tonic-gate
155*7c478bd9Sstevel@tonic-gatecatalog:	$(BLTMESG)
156*7c478bd9Sstevel@tonic-gate
157*7c478bd9Sstevel@tonic-gatechkmsg:		$(LIBSRCS)
158*7c478bd9Sstevel@tonic-gate		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
159*7c478bd9Sstevel@tonic-gate
160*7c478bd9Sstevel@tonic-gate$(BLTDEFS) + \
161*7c478bd9Sstevel@tonic-gate$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
162*7c478bd9Sstevel@tonic-gate		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
163*7c478bd9Sstevel@tonic-gate
164*7c478bd9Sstevel@tonic-gate$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
165*7c478bd9Sstevel@tonic-gate		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
166*7c478bd9Sstevel@tonic-gate
167*7c478bd9Sstevel@tonic-gate$(SGSMSG):	FRC
168*7c478bd9Sstevel@tonic-gate		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
169*7c478bd9Sstevel@tonic-gate		@ pwd
170*7c478bd9Sstevel@tonic-gate
171*7c478bd9Sstevel@tonic-gateFRC:
172