forked from UPenn-RoboCup/UPennDev2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.inc
87 lines (79 loc) · 2.42 KB
/
Makefile.inc
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Makefile Includes
OSTYPE=$(shell uname -s|awk '{print tolower($$0)}')
# Compiler Definitions
CXX=c++
CC=cc
CXXFLAGS=-O3 -fpic -pedantic -Wall
CFLAGS=-O3 -fpic -pedantic -Wall
# Linker Definitions
LD=g++ -shared
#LD=ld -shared -lstdc++
LDFLAGS=-L/usr/local/lib
LIBRT=-lrt
SHLIBEXT=so
STRIP=strip
USE_TORCH=1
INCLUDES=-I/usr/local/include
LUA_VERSION=5.1
LUAJIT_VERSION=2.1
ifeq ($(shell pkg-config --exists luajit && echo 0),0)
LUA_INC=`pkg-config luajit --cflags`
LUA_LIB=`pkg-config luajit --libs`
#LUA_INC=-I/usr/local/include/luajit-$(LUAJIT_VERSION)
#LUA_INC=$(pkg-config --cflags-only-I luajit)
else ifeq ($(shell pkg-config --exists lua$(LUA_VERSION) && echo 0),0)
LUA_INC=`pkg-config lua$(LUA_VERSION) --cflags`
LUA_LIB=`pkg-config lua$(LUA_VERSION) --libs`
#LUA_INC=-I/usr/include/lua5.1 -I/usr/local/include/lua5.1
#LUA_INC=$(pkg-config --cflags-only-I lua5.1)
else
LUA_INC=`pkg-config lua --cflags`
LUA_LIB=`pkg-config lua --libs`
endif
INCLUDES+=$(LUA_INC)
# OS Specific overrides
ifeq ($(OSTYPE),darwin)
LD=g++
#LD=ld -macosx_version_min 10.10
#LDFLAGS=-lc++ -bundle -undefined dynamic_lookup
LDFLAGS=-lstdc++ -bundle -undefined dynamic_lookup -L/usr/local/lib
LIBRT=
# CFLAGS+=$(pkg-config lua5.1 --cflags)
# CXXFLAGS+=$(pkg-config lua5.1 --cflags)
else # Linux
# CFLAGS+= -mtune=native -march=native `pkg-config lua5.1 --cflags`
# CXXFLAGS+= -mtune=native -march=native `pkg-config lua5.1 --cflags`
CFLAGS+= -mtune=native -march=native
CXXFLAGS+= -mtune=native -march=native
endif
# Verbose mode check
V=@
ifdef VERBOSE
V=
endif
# From Julia Make.inc
ENDCOLOR="\033[0m"
SRCCOLOR="\033[33m"
CCCOLOR="\033[34m"
CXXCOLOR="\033[32;1m"
LINKCOLOR="\033[34;1m"
BINCOLOR="\033[37;1m"
INFOCOLOR="\033[32m"
CLEANCOLOR="\033[35m"
# Default compiling for modules
all none: $(LIBNAME)
%.o: %.cpp
@printf '\t%b %b\n' $(CXXCOLOR)CXX$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
$(V)$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ -c $<
%.o: %.cc
@printf '\t%b %b\n' $(CXXCOLOR)CXX$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
$(V)$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ -c $<
%.o: %.c
@printf '\t%b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
$(V)$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
$(LIBNAME): lua_$(LIBNAME).o $(EXTRA_OBJ)
@printf '\t%b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR);
$(V)$(LD) -o $@.$(SHLIBEXT) $^ $(EXTRA_LINK) $(LDFLAGS)
clean:
@printf '\t%b %b\n' $(CLEANCOLOR)Cleaning$(ENDCOLOR) $(shell pwd);
$(V)rm -f *.so *.o $(EXTRA_CLEAN)