-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile_mac
More file actions
40 lines (30 loc) · 746 Bytes
/
Makefile_mac
File metadata and controls
40 lines (30 loc) · 746 Bytes
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
# Makefile for SPICY Compiler + Build Pipeline
# Variables
OCAMLBUILD := ocamlbuild -use-menhir
CC := clang
SPICYC := spicyc
SRC := test2.spicy
IR := program.ll
BIN := $(basename $(SRC))
.PHONY: all spicyc ir compile run test clean
# Default: compile then run
all: compile run
# 1) Build the SPICY compiler frontend
spicyc:
$(OCAMLBUILD) main.native
mv main.native $(SPICYC)
# 2) Emit LLVM IR from SPICY source
ir: spicyc
./$(SPICYC) $(SRC) > $(IR)
# 3) Compile IR to native executable
compile: ir
$(CC) $(IR) -o $(BIN)
# 4) Run the compiled program
run: compile
./$(BIN)
test: spicyc
bash tests/run_tests.sh
# Clean all build artifacts
clean:
$(OCAMLBUILD) -clean
rm -f $(SPICYC) $(IR) $(BIN)