Skip to content

Commit aef96f2

Browse files
Update cc calls in makefiles
1 parent 1bbd8bb commit aef96f2

File tree

7 files changed

+52
-33
lines changed

7 files changed

+52
-33
lines changed

compiler/bootstrap/compilation/arm8/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ifeq ($(OS),Darwin)
2929
endif
3030

3131
CFLAGS+=-O2
32-
LDFLAGS+=-lm
32+
LDLIBS+=-lm
3333
CMLS = $(wildcard *.cml)
3434
CML_PROGS = $(patsubst %.cml,%.cake$(SUFF),$(CMLS))
3535

@@ -39,7 +39,7 @@ all: cake$(SUFF)
3939
# Linking the CakeML compiler. On aarch
4040

4141
cake$(SUFF): cake.S basis_ffi.c
42-
$(CC) $(CFLAGS) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) $(EVALFLAG) -o $@ $(LDFLAGS)
42+
$(CC) $(CFLAGS) $< basis_ffi.c $(LOADLIBES) $(EVALFLAG) -o $@ $(LDFLAGS) $(LDLIBS)
4343

4444
# Note: While this Makefile is shared the sexpr files used in the example rules
4545
# below are only included in the verified cake-arm8-64.tar.gz release package
@@ -49,20 +49,20 @@ cake$(SUFF): cake.S basis_ffi.c
4949

5050
cake_verbose$(SUFF): cake-sexpr-64 basis_ffi.c cake$(SUFF)
5151
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --emit_empty_ffi=true --reg_alg=0 < $< > $<.S
52-
$(CC) $(CFLAGS) -DDEBUG_FFI -o $@ $<.S basis_ffi.c $(LDFLAGS)
52+
$(CC) $(CFLAGS) -DDEBUG_FFI -o $@ $<.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
5353

5454
# *UNVERIFIED* compiler supporting 32-bit targets; see cake-arm8-32.tar.gz for a
5555
# verified compiler
5656

5757
cake_unverified32$(SUFF): cake-sexpr-32 basis_ffi.c cake$(SUFF)
5858
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --reg_alg=0 < $< > $<.S
59-
$(CC) $(CFLAGS) -o $@ $<.S basis_ffi.c $(LDFLAGS)
59+
$(CC) $(CFLAGS) -o $@ $<.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
6060

6161
# Example of cross-compiling the compiler itself
6262
RISCV_CC ?= riscv64-unknown-linux-gnu-cc
6363
cake_riscv_host: cake-sexpr-64 basis_ffi.c cake$(SUFF)
6464
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --target=riscv --reg_alg=0 < $< > $<.riscv.S
65-
$(RISCV_CC) $(CFLAGS) -o $@ $<.riscv.S basis_ffi.c $(LDFLAGS)
65+
$(RISCV_CC) $(CFLAGS) -o $@ $<.riscv.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
6666

6767
# Using the CakeML compiler
6868

@@ -77,7 +77,7 @@ cake_riscv_host: cake-sexpr-64 basis_ffi.c cake$(SUFF)
7777
$(PREF)cake$(SUFF) $(CAKEFLAGS) --target=arm8 <$< >$@
7878

7979
%.cake$(SUFF) : %.cake.S basis_ffi.c
80-
$(CC) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) -o $@ $(LDFLAGS)
80+
$(CC) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) -o $@ $(LDFLAGS) $(LDLIBS)
8181

8282
clean:
8383
$(RM) basis_ffi.o cake.o cake$(SUFF) *.cake.o *.cake.S *.cake$(SUFF)

compiler/bootstrap/compilation/x64/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ifeq ($(OS),Darwin)
2727
endif
2828

2929
CFLAGS+=-O2
30-
LDFLAGS+=-lm
30+
LDLIBS+=-lm
3131
CMLS = $(wildcard *.cml)
3232
CML_PROGS = $(patsubst %.cml,%.cake$(SUFF),$(CMLS))
3333

@@ -37,7 +37,7 @@ all: cake$(SUFF)
3737
# Linking the CakeML compiler
3838

3939
cake$(SUFF): cake.S basis_ffi.c
40-
$(CC) $(CFLAGS) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) $(EVALFLAG) -o $@ $(LDFLAGS)
40+
$(CC) $(CFLAGS) $< basis_ffi.c $(LOADLIBES) $(EVALFLAG) -o $@ $(LDFLAGS) $(LDLIBS)
4141

4242
# Note: While this Makefile is shared the sexpr files used in the example rules
4343
# below are only included in the verified cake-x64-64.tar.gz release package
@@ -47,20 +47,20 @@ cake$(SUFF): cake.S basis_ffi.c
4747

