forked from jakogut/tinyvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
73 lines (54 loc) · 1.32 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
69
70
71
72
73
CC = gcc
AS = as
CFLAGS = -Wall -pipe -Iinclude/
OFLAGS =
LFLAGS = $(CFLAGS) -Llib/
ASFLAGS =
PEDANTIC_FLAGS = -ansi -pedantic -pedantic-errors
LIBTVM_SOURCES = $(wildcard libtvm/*.c)
LIBTVM_OBJECTS = $(LIBTVM_SOURCES:.c=.o)
TDB_SOURCES = $(wildcard tdb/*.c)
TDB_OBJECTS = $(TDB_SOURCES:.c=.o)
BIN_DIR = bin
LIB_DIR = lib
INC_DIR = include
PROGRAM_DIR = programs
INSTALL_PREFIX = /usr/
DEBUG = no
PROFILE = no
PEDANTIC = no
OPTIMIZATION = -O3
ifeq ($(DEBUG), yes)
CFLAGS += -g
OPTIMIZATION = -O0
endif
ifeq ($(PROFILE), yes)
CFLAGS += -pg
endif
ifeq ($(PEDANTIC), yes)
CFLAGS += $(PEDANTIC_FLAGS)
endif
CFLAGS += $(OPTIMIZATION)
all: libtvm tvmi tdb
install: libtvm tvmi
cp -f $(BIN_DIR)/tvmi $(INSTALL_PREFIX)/bin/
cp -rf $(INC_DIR)/tvm $(INSTALL_PREFIX)/include/
cp -f $(LIB_DIR)/libtvm* $(INSTALL_PREFIX)/lib/
uninstall:
rm -rf /usr/bin/tvmi
rm -rf /usr/include/tvmi
rm -rf /usr/lib/libtvm*
libtvm: $(LIBTVM_OBJECTS)
ar rcs $(LIB_DIR)/libtvm.a $(LIBTVM_OBJECTS)
# Build the TVM interpreter
tvmi: libtvm
$(CC) $(LFLAGS) tvmi.c -ltvm -o $(BIN_DIR)/tvmi
tdb: libtvm $(TDB_OBJECTS)
$(CC) $(LFLAGS) $(TDB_OBJECTS) -ltvm -o $(BIN_DIR)/tdb
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(BIN_DIR)/* $(LIB_DIR)/* libtvm/*.o tdb/*.o gmon.out *.save *.o core* vgcore*
rebuild: clean all
.PHONY : clean
.SILENT : clean