-
Notifications
You must be signed in to change notification settings - Fork 9
/
makefile
38 lines (28 loc) · 887 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
TARGET := sysreg2
.PHONY: all
all: $(TARGET)
CC=gcc
CXX=g++
INCLUDE_DIR = -I/usr/include/libvirt/ -I/usr/include/libxml2/
CFLAGS := $(INCLUDE_DIR) -g -O0 -std=c99 -D_GNU_SOURCE -Wall -Wextra
CXXFLAGS := $(INCLUDE_DIR) -g -O0 -D_GNU_SOURCE -Wall -Wextra
LFLAGS := -L/usr/lib64
LIBS := -lvirt -lxml2
SRCS_C := utils.c console.c options.c raddr2line.c revision.c
SRCS_CPP := virt.cpp libvirt.cpp vmware_player.cpp kvm.cpp virtualbox.cpp
OBJS_C := $(SRCS_C:.c=.o)
OBJS_CPP := $(SRCS_CPP:.cpp=.o)
$(TARGET): $(OBJS_C) $(OBJS_CPP)
$(CXX) $(LFLAGS) -o $@ $(OBJS_CPP) $(OBJS_C) $(LIBS)
rm revision.c
.c.o: revision.c $<
$(CC) $(INC) $(CFLAGS) -c $< -o $@
revision.c:
echo -n 'const char gGitCommit[] = "' > revision.c
echo -n $$(git describe --abbrev=7 --long --always) >> revision.c
echo '";' >> revision.c
.PHONY: clean
clean:
-@rm $(TARGET)
-@rm $(OBJS_C)
-@rm $(OBJS_CPP)