-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
57 lines (43 loc) · 1.09 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
54
55
56
57
CC=g++
PWD=`pwd`
# external libraries used for this interpreter
INCDIRS := ./include/
LIBS :=
SOURCES = ./src/lalr.cpp \
./src/lrparser.cpp \
./src/terminal.cpp \
./src/stream.cpp \
./src/data.cpp \
./src/boot.cpp \
./src/language.cpp
ifdef DEBUG
OPTARG := -g
TDIR := debug
else
OPTARG := -O4
TDIR := release
endif
ifdef PROFILE
PROFARG := -pg
else
PROFARG :=
endif
OBJECTS := $(addprefix build/obj/$(TDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
CPPFLAGS := -pthread $(INCDIRS:%=-I%) $(OPTARG) $(PROFARG) -m64 -Wall -Wno-deprecated
LIBTEXT := $(addprefix -l, $(LIBS))
build/lib/libww.a: dirs $(OBJECTS)
ar rcs build/lib/libww.a $(OBJECTS)
build/obj/$(TDIR)/%.o:%.cpp
$(CC) $(CPPFLAGS) -c $< -o $@
build/obj/$(TDIR)/%.o:%.mm
$(CC) $(CPPFLAGS) -c $< -o $@
build/obj/$(TDIR)/%.o:%.c
$(CC) $(CPPFLAGS) -c $< -o $@
build/obj/$(TDIR)/%.o:%.m
$(CC) $(CPPFLAGS) -c $< -o $@
dirs:
mkdir -p build/obj/$(TDIR)/
mkdir -p build/lib/
find . -type d | grep -v "build" | grep -v '\.$$' | awk '{print "build/obj/$(TDIR)/" $$0}' | xargs mkdir -p
clean:
rm -rf build/*