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