xref: /illumos-gate/usr/src/lib/libc/Makefile.targ (revision cd277642e0bdc71a7f57c550df1279b0c091d6e2)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24# Copyright 2016 Joyent, Inc.
25#
26#
27
28# libc build rules
29
30#
31# This first rule picks up optimized sources for libc variants.
32#
33pics/%.o: $(OPTIMIZED_LIBCBASE)/gen/%.s
34	$(BUILD.s)
35	$(POST_PROCESS_O)
36
37pics/%.o: $(LIBCBASE)/crt/%.c
38	$(COMPILE.c) -o $@ $<
39	$(POST_PROCESS_O)
40
41pics/%.o: $(LIBCBASE)/crt/%.s
42	$(BUILD.s)
43	$(POST_PROCESS_O)
44
45pics/%.o: $(LIBCBASE)/gen/%.c
46	$(COMPILE.c) -o $@ $<
47	$(POST_PROCESS_O)
48
49pics/%.o: $(LIBCBASE)/gen/%.s
50	$(BUILD.s)
51	$(POST_PROCESS_O)
52
53pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/gen/%.s
54	$(BUILD.s)
55	$(POST_PROCESS_O)
56
57pics/_stack_grow.o: $(LIBCBASE)/../$(TARGET_ARCH)/gen/_stack_grow.s
58	$(BUILD.s) $(LIBCBASE)/../$(TARGET_ARCH)/gen/_stack_grow.s
59	$(POST_PROCESS_O)
60
61pics/%.o: $(LIBCBASE)/fp/%.c
62	$(COMPILE.c) -o $@ $<
63	$(POST_PROCESS_O)
64
65pics/%.o: $(LIBCBASE)/../$(MACH)/fp/%.c
66	$(COMPILE.c) -o $@ $<
67	$(POST_PROCESS_O)
68
69pics/%.o: $(LIBCBASE)/fp/%.s
70	$(BUILD.s)
71	$(POST_PROCESS_O)
72
73pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/fp/%.c
74	$(COMPILE.c) -o $@ $<
75	$(POST_PROCESS_O)
76
77pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/fp/%.s
78	$(BUILD.s)
79	$(POST_PROCESS_O)
80
81pics/%.o: $(LIBCBASE)/sys/%.c
82	$(COMPILE.c) -o $@ $<
83	$(POST_PROCESS_O)
84
85pics/%.o: $(LIBCBASE)/../common/sys/%.s
86	$(BUILD.s)
87	$(POST_PROCESS_O)
88
89pics/%.o: $(LIBCBASE)/sys/%.s
90	$(BUILD.s)
91	$(POST_PROCESS_O)
92
93pics/%.o: $(LIBCBASE)/../$(MACH)/sys/%.s
94	$(BUILD.s)
95	$(POST_PROCESS_O)
96
97pics/%.o: $(LIBCBASE)/../$(MACH)/sys/%.c
98	$(COMPILE.c) -o $@ $<
99	$(POST_PROCESS_O)
100
101pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/sys/%.c
102	$(COMPILE.c) -o $@ $<
103	$(POST_PROCESS_O)
104
105pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/sys/%.s
106	$(BUILD.s)
107	$(POST_PROCESS_O)
108
109# rules to build large file aware objects (xxx64.o from xxx.s or xxx.c)
110
111pics/%64.o: $(LIBCBASE)/../common/sys/%.s
112	$(BUILD.s)
113	$(POST_PROCESS_O)
114
115pics/%64.o: $(LIBCBASE)/sys/%.s
116	$(BUILD.s)
117	$(POST_PROCESS_O)
118
119pics/%64.o: $(LIBCBASE)/gen/%.c
120	$(COMPILE.c) -o $@ $<
121	$(POST_PROCESS_O)
122
123pics/%64.o: $(LIBCBASE)/../port/gen/%.c
124	$(COMPILE.c) -o $@ $<
125	$(POST_PROCESS_O)
126
127pics/%64.o: $(LIBCBASE)/../port/sys/%.c
128	$(COMPILE.c) -o $@ $<
129	$(POST_PROCESS_O)
130
131pics/%64.o: $(LIBCBASE)/../port/print/%.c
132	$(COMPILE.c) -o $@ $<
133	$(POST_PROCESS_O)
134
135pics/%64.o: $(LIBCBASE)/../port/regex/%.c
136	$(COMPILE.c) -DM_I18N_MB -DI18N \
137	-I$(LIBCBASE)/../port/regex \
138	-I$(LIBCBASE)/../port/gen -o $@ $<
139	$(POST_PROCESS_O)
140
141pics/%64.o: $(LIBCBASE)/../port/stdio/%.c
142	$(COMPILE.c) -o $@ $<
143	$(POST_PROCESS_O)
144
145pics/%_w.o: $(LIBCBASE)/../port/stdio/%.c
146	$(COMPILE.c) -o $@ $<
147	$(POST_PROCESS_O)
148
149pics/%_w.o: $(LIBCBASE)/../port/print/%.c
150	$(COMPILE.c) -o $@ $<
151	$(POST_PROCESS_O)
152
153pics/%_pos.o: $(LIBCBASE)/../port/i18n/%.c
154	$(COMPILE.c) -o $@ $<
155	$(POST_PROCESS_O)
156
157pics/%_sbyte.o: $(LIBCBASE)/../port/i18n/%.c
158	$(COMPILE.c) -o $@ $<
159	$(POST_PROCESS_O)
160
161pics/%_possbyte.o: $(LIBCBASE)/../port/i18n/%.c
162	$(COMPILE.c) -o $@ $<
163	$(POST_PROCESS_O)
164
165pics/%_longlong.o: $(LIBCBASE)/../port/i18n/%.c
166	$(COMPILE.c) -o $@ $<
167	$(POST_PROCESS_O)
168
169# libc build rules for objects built from "portable" source in ../port
170
171pics/%.o: $(LIBCBASE)/../port/fp/%.c
172	$(COMPILE.c) \
173	-I$(LIBCBASE)/../port/fp -o $@ $<
174	$(POST_PROCESS_O)
175
176pics/%.o: $(LIBCBASE)/../port/i18n/%.c
177	$(COMPILE.c) \
178	-I$(LIBCBASE)/../port/i18n -o $@ $<
179	$(POST_PROCESS_O)
180
181# gen rules
182pics/%.o %.o: $(LIBCBASE)/../port/gen/%.c
183	$(COMPILE.c) -o $@ $<
184	$(POST_PROCESS_O)
185
186# locale rules
187pics/%.o %.o: $(LIBCBASE)/../port/locale/%.c
188	$(COMPILE.c) -o $@ $<
189	$(POST_PROCESS_O)
190
191# print rules
192pics/%.o: $(LIBCBASE)/../port/print/%.c
193	$(COMPILE.c) -o $@ $<
194	$(POST_PROCESS_O)
195
196# regex rules
197pics/%.o: $(LIBCBASE)/../port/regex/%.c
198	$(COMPILE.c) -DM_I18N_MB -DI18N \
199	-I$(LIBCBASE)/../port/regex \
200	-I$(LIBCBASE)/../port/gen -o $@ $<
201	$(POST_PROCESS_O)
202
203# stdio rules
204pics/%.o: $(LIBCBASE)/../port/stdio/%.c
205	$(COMPILE.c) -o $@ $<
206	$(POST_PROCESS_O)
207
208# c89 print, stdio rules
209pics/%_c89.o: $(LIBCBASE)/../port/print/%.c
210	$(COMPILE.c) -o $@ $<
211	$(POST_PROCESS_O)
212
213pics/%_c89.o: $(LIBCBASE)/../port/stdio/%.c
214	$(COMPILE.c) -o $@ $<
215	$(POST_PROCESS_O)
216
217# aio rules
218pics/%.o: $(LIBCBASE)/../port/aio/%.c
219	$(COMPILE.c) -o $@ $<
220	$(POST_PROCESS_O)
221
222# rt rules
223pics/%.o: $(LIBCBASE)/../port/rt/%.c
224	$(COMPILE.c) -o $@ $<
225	$(POST_PROCESS_O)
226
227# tpool rules
228pics/%.o: $(LIBCBASE)/../port/tpool/%.c
229	$(COMPILE.c) -o $@ $<
230	$(POST_PROCESS_O)
231
232# threads rules
233pics/%.o: $(LIBCBASE)/../port/threads/%.c
234	$(COMPILE.c) -o $@ $<
235	$(POST_PROCESS_O)
236
237pics/%.o: $(LIBCBASE)/threads/%.c
238	$(COMPILE.c) -o $@ $<
239	$(POST_PROCESS_O)
240
241pics/%.o: $(LIBCBASE)/threads/%.s
242	$(BUILD.s)
243	$(POST_PROCESS_O)
244
245pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/threads/%.c
246	$(COMPILE.c) -o $@ $<
247	$(POST_PROCESS_O)
248
249pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/threads/%.s
250	$(BUILD.s)
251	$(POST_PROCESS_O)
252
253pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/unwind/%.c
254	$(COMPILE.c) -o $@ $<
255	$(POST_PROCESS_O)
256
257pics/%.o: $(LIBCBASE)/../$(TARGET_ARCH)/unwind/%.s
258	$(BUILD.s)
259	$(POST_PROCESS_O)
260
261pics/%.o: $(LIBCBASE)/../port/unwind/%.c
262	$(COMPILE.c) -o $@ $<
263	$(POST_PROCESS_O)
264
265pics/%.o: $(LIBCBASE)/../$(MACH)/unwind/%.s
266	$(BUILD.s)
267	$(POST_PROCESS_O)
268
269pics/%.o: $(LIBCBASE)/../port/sys/%.c
270	$(COMPILE.c) -o $@ $<
271	$(POST_PROCESS_O)
272
273pics/%.o: $(LIBCBASE)/../../common/common/%.c
274	$(COMPILE.c) -o $@ $<
275	$(POST_PROCESS_O)
276
277pics/%.o: $(LIBCBASE)/$(CRTSRCS)/%.s
278	$(BUILD.s)
279	$(POST_PROCESS_O)
280
281# $(SRC)/common rules
282pics/%.o: $(SRC)/common/atomic/$(TARGETMACH)/%.s
283	$(BUILD.s)
284	$(POST_PROCESS_O)
285
286$(COMOBJS:%=pics/%): $(SRC)/common/util/$$(@F:.o=.c)
287	$(COMPILE.c) -o $@ $(SRC)/common/util/$(@F:.o=.c)
288	$(POST_PROCESS_O)
289
290$(XATTROBJS:%=pics/%): $(SRC)/common/xattr/$$(@F:.o=.c)
291	$(COMPILE.c) -o $@ $(SRC)/common/xattr/$(@F:.o=.c)
292	$(POST_PROCESS_O)
293
294$(DTRACEOBJS:%=pics/%): $(SRC)/common/dtrace/$$(@F:.o=.c)
295	$(COMPILE.c) -o $@ $(SRC)/common/dtrace/$(@F:.o=.c)
296	$(POST_PROCESS_O)
297
298$(SECFLAGSOBJS:%=pics/%): $(SRC)/common/secflags/$$(@F:.o=.c)
299	$(COMPILE.c) -o $@ $(SRC)/common/secflags/$(@F:.o=.c)
300	$(POST_PROCESS_O)
301
302$(UNICODEOBJS:%=pics/%): $(SRC)/common/unicode/$$(@F:.o=.c)
303	$(COMPILE.c) -o $@ $(SRC)/common/unicode/$(@F:.o=.c)
304	$(POST_PROCESS_O)
305
306$(CHACHAOBJS:%=pics/%): $(SRC)/common/crypto/chacha/$$(@F:.o=.c)
307	$(COMPILE.c) -I$(SRC)/common/crypto/chacha -DKEYSTREAM_ONLY \
308	    -o $@ $(SRC)/common/crypto/chacha/$(@F:.o=.c)
309	$(POST_PROCESS_O)
310
311# DTrace rules
312pics/%.o: $(LIBCBASE)/../port/threads/%.d $(THREADSOBJS:%=pics/%)
313	$(COMPILE.d) -C -xlazyload -s $< -o $@ $(THREADSOBJS:%=pics/%)
314	$(POST_PROCESS_O)
315
316include $(SRC)/lib/Makefile.targ
317