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