-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 1.28 KB
/
Makefile
File metadata and controls
44 lines (34 loc) · 1.28 KB
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
.DEFAULT_GOAL := main
GIT_COMMIT = $(shell git rev-parse HEAD)
SRC_DIR = src
EXAMPLE_DIR = examples
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(SRC:.c=.o)
main: $(OBJ)
clang++ -g $(OBJ) `llvm-config --cxxflags --ldflags --libs core executionengine mcjit interpreter irreader analysis native bitwriter --system-libs` -o main
debug-llvm: $(OBJ)
clang++ -g $(OBJ) `~/dev/llvm-project/build/bin/llvm-config --cxxflags --ldflags --libs core executionengine mcjit interpreter irreader analysis native bitwriter --system-libs` -o main
$(SRC_DIR)/main.o: $(SRC_DIR)/main.c
echo "#define VERSION \"$(shell git name-rev --tags --name-only $(GIT_COMMIT)) - $(GIT_COMMIT)\"" > $(SRC_DIR)/version.h
clang -c -g -I$(SRC_DIR) `llvm-config --cflags` $< -o $@
$(SRC_DIR)/%.o: $(SRC_DIR)/%.c
clang -c -g -I$(SRC_DIR) `llvm-config --cflags` $< -o $@
hello-world: main
./main build examples/hello-world.sith
./examples/hello-world
conditional: main
./main build examples/conditional.sith
./examples/conditional
switch: main
./main build examples/switch.sith
./examples/switch
variables: main
./main build examples/variables.sith
./examples/variables
ir: main
for f in {examples,lib/c,lib/data}/*.sith; do \
echo "./main buildir $$f"; \
./main buildir $$f; \
done
setup:
ln -s ./lib /usr/local/lib/sith