-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (49 loc) · 1.21 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
58
59
60
OS := $(shell uname)
ARCH := $(shell uname -m)
ifeq ($(OS), Linux)
ifeq ($(ARCH), x86_64)
LEAP_LIBRARY := ./LeapSDK/lib/x64/libLeap.so -Wl,-rpath,./LeapSDK/lib/x64
else
LEAP_LIBRARY := ./LeapSDK/lib/x86/libLeap.so -Wl,-rpath,./LeapSDK/lib/x86
endif
else
# OS X
LEAP_LIBRARY := ./LeapSDK/lib/libLeap.dylib
endif
ECHO = printf
CAT = cat
RM = rm
FIND = find
CPPFLAGS= -std=c++11 -ggdb -Wall -W -Wextra
LDFLAGS =
CC = g++
LD = g++
SRCD = src
INCD = -Iinclude -I./LeapSDK/include
OBJD = obj
BIND = bin
LIBD =
LIBS =
EXEC = LeapServer
SRCS = $(wildcard $(SRCD)/*.cpp)
OBJ = $(SRCS:.cpp=.o)
OBJS := $(addprefix $(OBJD)/, $(notdir $(OBJ)))
default: $(BIND) $(OBJD) $(BIND)/$(EXEC)
$(BIND)/$(EXEC): $(OBJS)
@$(ECHO) "Linking ..\n"
$(LD) -o $@ $^ $(LDFLAGS) $(LIBD) $(LIBS) $(LEAP_LIBRARY)
ifeq ($(OS), Darwin)
install_name_tool -change @loader_path/libLeap.dylib LeapSDK/lib/libLeap.dylib $(BIND)/$(EXEC)
endif
$(OBJD)/%.o: $(SRCD)/%.cpp
@$(ECHO) "Compiling source file ..\n"
$(CC) -o $@ -c $< $(CPPFLAGS) $(INCD)
$(OBJD):
@mkdir -p $(OBJD)
$(BIND):
@mkdir -p $(BIND)
clean:
@$(FIND) $(OBJD) -name *.o -delete
mrproper: clean
@$(RM) -f $(BIND)/$(EXEC)
@$(RM) -rf $(OBJD) $(BIND)