-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
594 lines (485 loc) · 17.6 KB
/
Makefile
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
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
include Makefile.inc
export CYCDIR CYCC EXEC_PREFIX
CYCC=$(CYCDIR)/bin/cyclone$(EXE)
EXEC_PREFIX=$(CYCDIR)/bin/lib/cyc-lib
GC=gc
BANSHEE=banshee
# Target directories:
# BB is where object files for the standard build are put
# BT is where object files for a cross build are put
# BL is where the finished library files are put
# bin is where executables are put
#
BB=build/$(build)
BT=build/$(target)
BL=bin/lib
all: directories cyclone tools xml otherlibs
cyclone-inf: banshee_engine directories cyclone-inf-inner
$(BL)/libcycboot.a: $(BB)/libcycboot.a
cp -p $< $@
$(BL)/libcycboot_g.a: $(BB)/gdb/libcycboot.a
cp -p $< $@
$(BL)/libcycboot_a.a: $(BB)/aprof/libcycboot.a
cp -p $< $@
$(BL)/libcycboot_pg.a: $(BB)/gprof/libcycboot.a
cp -p $< $@
$(BL)/libcycboot_nocheck.a: $(BB)/nocheck/libcycboot.a
cp -p $< $@
LIBCYC_PREREQS = bin/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
$(BL)/libcyc.a: $(LIBCYC_PREREQS) $(BB)/libcyc.a include-directory
cp -p $(BB)/libcyc.a $@
$(BL)/libcyc_g.a: $(LIBCYC_PREREQS) $(BB)/gdb/libcyc.a include-directory
cp -p $(BB)/gdb/libcyc.a $@
$(BL)/libcyc_a.a: $(LIBCYC_PREREQS) $(BB)/aprof/libcyc.a include-directory
cp -p $(BB)/aprof/libcyc.a $@
$(BL)/libcyc_pg.a: $(LIBCYC_PREREQS) $(BB)/gprof/libcyc.a include-directory
cp -p $(BB)/gprof/libcyc.a $@
$(BL)/libcyc_nocheck.a: $(LIBCYC_PREREQS) $(BB)/nocheck/libcyc.a include-directory
cp -p $(BB)/nocheck/libcyc.a $@
$(BL)/libxml.a: $(BB)/libxml.a
cp -p $< $@
$(BL)/libxml_g.a: $(BB)/gdb/libxml.a
cp -p $< $@
$(BL)/libxml_a.a: $(BB)/aprof/libxml.a
cp -p $< $@
$(BL)/libxml_pg.a: $(BB)/gprof/libxml.a
cp -p $< $@
$(BL)/libxml_nocheck.a: $(BB)/nocheck/libxml.a
cp -p $< $@
$(BL)/cyc-lib/%/nogc.a: build/%/nogc.a
cp -p $< $@
$(BL)/cyc-lib/%/nogc_g.a: build/%/gdb/nogc.a
cp -p $< $@
$(BL)/cyc-lib/%/nogc_a.a: build/%/aprof/nogc.a
cp -p $< $@
$(BL)/cyc-lib/%/nogc_pg.a: build/%/gprof/nogc.a
cp -p $< $@
$(BL)/cyc-lib/%/nogc_nocheck.a: build/%/nocheck/nogc.a
cp -p $< $@
ifeq ($(HAVE_PTHREAD),yes)
$(BL)/cyc-lib/%/nogc_pthread.a: build/%/pthread/nogc.a
cp -p $< $@
gc_pthread:
cp -r $(GC) $@
(cd $@; $(MAKE) clean; ./configure --enable-threads=pthreads --enable-shared=no --enable-cplusplus=no)
.PRECIOUS: gc_pthread gc_pthread/.libs/libgc.a
gc_pthread/.libs/libgc.a: gc_pthread
$(MAKE) -C $^ libgc.la CC="$(CC)" CFLAGS="$(CFLAGS)"
$(BL)/cyc-lib/%/gc_pthread.a: gc_pthread/.libs/libgc.a
cp -p $< $@
endif
$(BL)/cyc-lib/%/runtime_cyc.a: build/%/runtime_cyc.a
cp -p $< $@
$(BL)/cyc-lib/%/runtime_cyc_g.a: build/%/gdb/runtime_cyc.a
cp -p $< $@
$(BL)/cyc-lib/%/runtime_cyc_a.a: build/%/aprof/runtime_cyc.a
cp -p $< $@
$(BL)/cyc-lib/%/runtime_cyc_pg.a: build/%/gprof/runtime_cyc.a
cp -p $< $@
$(BL)/cyc-lib/%/runtime_cyc_nocheck.a: build/%/nocheck/runtime_cyc.a
cp -p $< $@
$(BL)/cyc-lib/%/runtime_cyc_pthread.a: build/%/pthread/runtime_cyc.a
cp -p $< $@
bin/cyclone-inf$(EXE): $(BB)/cyclone-inf$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cyclone$(EXE): $(BB)/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cyclone_g$(EXE): $(BB)/gdb/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cyclone_a$(EXE): $(BB)/aprof/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cyclone_pg$(EXE): $(BB)/gprof/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cyclone_nocheck$(EXE): $(BB)/nocheck/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cyc_setjmp.h
cp $< $@
bin/cycdoc$(EXE): $(BB)/cycdoc$(EXE)
cp $< $@
bin/buildlib$(EXE):: $(BB)/buildlib$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(build)/cycspecs
cp $(BB)/buildlib$(EXE) $@
# NB: the cp -p is used to preserve the time on the include files,
# which are prereqs of some .o files, namely, in tools/yakker.
# Without -p, those .o files would be out of date on every make.
include-directory:
for i in `(cd $(BB)/include; find * -type d)`;\
do mkdir -p $(BL)/cyc-lib/$(build)/include/$$i; done
for i in `(cd $(BB)/include; find * -name '*.h')`;\
do cp -p $(BB)/include/$$i $(BL)/cyc-lib/$(build)/include/$$i; done
# Directory structure of the installed library. (During boot,
# this is built in bin/lib ($(BL)).)
#
# lib/
# libcyc.a # "Regular" lib files go here as in gcc
# libcycboot.a # .. maybe the boot lib isn't regular?
# cyc-lib/ # "Special" compiler files go here
# cyc_include.h # Non-arch specific
# ARCH/ # i686-unknown-linux, etc.
# cyc_setjmp.h # These are all arch specific
# cycspecs
# gc.a
# include/ # Arch specific headers; non-arch spec elsewhere
# HEADERS # stdio.h, etc.
# nogc.a
# runtime_cyc.a
directories::
@mkdir -p $(BL)/cyc-lib/$(build)/include
@mkdir -p $(BB)
@mkdir -p $(BB)/include
@mkdir -p $(BB)/gdb
@mkdir -p $(BB)/aprof
@mkdir -p $(BB)/gprof
@mkdir -p $(BB)/nocheck
@mkdir -p $(BB)/pthread
ifneq ($(build),$(target))
@mkdir -p $(BT)
@mkdir -p $(BT)/include
endif
# FIX: we are not using the cycspecs file in the same way that
# gcc specs files are used, probably there should be just one
# entry for cyclone instead of separate entries for
# cyclone_target_cflags, cyclone_cc, etc.
$(BL)/cyc-lib/$(build)/cycspecs: config/buildspecs
echo "*cyclone_target_cflags:" > $@
echo " $(CFLAGS)" >> $@
echo "" >> $@
echo "*cyclone_cc:" >> $@
echo " $(CC)" >> $@
echo "" >> $@
echo "*cyclone_inc_path:" >> $@
echo " $(INC_INSTALL)" >> $@
echo "" >> $@
config/buildspecs "$(CC)" >> $@
$(BL)/cyc-lib/$(build)/cyc_setjmp.h: bin/cyc-lib/libc.cys bin/buildlib$(EXE)
bin/buildlib$(EXE) -B$(BL)/cyc-lib -d $(BB)/include -setjmp > $@
$(BL)/cyc-lib/cyc_include.h: bin/cyc-lib/cyc_include.h
cp $< $@
$(BL)/cyc-lib/$(build)/gc.a: $(GC)/.libs/libgc.a
cp -p $< $@
$(GC)/.libs/libgc.a:
$(MAKE) -C $(GC) libgc.la CC="$(CC)" CFLAGS="$(CFLAGS)"
# Print version to standard output -- used by makedist
version:
@echo $(VERSION)
tools: cyclone
$(MAKE) -C tools/stringify install
$(MAKE) -C tools/bison install
$(MAKE) -C tools/cyclex install
$(MAKE) -C tools/flex install
$(MAKE) -C tools/rewrite install
$(MAKE) -C tools/errorgen install
$(MAKE) -C tools/yakker cyclone-install
otherlibs: cyclone
ifeq ($(HAVE_PCRE),yes)
$(MAKE) -C otherlibs/pcre install
endif
ifeq ($(HAVE_SQLITE3),yes)
$(MAKE) -C otherlibs/sqlite3 install
endif
cyclone: \
directories \
bin/buildlib$(EXE) \
bin/cyclone$(EXE) \
$(BL)/libcycboot.a \
$(BL)/libcyc.a \
$(BL)/cyc-lib/$(build)/nogc.a \
$(BL)/cyc-lib/$(build)/runtime_cyc.a \
bin/cycdoc$(EXE)
banshee_engine:
$(MAKE) CC=$(CC) -C $(BANSHEE) banshee
cyclone-inf-inner: \
directories \
bin/cyclone-inf$(EXE)
ifeq ($(HAVE_PTHREAD),yes)
cyclone: \
$(BL)/cyc-lib/$(build)/runtime_cyc_pthread.a \
$(BL)/cyc-lib/$(build)/nogc_pthread.a \
$(BL)/cyc-lib/$(build)/gc_pthread.a
endif
cyclone-aprof: aprof bin/cyclone_a$(EXE)
aprof: \
$(BL)/libcycboot_a.a \
$(BL)/libcyc_a.a \
$(BL)/cyc-lib/$(build)/nogc_a.a \
$(BL)/cyc-lib/$(build)/runtime_cyc_a.a
$(MAKE) -C tools/aprof install
cyclone-gprof: gprof bin/cyclone_pg$(EXE)
gprof: \
$(BL)/libcycboot_pg.a \
$(BL)/libcyc_pg.a \
$(BL)/cyc-lib/$(build)/nogc_pg.a \
$(BL)/cyc-lib/$(build)/runtime_cyc_pg.a
cyclone-nocheck: nocheck bin/cyclone_nocheck$(EXE)
nocheck: \
$(BL)/libcycboot_nocheck.a \
$(BL)/libcyc_nocheck.a \
$(BL)/cyc-lib/$(build)/nogc_nocheck.a \
$(BL)/cyc-lib/$(build)/runtime_cyc_nocheck.a
cyclone-gdb: gdb bin/cyclone_g$(EXE)
# Currently, the -g flag to cyclone does not use these libraries.
# We include the make rules in case we want to use them in the future.
gdb: \
$(BL)/libcycboot_g.a \
$(BL)/libcyc_g.a \
$(BL)/cyc-lib/$(build)/nogc_g.a \
$(BL)/cyc-lib/$(build)/runtime_cyc_g.a
ifndef NO_XML_LIB
xml: tools $(BL)/libxml.a
aprof: tools $(BL)/libxml_a.a
gprof: tools $(BL)/libxml_pg.a
nocheck: tools $(BL)/libxml_nocheck.a
gdb: tools $(BL)/libxml_g.a
endif
.PHONY: all tools cyclone aprof gprof nocheck directories xml
.PHONY: include-directory include-target-directory
.PHONY: cyclone-aprof cyclone-gprof cyclone-nocheck
########################################################################
# FOR BUILDING A CROSS COMPILER #
########################################################################
# If a cross gcc is not installed you can still do some sanity
# checks on the build process by doing
#
# make target=XXXXXX TARGET_CC=gcc TARGET_CFLAGS=-DXXXXXX BTARGET=-DZZZZZZ all
#
ifneq ($(build),$(target))
$(BL)/cyc-lib/$(target)/libcycboot.a: $(BT)/libcycboot.a
cp -p $< $@
LIBCYC_TARGET_PREREQS = bin/cyclone$(EXE) \
$(BL)/cyc-lib/cyc_include.h $(BL)/cyc-lib/$(target)/cyc_setjmp.h
$(BL)/cyc-lib/$(target)/libcyc.a: $(LIBCYC_TARGET_PREREQS) \
$(BT)/libcyc.a include-target-directory
cp -p $(BT)/libcyc.a $@
$(BL)/cyc-lib/$(target)/libxml.a: $(BT)/libxml.a
cp -p $< $@
BTARGET=-b $(target)
bin/buildlib$(EXE):: $(BL)/cyc-lib/$(target)/cycspecs
# NB: as a side-effect this creates the include directory
include-target-directory:
for i in `(cd $(BT)/include; find * -type d)`;\
do mkdir -p $(BL)/cyc-lib/$(target)/include/$$i; done
for i in `(cd $(BT)/include; find * -name '*.h')`;\
do cp -p $(BT)/include/$$i $(BL)/cyc-lib/$(target)/include/$$i; done
directories::
@mkdir -p $(BL)/cyc-lib/$(target)/include
$(BL)/cyc-lib/$(target)/cycspecs: config/buildspecs
echo "*cyclone_target_cflags:" > $@
echo " $(TARGET_CFLAGS)" >> $@
echo "" >> $@
echo "*cyclone_cc:" >> $@
echo " $(TARGET_CC)" >> $@
echo "" >> $@
echo "*cyclone_inc_path:" >> $@
echo " $(INC_INSTALL)" >> $@
echo "" >> $@
config/buildspecs $(TARGET_CC) >> $@
$(BL)/cyc-lib/$(target)/cyc_setjmp.h: bin/cyc-lib/libc.cys bin/buildlib$(EXE)
bin/buildlib$(EXE) $(BTARGET) -B$(BL)/cyc-lib -d $(BT)/include -setjmp > $@
# FIX: can we cross compile the gc?
cyclone: \
$(BL)/cyc-lib/$(target)/libcycboot.a \
$(BL)/cyc-lib/$(target)/libcyc.a \
$(BL)/cyc-lib/$(target)/nogc.a \
$(BL)/cyc-lib/$(target)/runtime_cyc.a
ifeq ($(HAVE_PTHREAD),yes)
cyclone: \
$(BL)/cyc-lib/$(target)/nogc_pthread.a \
$(BL)/cyc-lib/$(target)/runtime_cyc_pthread.a
endif
ifndef NO_XML_LIB
xml: $(BL)/cyc-lib/$(target)/libxml.a
endif
endif
#########################################################################
# END CROSS COMPILE #
#########################################################################
# Store the compiler, libraries, and tools in the user-defined directories.
# Also, keep a record of what was copied for later uninstall.
install: all inc_install lib_install bin_install
uninstall: inc_uninstall lib_uninstall bin_uninstall
ifdef INC_INSTALL
inc_install:
$(SHELL) config/cyc_install include/* $(INC_INSTALL)
inc_uninstall:
$(SHELL) config/cyc_install -u $(INC_INSTALL)
else
inc_install inc_uninstall:
@(echo "no include directory specified"; exit 1)
endif
ifdef BIN_INSTALL
bin_install:
$(SHELL) config/cyc_install bin/cyclone$(EXE) bin/cyclone-inf$(EXE) bin/cycbison$(EXE) bin/cyclex$(EXE) bin/cycflex$(EXE) bin/rewrite$(EXE) bin/aprof$(EXE) bin/errorgen$(EXE) bin/stringify$(EXE) bin/yakker$(EXE) $(BIN_INSTALL)
bin_uninstall:
$(SHELL) config/cyc_install -u $(BIN_INSTALL)
else
bin_install bin_uninstall:
@(echo "no bin directory specified"; exit 1)
endif
ifdef LIB_INSTALL
lib_install:
$(SHELL) config/cyc_install $(BL)/* $(LIB_INSTALL)
lib_uninstall:
$(SHELL) config/cyc_install -u $(LIB_INSTALL)
else
lib_install lib_uninstall:
@(echo "no lib directory specified"; exit 1)
endif
.PHONY: install uninstall inc_install lib_install bin_install
.PHONY: inc_uninstall lib_uninstall bin_uninstall
BUILDDIR=build/boot
GENDIR=bin/genfiles
# These build off the Cyclone source files, but do not replace anything in bin
# We override BUILDDIR and CYCFLAGS for many nefarious purposes:
# cross-compiling, bootstrapping, profiling, ...
# We use the -r flag to eliminate built-in make rules. This is needed
# because of a circular dependence that arises when bootstrapping as with
# make cyclone_src BUILDDIR=build/boot1 CYCC=`pwd`/build/boot/cyclone
ifdef DEBUGBUILD
LIBSRC_FLAGS += DEBUGBUILD=X
endif
ifdef PROFILE
LIBSRC_FLAGS += PROFILE=X
endif
ifdef ALLOC_PROFILE
LIBSRC_FLAGS += ALLOC_PROFILE=X
endif
ifdef NOGC
LIBSRC_FLAGS += NOGC=X
endif
ifdef NOREGIONS
LIBSRC_FLAGS += NOREGIONS=X
endif
ifdef OPTBUILD
LIBSRC_FLAGS += OPTBUILD=X
endif
DO_LIBSRC=$(MAKE) -r -C $(BUILDDIR) -f $(CYCDIR)/Makefile_libsrc
DO_SRCINF=$(MAKE) -r -C $(BUILDDIR) -f $(CYCDIR)/Makefile_srcinf
src_inf_stats:
$(DO_SRCINF) inf_stats
clean_src_inf:
$(DO_SRCINF) clean_src_inf
cyclone_src_inf: cyclone-inf cyclone_src
$(DO_SRCINF) all
cyclone_src:
-mkdir -p $(BUILDDIR)
$(DO_LIBSRC) all
lib_src:
-mkdir -p $(BUILDDIR)
$(DO_LIBSRC) libs
cfiles:
-mkdir -p $(BUILDDIR)
$(DO_LIBSRC) cfiles
# Note: Tried doing this stuff with target-specific variables instead
# of recursive invocations, but it crashes gnumake 3.79.1
# due to "export CYCFLAGS" and "dbg_src: override CYCFLAGS+=-g".
# They say it's been fixed in their working version. The crash
# happens only when the rule (e.g. dbg_src) fires.
dbg_src:
$(MAKE) BUILDDIR=build/dbg CYCFLAGS="$(CYCFLAGS) -g" cyclone_src
dbg_lib_src:
$(MAKE) BUILDDIR=build/dbg CYCFLAGS="$(CYCFLAGS) -g" lib_src
# The update files that go from BUILDDIR to GENDIR.
BUILDDIR_UPDATE_FILES=$(UPDATE_SRCS) $(C_BOOT_LIBS) precore_c.h boot_cycstubs.c
# The update files that go from "lib" to GENDIR.
LIB_UPDATE_FILES=boot_cstubs.c nogc.c malloc.c cycinf.c $(C_RUNTIME) runtime_internal.h bget.h
# The update files that go from "lib" to "bin/cyc-lib".
CYC_LIB_UPDATE_FILES=cyc_include.h libc.cys
# This target compares the C files in bin/genfiles to those in src
# Lack of difference means running the update would have no real effect.
XS=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
cmp:
@for i in $(BUILDDIR_UPDATE_FILES);\
do (cmp -s $(GENDIR)/$$i $(BUILDDIR)/$$i\
|| echo $(XS) $$i CHANGED) done
@for i in $(CYCLONE_H);\
do (test ! -e lib/$$i || cmp -s include/$$i lib/$$i\
|| echo $(XS) lib/$$i CHANGED) done
@for i in $(LIB_UPDATE_FILES);\
do (cmp -s $(GENDIR)/$$i lib/$$i\
|| echo $(XS) $$i CHANGED) done
@for i in $(CYC_LIB_UPDATE_FILES);\
do (test ! -e lib/$$i\
|| cmp -s bin/cyc-lib/$$i lib/$$i\
|| echo $(XS) $$i CHANGED) done
# This target updates what is in bin/genfiles and include.
# It would be "dangerous" to invoke this target if we did not have
# version control. Only updates changed files (makes cvs faster).
update: cfiles
@for i in $(BUILDDIR_UPDATE_FILES);\
do (cmp -s $(BUILDDIR)/$$i $(GENDIR)/$$i\
|| (echo UPDATING $(GENDIR)/$$i;\
cp $(BUILDDIR)/$$i $(GENDIR)/$$i)) done
@for i in $(LIB_UPDATE_FILES);\
do (cmp -s lib/$$i $(GENDIR)/$$i\
|| (echo UPDATING $(GENDIR)/$$i;\
cp lib/$$i $(GENDIR)/$$i)) done
@for i in $(CYCLONE_H);\
do (test ! -e lib/$$i || cmp -s lib/$$i include/$$i\
|| (echo UPDATING include/$$i;\
mv lib/$$i include/$$i)) done
@for i in $(CYC_LIB_UPDATE_FILES);\
do (test ! -e lib/$$i\
|| cmp -s lib/$$i bin/cyc-lib/$$i\
|| (echo UPDATING bin/cyc-lib/$$i;\
mv lib/$$i bin/cyc-lib/$$i)) done
test_src_compiler: cyclone_src
@$(RM) -r build/boot_test_src_compiler
$(MAKE) cyclone_src BUILDDIR=build/boot_test_src_compiler CYCC=`pwd`/$(BUILDDIR)/cyclone
@cmp -s build/boot_test_src_compiler/cyclone `pwd`/$(BUILDDIR)/cyclone || \
(echo "XXXXXXXXX Compiler cannot build itself correctly." && false)
# a little testing (much more is in the tests directory)
test:
$(MAKE) -C tests CYCFLAGS="-g -save-c -pp"
test_bin:
$(MAKE) -C tests\
CYCC=$(CYCDIR)/bin/cyclone$(EXE)\
CYCBISON=$(CYCDIR)/bin/cycbison$(EXE)\
CYCFLAGS="-L$(CYCDIR)/$(BL) -g -save-c -pp -I$(CYCDIR)/include -B$(CYCDIR)/$(BL)/cyc-lib"
# The -I and -B flags are explained in Makefile_libsrc and should be
# kept in sync with the settings there
test_boot:
$(MAKE) -C tests\
CYCC=$(CYCDIR)/build/boot/cyclone$(EXE)\
CYCBISON=$(CYCDIR)/bin/cycbison$(EXE)\
CYCFLAGS="$(addprefix -I$(CYCDIR)/build/boot/, . include) $(addprefix -I$(CYCDIR)/, lib src include) -B$(CYCDIR)/build/boot -B$(CYCDIR)/lib -g -save-c -pp"\
LDFLAGS="-L$(CYCDIR)/build/boot -B$(CYCDIR)/$(BL)/cyc-lib -v"
clean_test:
$(MAKE) -C tests clean
# To do: a much safer and less kludgy way to clean build!
# To do: a way to clean individual directories in build.
clean_build:
mv build/CVS .build_CVS; \
EXITC=$$?; \
$(RM) -rf build/*; \
if [ "$$EXITC" = 0 ]; then \
mv .build_CVS build/CVS; \
fi
clean_nogc: clean_test clean_build
$(MAKE) -C tools/bison clean
$(MAKE) -C tools/cyclex clean
$(MAKE) -C tools/flex clean
$(MAKE) -C tools/rewrite clean
$(MAKE) -C tools/aprof clean
$(MAKE) -C tools/errorgen clean
$(MAKE) -C tools/stringify clean
$(MAKE) -C tools/yakker clean
$(MAKE) -C tests clean
# $(MAKE) -C doc clean
$(MAKE) -C lib/xml clean
$(MAKE) -C otherlibs/pcre clean
$(RM) -r $(BL)
$(RM) $(addprefix bin/, $(addsuffix $(EXE), cyclone cyclone_g cyclone_a cyclone_pg cyclone_nocheck cycdoc buildlib cycbison cyclex cycflex aprof rewrite errorgen stringify))
$(RM) *~ amon.out
clean: clean_nogc
$(MAKE) clean -C $(BANSHEE)
$(MAKE) clean -C $(GC)
$(RM) $(GC)/*.exe $(GC)/base_lib $(GC)/*.obj $(GC)/gc.lib
ifeq ($(HAVE_PTHREAD),yes)
$(RM) -r gc_pthread
endif
include Makefile_base