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