forked from jakogut/tinyvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
68 lines (51 loc) · 1.15 KB
/
GNUmakefile
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
58
59
60
61
62
63
64
65
66
67
68
CC = gcc
AS = as
CXXFLAGS = -Wall -pipe -Iinclude/
CFLAGS = $(CXXFLAGS) -c
LFLAGS = $(CXXFLAGS) -L lib/
ASFLAGS =
PEDANTIC_FLAGS = -ansi -pedantic -pedantic-errors
LIBTVM_SOURCES = $(wildcard libtvm/*.c)
LIBTVM_OBJECTS = $(LIBTVM_SOURCES:.c=.o)
BIN_DIR = bin
LIB_DIR = lib
INC_DIR = include
PROGRAM_DIR = programs
DEBUG = no
PROFILE = no
PEDANTIC = no
OPTIMIZATION = -O3
ifeq ($(DEBUG), yes)
CXXFLAGS += -g
OPTIMIZATION = -O0
endif
ifeq ($(PROFILE), yes)
CXXFLAGS += -pg
endif
ifeq ($(PEDANTIC), yes)
CXXFLAGS += $(PEDANTIC_FLAGS)
endif
CXXFLAGS += $(OPTIMIZATION)
all: libtvm tvmi
install: libtvm tvmi
cp -f bin/tvmi /usr/bin/
cp -rf include/tvm /usr/include/
cp -f lib/libtvm* /usr/lib/
uninstall:
rm -rf /usr/bin/tvmi
rm -rf /usr/include/tvmi
rm -rf /usr/lib/libtvm*
libtvm: $(LIBTVM_OBJECTS)
mkdir -p $(LIB_DIR)
ar rcs $(LIB_DIR)/libtvm.a $(LIBTVM_OBJECTS)
# Build the TVM interpreter
tvmi: libtvm
mkdir -p $(BIN_DIR)
$(CC) $(LFLAGS) tvmi.c -ltvm -o $(BIN_DIR)/tvmi
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf $(BIN_DIR)/* $(LIB_DIR)/* libtvm/*.o gmon.out *.save *.o core* vgcore*
rebuild: clean all
.PHONY : clean
.SILENT : clean