-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile_base
474 lines (405 loc) · 16.7 KB
/
Makefile_base
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# NB: CYCDIR, CYCC, EXEC_PREFIX imported from Makefile
VPATH=bin/genfiles:lib:lib/xml
define ARCHIVE
-$(RM) $@
$(AR) rc $@ $^
$(RANLIB) $@
endef
define TARGET_ARCHIVE
-$(RM) $@
$(TARGET_AR) rc $@ $^
$(TARGET_RANLIB) $@
endef
########################################################################
LIBCYCBOOT_FILES = $(O_BOOT_LIBS) boot_cstubs.$(O) boot_cycstubs.$(O)
$(BB)/libcycboot.a: $(addprefix $(BB)/, $(LIBCYCBOOT_FILES))
$(ARCHIVE)
$(BB)/gdb/libcycboot.a: $(addprefix $(BB)/gdb/, $(LIBCYCBOOT_FILES))
$(ARCHIVE)
$(BB)/aprof/libcycboot.a: $(addprefix $(BB)/aprof/, $(LIBCYCBOOT_FILES))
$(ARCHIVE)
$(BB)/gprof/libcycboot.a: $(addprefix $(BB)/gprof/, $(LIBCYCBOOT_FILES))
$(ARCHIVE)
$(BB)/nocheck/libcycboot.a: $(addprefix $(BB)/nocheck/, $(LIBCYCBOOT_FILES))
$(ARCHIVE)
ifneq ($(build),$(target))
$(BT)/libcycboot.a: $(addprefix $(BT)/, $(LIBCYCBOOT_FILES))
$(TARGET_ARCHIVE)
endif
########################################################################
LIBCYC_FILES = include/cycstubs.$(O) include/cstubs.$(O) $(O_BOOT_LIBS) $(O_LIBS)
$(BB)/libcyc.a: $(addprefix $(BB)/, $(LIBCYC_FILES))
$(ARCHIVE)
$(BB)/gdb/libcyc.a: $(addprefix $(BB)/gdb/, $(LIBCYC_FILES))
$(ARCHIVE)
$(BB)/aprof/libcyc.a: $(addprefix $(BB)/aprof/, $(LIBCYC_FILES))
$(ARCHIVE)
$(BB)/gprof/libcyc.a: $(addprefix $(BB)/gprof/, $(LIBCYC_FILES))
$(ARCHIVE)
$(BB)/nocheck/libcyc.a: $(addprefix $(BB)/nocheck/, $(LIBCYC_FILES))
$(ARCHIVE)
ifneq ($(build),$(target))
$(BT)/libcyc.a: $(addprefix $(BT)/, $(LIBCYC_FILES))
$(TARGET_ARCHIVE)
endif
########################################################################
LIBXML_FILES = xml.$(O) xmlparse_tab.$(O) xmlscan.$(O) xmldump.$(O)
$(BB)/libxml.a: $(addprefix $(BB)/, $(LIBXML_FILES))
$(ARCHIVE)
$(BB)/gdb/libxml.a: $(addprefix $(BB)/gdb/, $(LIBXML_FILES))
$(ARCHIVE)
$(BB)/aprof/libxml.a: $(addprefix $(BB)/aprof/, $(LIBXML_FILES))
$(ARCHIVE)
$(BB)/gprof/libxml.a: $(addprefix $(BB)/gprof/, $(LIBXML_FILES))
$(ARCHIVE)
$(BB)/nocheck/libxml.a: $(addprefix $(BB)/nocheck/, $(LIBXML_FILES))
$(ARCHIVE)
ifneq ($(build),$(target))
$(BT)/libxml.a: $(addprefix $(BT)/, $(LIBXML_FILES))
$(TARGET_ARCHIVE)
endif
########################################################################
$(BB)/runtime_cyc.a: $(addprefix $(BB)/, $(O_RUNTIME))
$(ARCHIVE)
$(BB)/gdb/runtime_cyc.a: $(addprefix $(BB)/gdb/, $(O_RUNTIME))
$(ARCHIVE)
$(BB)/aprof/runtime_cyc.a: $(addprefix $(BB)/aprof/, $(O_RUNTIME))
$(ARCHIVE)
$(BB)/gprof/runtime_cyc.a: $(addprefix $(BB)/gprof/, $(O_RUNTIME))
$(ARCHIVE)
$(BB)/nocheck/runtime_cyc.a: $(addprefix $(BB)/nocheck/, $(O_RUNTIME))
$(ARCHIVE)
$(BB)/pthread/runtime_cyc.a: $(addprefix $(BB)/pthread/, $(O_RUNTIME))
$(ARCHIVE)
ifneq ($(build),$(target))
$(BT)/runtime_cyc.a: $(addprefix $(BT)/, $(O_RUNTIME))
$(TARGET_ARCHIVE)
$(BT)/pthread/runtime_cyc.a: $(addprefix $(BT)/pthread/, $(O_RUNTIME))
$(TARGET_ARCHIVE)
endif
########################################################################
$(BB)/nogc.$(O): malloc.c
$(BB)/gdb/nogc.$(O): malloc.c
$(BB)/aprof/nogc.$(O): malloc.c
$(BB)/gprof/nogc.$(O): malloc.c
$(BB)/nocheck/nogc.$(O): malloc.c
$(BB)/pthread/nogc.$(O): malloc.c
ifneq ($(build),$(target))
$(BT)/nogc.$(O): malloc.c
$(BT)/pthread/nogc.$(O): malloc.c
endif
$(BB)/nogc.a: $(BB)/nogc.$(O)
$(ARCHIVE)
$(BB)/gdb/nogc.a: $(BB)/gdb/nogc.$(O)
$(ARCHIVE)
$(BB)/aprof/nogc.a: $(BB)/aprof/nogc.$(O)
$(ARCHIVE)
$(BB)/gprof/nogc.a: $(BB)/gprof/nogc.$(O)
$(ARCHIVE)
$(BB)/nocheck/nogc.a: $(BB)/nocheck/nogc.$(O)
$(ARCHIVE)
$(BB)/pthread/nogc.a: $(BB)/pthread/nogc.$(O)
$(ARCHIVE)
ifneq ($(build),$(target))
$(BT)/nogc.a: $(BT)/nogc.$(O)
$(TARGET_ARCHIVE)
$(BT)/pthread/nogc.a: $(BT)/pthread/nogc.$(O)
$(TARGET_ARCHIVE)
endif
########################################################################
# NB: we generate these files into lib/xml, rather than into
# the build directories, because bugs in make (as with
# install_path and nogc, below) would require an extremely
# verbose workaround
lib/xml/xmlparse_tab.cyc: lib/xml/xmlparse.y
bin/cycbison$(EXE) -d $< -o $@
lib/xml/xmlparse_tab.h: lib/xml/xmlparse.y
bin/cycbison$(EXE) -d $< -o xmlparse_tab.cyc
lib/xml/xmlscan.cyc: lib/xml/xmlparse_tab.h
lib/xml/xmlscan.cyc: lib/xml/xmlscan.cyl
bin/cyclex$(EXE) $< $@
########################################################################
# NB: use of $(build) prevents cross compilation, but install_path is only
# used by cyclone, cycdoc, and buildlib, which we don't cross compile.
# FIX: the wchar stuff should be moved to the cycspecs file
define CREATE_INSTALL_PATH
(echo "char *Carch = \"$(build)\";"; \
echo "char *Cdef_lib_path = \"$(LIB_INSTALL)\";"; \
echo "char *Cversion = \"$(VERSION)\";"; \
echo "int Wchar_t_unsigned = $(WCHAR_T_UNSIGNED);"; \
echo "int Sizeof_wchar_t = $(SIZEOF_WCHAR_T);") > $@
endef
$(BB)/install_path.c: Makefile.inc
$(CREATE_INSTALL_PATH)
$(BB)/gdb/install_path.c: Makefile.inc
$(CREATE_INSTALL_PATH)
$(BB)/aprof/install_path.c: Makefile.inc
$(CREATE_INSTALL_PATH)
$(BB)/gprof/install_path.c: Makefile.inc
$(CREATE_INSTALL_PATH)
$(BB)/nocheck/install_path.c: Makefile.inc
$(CREATE_INSTALL_PATH)
########################################################################
$(BB)/include/cstubs.o: $(BB)/include/precore_c.h
$(BB)/gdb/include/cstubs.o: $(BB)/gdb/include/precore_c.h
$(BB)/aprof/include/cstubs.o: $(BB)/aprof/include/precore_c.h
$(BB)/gprof/include/cstubs.o: $(BB)/gprof/include/precore_c.h
$(BB)/nocheck/include/cstubs.o: $(BB)/nocheck/include/precore_c.h
ifneq ($(build),$(target))
$(BT)/include/cstubs.o: $(BT)/include/precore_c.h
endif
########################################################################
# FIX: the rule creates a bunch of header files but the header
# files aren't targets, so, dependencies are wrong and make can
# get confused.
# NB: the -B is needed so buildlib can find the cycspecs file
STUBS_FILES = bin/cyc-lib/libc.cys bin/buildlib$(EXE) $(BL)/cyc-lib/$(build)/cycspecs
TARGET_STUBS_FILES = bin/cyc-lib/libc.cys bin/buildlib$(EXE) $(BL)/cyc-lib/$(target)/cycspecs
define CREATE_STUBS
bin/buildlib $(BUILDLIBFLAGS) -Bbin/lib/cyc-lib -d $(@D) $<
endef
define TARGET_CREATE_STUBS
bin/buildlib $(BTARGET) $(BUILDLIBFLAGS) -Bbin/lib/cyc-lib -d $(@D) $<
endef
$(BB)/include/cycstubs.cyc: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/gdb/include/cycstubs.cyc: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/aprof/include/cycstubs.cyc: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/gprof/include/cycstubs.cyc: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/nocheck/include/cycstubs.cyc: $(STUBS_FILES)
$(CREATE_STUBS)
ifneq ($(build),$(target))
$(BT)/include/cycstubs.cyc: $(TARGET_STUBS_FILES)
$(TARGET_CREATE_STUBS)
endif
$(BB)/include/cstubs.c: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/gdb/include/cstubs.c: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/aprof/include/cstubs.c: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/gprof/include/cstubs.c: $(STUBS_FILES)
$(CREATE_STUBS)
$(BB)/nocheck/include/cstubs.c: $(STUBS_FILES)
$(CREATE_STUBS)
ifneq ($(build),$(target))
$(BT)/include/cstubs.c: $(TARGET_STUBS_FILES)
$(TARGET_CREATE_STUBS)
endif
########################################################################
PRECORE_FILES = include/core.h bin/cyclone $(BL)/cyc-lib/$(build)/cycspecs
TARGET_PRECORE_FILES = include/core.h bin/cyclone $(BL)/cyc-lib/$(target)/cycspecs
define CREATE_PRECORE
$(CYCC) -B$(EXEC_PREFIX) -stopafter-toc -pp -D_CYC_GENERATE_PRECORE_C_ -nocyc -noremoveunused -noexpandtypedefs -nocyc_setjmp -x cyc -o $@ $<
endef
$(BB)/include/precore_c.h: $(PRECORE_FILES)
$(CREATE_PRECORE)
$(BB)/gdb/include/precore_c.h: $(PRECORE_FILES)
$(CREATE_PRECORE)
$(BB)/aprof/include/precore_c.h: $(PRECORE_FILES)
$(CREATE_PRECORE)
$(BB)/gprof/include/precore_c.h: $(PRECORE_FILES)
$(CREATE_PRECORE)
$(BB)/nocheck/include/precore_c.h: $(PRECORE_FILES)
$(CREATE_PRECORE)
ifneq ($(build),$(target))
$(BT)/include/precore_c.h: $(TARGET_PRECORE_FILES)
$(CYCC) $(BTARGET) -B$(EXEC_PREFIX) -stopafter-toc -pp -D_CYC_GENERATE_PRECORE_C_ -nocyc -noremoveunused -noexpandtypedefs -nocyc_setjmp -x cyc -o $@ $<
endif
########################################################################
# NB: use of $(build) prevents cross compilation, but we don't know
# how to cross compile the garbage collector anyway...
GCFILE = $(BL)/cyc-lib/$(build)/gc.a
LINKFILES = install_path.$(O) libcycboot.a runtime_cyc.a
########################################################################
$(BB)/cyclone$(EXE): $(addprefix $(BB)/, $(O_SRCS) $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS)
$(BB)/cyclone-inf$(EXE): $(addprefix $(BB)/, $(BANSHEE_O_SRCS) cycinf.o $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS) -L$(BANSHEEREGIONDIR) -L$(BANSHEEENGINEDIR) -lengine -lregions -lm
$(BB)/gdb/cyclone$(EXE): $(addprefix $(BB)/gdb/, $(O_SRCS) $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS)
$(BB)/aprof/cyclone$(EXE): $(addprefix $(BB)/aprof/, $(O_SRCS) $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS)
$(BB)/gprof/cyclone$(EXE): $(addprefix $(BB)/gprof/, $(O_SRCS) $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS)
$(BB)/nocheck/cyclone$(EXE): $(addprefix $(BB)/nocheck/, $(O_SRCS) $(LINKFILES)) $(GCFILE)
$(CC) -o $@ $^ $(LDFLAGS)
########################################################################
CYCDOC_FILES = $(addsuffix .$(O), $(CYCDOC_SRCS)) $(LINKFILES)
$(BB)/cycdoc$(EXE): $(addprefix $(BB)/, $(CYCDOC_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/gdb/cycdoc$(EXE): $(addprefix $(BB)/gdb/, $(CYCDOC_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/aprof/cycdoc$(EXE): $(addprefix $(BB)/aprof/, $(CYCDOC_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/gprof/cycdoc$(EXE): $(addprefix $(BB)/gprof/, $(CYCDOC_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/nocheck/cycdoc$(EXE): $(addprefix $(BB)/nocheck/, $(CYCDOC_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
########################################################################
BUILDLIB_FILES = $(addsuffix .$(O), $(BUILDLIB_SRCS)) $(LINKFILES)
$(BB)/buildlib$(EXE): $(addprefix $(BB)/, $(BUILDLIB_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/gdb/buildlib$(EXE): $(addprefix $(BB)/gdb/, $(BUILDLIB_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/aprof/buildlib$(EXE): $(addprefix $(BB)/aprof/, $(BUILDLIB_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/gprof/buildlib$(EXE): $(addprefix $(BB)/gprof/, $(BUILDLIB_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BB)/nocheck/buildlib$(EXE): $(addprefix $(BB)/nocheck/, $(BUILDLIB_FILES)) $(GCFILE)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
########################################################################
# NB: the invocation
# $(if $(findstring $(notdir $@), $(O_NOOPT_SRCS)), , $(OPTFLAG))
# expands to $(OPTFLAG) if the target is not in $(O_NOOPT_SRCS),
# and to the empty string otherwise. We use it to turn off optimization
# for files where it is expensive (parse_tab.o).
########################################################################
# Cancel implicit rule
%.$(O): %.c
########################################################################
# For the regular compiler
define REGULAR_CCARGS
$(CFLAGS) -c $(CPPFLAGS) $(if $(findstring $(notdir $@), $(O_NOOPT_SRCS)), , $(OPTFLAG)) $< -o $@
endef
# for .c files in vpath
$(BB)/%.$(O): %.c
$(CC) $(REGULAR_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BB)/include/cstubs.$(O): $(BB)/include/cstubs.c
$(CC) $(REGULAR_CCARGS)
$(BB)/install_path.$(O): $(BB)/install_path.c
$(CC) $(REGULAR_CCARGS)
define REGULAR_CYCARGS
$(CYCFLAGS) -c -I$(BB)/include -Iinclude -Ilib/xml -B$(EXEC_PREFIX) $(if $(findstring $(notdir $@), $(O_NOOPT_SRCS)), , $(OPTFLAG)) -o $@ $<
endef
#special rule for this file to build using the Banshee include path
BANSHEE_CFLAGS=-I$(BANSHEEENGINEDIR) -I$(BANSHEEREGIONDIR) -Ddeletes= -Dtraditional= \
-Dsameregion= -Dparentptr= -Wall -Werror
$(BB)/cycinf.o: cycinf.c
$(CC) $(BANSHEE_CFLAGS) -c $^ -o $@
# for .cyc files in vpath
$(BB)/%.$(O): %.cyc
$(CYCC) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BB)/include/cycstubs.$(O): $(BB)/include/cycstubs.cyc
$(CYCC) $(REGULAR_CYCARGS)
########################################################################
# For the aprof'd compiler
APROF_CFLAGS = -DCYC_REGION_PROFILE
APROF_CYCFLAGS = -pa
# for .c files in vpath
$(BB)/aprof/%.$(O): %.c
$(CC) $(APROF_CFLAGS) $(REGULAR_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BB)/aprof/include/cstubs.$(O): $(BB)/aprof/include/cstubs.c
$(CC) $(APROF_CFLAGS) $(REGULAR_CCARGS)
$(BB)/aprof/install_path.$(O): $(BB)/aprof/install_path.c
$(CC) $(APROF_CFLAGS) $(REGULAR_CCARGS)
# for .cyc files in vpath
$(BB)/aprof/%.$(O): %.cyc
$(CYCC) $(APROF_CYCFLAGS) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BB)/aprof/include/cycstubs.$(O): $(BB)/aprof/include/cycstubs.cyc
$(CYCC) $(APROF_CYCFLAGS) $(REGULAR_CYCARGS)
########################################################################
# For the gprof'd compiler
GPROF_CFLAGS = -pg
GPROF_CYCFLAGS = -pa
# for .c files in vpath
$(BB)/gprof/%.$(O): %.c
$(CC) $(GPROF_CFLAGS) $(REGULAR_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BB)/gprof/include/cstubs.$(O): $(BB)/gprof/include/cstubs.c
$(CC) $(GPROF_CFLAGS) $(REGULAR_CCARGS)
$(BB)/gprof/install_path.$(O): $(BB)/gprof/install_path.c
$(CC) $(GPROF_CFLAGS) $(REGULAR_CCARGS)
# for .cyc files in vpath
$(BB)/gprof/%.$(O): %.cyc
$(CYCC) $(GPROF_CYCFLAGS) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BB)/gprof/include/cycstubs.$(O): $(BB)/gprof/include/cycstubs.cyc
$(CYCC) $(GPROF_CYCFLAGS) $(REGULAR_CYCARGS)
########################################################################
# For the nocheck'd compiler
NOCHECK_CFLAGS = -DNO_CYC_NULL_CHECKS -DNO_CYC_BOUNDS_CHECKS
NOCHECK_CYCFLAGS = -nochecks
# for .c files in vpath
$(BB)/nocheck/%.$(O): %.c
$(CC) $(NOCHECK_CFLAGS) $(REGULAR_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BB)/nocheck/include/cstubs.$(O): $(BB)/nocheck/include/cstubs.c
$(CC) $(NOCHECK_CFLAGS) $(REGULAR_CCARGS)
$(BB)/nocheck/install_path.$(O): $(BB)/nocheck/install_path.c
$(CC) $(NOCHECK_CFLAGS) $(REGULAR_CCARGS)
# for .cyc files in vpath
$(BB)/nocheck/%.$(O): %.cyc
$(CYCC) $(NOCHECK_CYCFLAGS) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BB)/nocheck/include/cycstubs.$(O): $(BB)/nocheck/include/cycstubs.cyc
$(CYCC) $(NOCHECK_CYCFLAGS) $(REGULAR_CYCARGS)
########################################################################
# For the gdb'd compiler
GDB_CFLAGS = -g
GDB_CYCFLAGS = -g
# for .c files in vpath
$(BB)/gdb/%.$(O): %.c
$(CC) $(GDB_CFLAGS) $(REGULAR_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BB)/gdb/include/cstubs.$(O): $(BB)/gdb/include/cstubs.c
$(CC) $(GDB_CFLAGS) $(REGULAR_CCARGS)
$(BB)/gdb/install_path.$(O): $(BB)/gdb/install_path.c
$(CC) $(GDB_CFLAGS) $(REGULAR_CCARGS)
# for .cyc files in vpath
$(BB)/gdb/%.$(O): %.cyc
$(CYCC) $(GDB_CYCFLAGS) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BB)/gdb/include/cycstubs.$(O): $(BB)/gdb/include/cycstubs.cyc
$(CYCC) $(GDB_CYCFLAGS) $(REGULAR_CYCARGS)
########################################################################
# For the special pthread versions of nogc.a and runtime_cyc.a
PTHREAD_CFLAGS = -D_HAVE_PTHREAD_
# for .c files in vpath
$(BB)/pthread/%.$(O): %.c
$(CC) $(PTHREAD_CFLAGS) $(REGULAR_CCARGS)
########################################################################
# For the cross compiler
ifneq ($(build),$(target))
define TARGET_CCARGS
$(TARGET_CFLAGS) -c $(CPPFLAGS) $(if $(findstring $(notdir $@), $(O_NOOPT_SRCS)), , $(OPTFLAG)) $< -o $@
endef
# for .c files in vpath
$(BT)/%.$(O): %.c
$(TARGET_CC) $(TARGET_CCARGS)
# others not in vpath
# NB: can't use % in place of cstubs or install_path, seems like a bug in make
$(BT)/include/cstubs.$(O): $(BT)/include/cstubs.c
$(TARGET_CC) $(TARGET_CCARGS)
$(BT)/install_path.$(O): $(BT)/install_path.c
$(TARGET_CC) $(TARGET_CCARGS)
# for .cyc files in vpath
$(BT)/%.$(O): %.cyc
$(CYCC) $(BTARGET) $(REGULAR_CYCARGS)
# for include/cycstubs.cyc
# NB: can't use % in place of cycstubs, seems like a bug in make
$(BT)/include/cycstubs.$(O): $(BT)/include/cycstubs.cyc
$(CYCC) $(BTARGET) $(REGULAR_CYCARGS)
# For the special pthread versions of nogc.a and runtime_cyc.a
PTHREAD_CFLAGS = -D_HAVE_PTHREAD_
# for .c files in vpath
$(BT)/pthread/%.$(O): %.c
$(TARGET_CC) $(PTHREAD_CFLAGS) $(TARGET_CCARGS)
endif