4848
cake_verbose$(SUFF): cake-sexpr-64 basis_ffi.c cake$(SUFF)
4949
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --emit_empty_ffi=true --reg_alg=0 < $< > $<.S
50-
$(CC) $(CFLAGS) -DDEBUG_FFI -o $@ $<.S basis_ffi.c $(LDFLAGS)
50+
$(CC) $(CFLAGS) -DDEBUG_FFI -o $@ $<.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
5151

5252
# *UNVERIFIED* compiler supporting 32-bit targets; see cake-x64-32.tar.gz for a
5353
# verified compiler
5454

5555
cake_unverified32$(SUFF): cake-sexpr-32 basis_ffi.c cake$(SUFF)
5656
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --reg_alg=0 < $< > $<.S
57-
$(CC) $(CFLAGS) -o $@ $<.S basis_ffi.c $(LDFLAGS)
57+
$(CC) $(CFLAGS) -o $@ $<.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
5858

5959
# Example of cross-compiling the compiler itself
6060
RISCV_CC ?= riscv64-unknown-linux-gnu-cc
6161
cake_riscv_host: cake-sexpr-64 basis_ffi.c cake$(SUFF)
6262
CML_STACK_SIZE=1000 CML_HEAP_SIZE=6000 $(PREF)cake$(SUFF) --sexp=true --exclude_prelude=true --skip_type_inference=true --target=riscv --reg_alg=0 < $< > $<.riscv.S
63-
$(RISCV_CC) $(CFLAGS) -o $@ $<.riscv.S basis_ffi.c $(LDFLAGS)
63+
$(RISCV_CC) $(CFLAGS) -o $@ $<.riscv.S basis_ffi.c $(LDFLAGS) $(LDLIBS)
6464

6565
# Using the CakeML compiler
6666

@@ -75,7 +75,7 @@ cake_riscv_host: cake-sexpr-64 basis_ffi.c cake$(SUFF)
7575
$(PREF)cake$(SUFF) $(CAKEFLAGS) <$< >$@
7676

7777
%.cake$(SUFF) : %.cake.S basis_ffi.c
78-
$(CC) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) -o $@ $(LDFLAGS)
78+
$(CC) $< basis_ffi.c $(LOADLIBES) $(LDLIBS) -o $@ $(LDFLAGS) $(LDLIBS)
7979

8080
clean:
8181
$(RM) basis_ffi.o cake.o cake$(SUFF) *.cake.o *.cake.S *.cake$(SUFF)

examples/compilation/x64/Holmakefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,37 @@ endif
1616
ifndef CC
1717
CC=gcc
1818
endif
19+
20+
CFLAGS+=-O2
21+
LDLIBS+=-lm
22+
1923
cat.S: *catCompileScript.sml
2024
cake_cat: cat.S $(CAKEMLDIR)/basis/basis_ffi.o
21-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
25+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
2226
grep.S: *grepCompileScript.sml
2327
cake_grep: grep.S $(CAKEMLDIR)/basis/basis_ffi.o
24-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
28+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
2529
patch.S: *patchCompileScript.sml
2630
cake_patch: patch.S $(CAKEMLDIR)/basis/basis_ffi.o
27-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
31+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
2832
diff.S: *diffCompileScript.sml
2933
cake_diff: diff.S $(CAKEMLDIR)/basis/basis_ffi.o
30-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
34+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
3135
hello.S: *helloCompileScript.sml
3236
cake_hello: hello.S $(CAKEMLDIR)/basis/basis_ffi.o
33-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
37+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
3438
sort.S: *sortCompileScript.sml
3539
cake_sort: sort.S $(CAKEMLDIR)/basis/basis_ffi.o
36-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
40+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
3741
echo.S: *echoCompileScript.sml
3842
cake_echo: echo.S $(CAKEMLDIR)/basis/basis_ffi.o
39-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
43+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
4044
helloErr.S: *helloErrCompileScript.sml
4145
cake_helloErr: helloErr.S $(CAKEMLDIR)/basis/basis_ffi.o
42-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
46+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
4347
iocat.S: *iocatCompileScript.sml
4448
cake_iocat: iocat.S $(CAKEMLDIR)/basis/basis_ffi.o
45-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
49+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
4650

4751
exec: cake_cat cake_grep cake_patch cake_diff cake_hello cake_sort cake_echo cake_helloErr cake_iocat
4852
.PHONY: exec

