-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (35 loc) · 906 Bytes
/
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
SOURCES := main.c vm.c
VALUE_SOURCES := values/cons.c values/number.c values/nil.c values/process.c values/bytecode.c values/symbol.c values/string.c
SOURCES += $(VALUE_SOURCES)
OBJECTS=${SOURCES:.c=.o}
CC=gcc
EXECUTABLE=vlisp
WEBHTML=vlisp.html
ODIR=$(PWD)/objs
DEPS := value.h values/values.h vm.h
OBJ = $(patsubst %,$(ODIR)/%,$(OBJECTS))
all: init
all: local
init:
mkdir -p $(PWD)/objs/values
local: CC=clang
local: CFLAGS:=-g -c -Wall
local: LDFLAGS=
local: value.h values/values.h vm.h
local: $(EXECUTABLE)
local: $(EXECUTABLE)
$(EXECUTABLE): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
$(ODIR)/%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
#web: CC=clang
#web: CCFLAGS=-S -emit-llvm
#web: $(SOURCES) $(WEBHTML)
web:
emcc $(SOURCES) -o $(WEBHTML)
clean:
@echo "Cleaning..."
@rm -f *.html *.bc *.s *.ll *.o vlisp
@rm -rf objs
@rm -f values/*.o
.PHONY: all clean local