-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
53 lines (37 loc) · 1.1 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
CXX:=g++
CXXFLAGS:=-g -std=gnu++11 -Wall -W -Werror
CFLAGS:=-I. -fno-builtin -m32
CFLAGS+=-Wall -W -Werror -Wno-unused-function
CLANGFLAGS:=$(CFLAGS) -Wno-incompatible-library-redeclaration
TESTS:=cmp_lt cmp_le cmp_gt cmp_ge cmp_eq cmp_ne swapcase loop func print_int fizzbuzz malloc struct nullptr switch_op global puts
OPT:=1
ifeq ($(OPT), 0)
else
CFLAGS+=-O
#TESTS+=hello
endif
TBINS:=$(TESTS:%=test/%) lisp lisp2d
TOBJS:=$(TBINS:=.o)
TASMS:=$(TBINS:=.s)
TBEFS:=$(TBINS:=.bef)
ALL=bc2bef befunge $(TOBJS) $(TASMS) $(TBEFS) $(TBINS)
all: $(ALL)
bc2bef.o: bc2bef.cc
g++ -c $(CXXFLAGS) $< -o $@
bc2bef: bc2bef.o
g++ $(CXXFLAGS) $< -L/usr/lib/llvm-3.6/lib -lLLVM-3.6 -o $@
befunge: befunge.cc
g++ $(CXXFLAGS) $< -o $@
$(TASMS): %.s: %.c Makefile libef.h
clang -S $(CLANGFLAGS) -emit-llvm $< -o $@
$(TOBJS): %.o: %.c Makefile libef.h
clang -c $(CLANGFLAGS) -emit-llvm $< -o $@
$(TBINS): %: %.c Makefile libef.h
gcc -g -MD $(CFLAGS) $< -o $@
$(TBEFS): %.bef: %.o bc2bef Makefile
./bc2bef -g $< > $@ 2> err || (cat err; rm $@; exit 1)
test: all
./test_bef.rb $(TESTS)
clean:
rm -f $(ALL) err *.d
-include *.d