examples/deflate/translation/compilation/Holmakefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
INCLUDES = $(CAKEMLDIR)/examples/deflate $(CAKEMLDIR)/examples/deflate/translation $(CAKEMLDIR)/compiler $(CAKEMLDIR)/cv_translator
1+
INCLUDES=$(CAKEMLDIR)/examples/deflate\
2+
$(CAKEMLDIR)/examples/deflate/translation\
3+
$(CAKEMLDIR)/compiler\
4+
$(CAKEMLDIR)/cv_translator
5+
6+
CFLAGS+=-O2
7+
LDLIBS+=-lm
28

39
all: $(DEFAULT_TARGETS) README.md
410

@@ -19,16 +25,16 @@ deflateEncode.S: deflateEncodeCompileScript.sml
1925
deflateDecode.S: deflateDecodeCompileScript.sml
2026

2127
compression: compression.S
22-
gcc -o compression compression.S $(CAKEMLDIR)/basis/basis_ffi.c
28+
$(CC) $(CFLAGS) -o $@ $< $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
2329

2430
decompression: decompression.S
25-
gcc -o decompression decompression.S $(CAKEMLDIR)/basis/basis_ffi.c
31+
$(CC) $(CFLAGS) -o $@ $< $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
2632

2733
deflateEncode: deflateEncode.S
28-
gcc -o deflateEncode deflateEncode.S $(CAKEMLDIR)/basis/basis_ffi.c
34+
$(CC) $(CFLAGS) -o $@ $< $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
2935

3036
deflateDecode: deflateDecode.S
31-
gcc -o deflateDecode deflateDecode.S $(CAKEMLDIR)/basis/basis_ffi.c
37+
$(CC) $(CFLAGS) -o $@ $< $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
3238

3339
cleanBin:
3440
rm -f compression.S decompression.S deflateDecode.S deflateEncode.S compression decompression deflateDecode deflateEncode

examples/opentheory/compilation/Holmakefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/cv_translator $(CAKEMLDIR)/compiler $(
33
all: $(DEFAULT_TARGETS) README.md
44
.PHONY: all
55

6+
CFLAGS+=-O2
7+
LDLIBS+=-lm
8+
69
README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml)
710
DIRS = $(wildcard */)
811
README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES)
@@ -13,6 +16,6 @@ HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap
1316
endif
1417

1518
reader: reader.S $(CAKEMLDIR)/basis/basis_ffi.o
16-
$(CC) $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(GCCFLAGS) -o $@
19+
$(CC) $(CFLAGS) -o $@ $< $(protect $(CAKEMLDIR)/basis/basis_ffi.o) $(LDLIBS)
1720

1821
EXTRA_CLEANS=reader reader.S

examples/sat_encodings/translation/compilation/Holmakefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ ifdef POLY
1111
HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap
1212
endif
1313

14+
CFLAGS+=-O2
15+
LDLIBS+=-lm
16+
1417
graphColoring_encoder: graphColoringEncoderCompileTheory.uo
15-
gcc -o graphColoring_encoder graphColoring_encoder.S $(CAKEMLDIR)/basis/basis_ffi.c
18+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
1619

1720
killerSudoku_encoder: killerSudokuEncoderCompileTheory.uo
18-
gcc -o killerSudoku_encoder killerSudoku_encoder.S $(CAKEMLDIR)/basis/basis_ffi.c
21+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
1922

2023
nQueens_encoder: nQueensEncoderCompileTheory.uo
21-
gcc -o nQueens_encoder nQueens_encoder.S $(CAKEMLDIR)/basis/basis_ffi.c
24+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
2225

2326
numBoolRange_encoder: numBoolRangeEncoderCompileTheory.uo
24-
gcc -o numBoolRange_encoder numBoolRange_encoder.S $(CAKEMLDIR)/basis/basis_ffi.c
27+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)
2528

2629
sudoku_encoder: sudokuEncoderCompileTheory.uo
27-
gcc -o sudoku_encoder sudoku_encoder.S $(CAKEMLDIR)/basis/basis_ffi.c
30+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)

examples/vipr/compilation/Holmakefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ ifdef POLY
1111
HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap
1212
endif
1313

14+
CFLAGS+=-O2
15+
LDLIBS+=-lm
16+
1417
cake_vipr: viprCompileTheory.uo
15-
gcc -o cake_vipr cake_vipr.S $(CAKEMLDIR)/basis/basis_ffi.c
18+
$(CC) $(CFLAGS) -o $@ $@.S $(CAKEMLDIR)/basis/basis_ffi.c $(LDLIBS)

0 commit comments

Comments
 (0)