-
Notifications
You must be signed in to change notification settings - Fork 106
/
makefile
executable file
·67 lines (54 loc) · 1.92 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
61
62
63
64
65
66
67
CC = g++ -std=c++14 -Wall
TARGET = Sibernetic
RM := rm -rf
#TEST_SOURCES = src/test/owPhysicTest.cpp
SRCEXT := cpp
SRCDIR := src
INCDIR := inc
BUILDDIR = ./Release
BINARYDIR = $(BUILDDIR)/obj
SOURCES = $(wildcard $(SRCDIR)/*.$(SRCEXT))
BINARYTESTDIR = $(BINARYDIR)/test
OBJECTS := $(patsubst $(SRCDIR)/%,$(BINARYDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
OBJECTS += $(BINARYTESTDIR)/owPhysicTest.o
PYTHON_CONFIG ?= /usr/bin/python3.7-config
CPP_DEPS = $(OBJECTS:.o=.d)
LIBS := -lGL -lGLU -lOpenCL -lrt -lglut
# For python3.8+, you have to include a --embed option
PYTHON_CONFIG_BASENAME=$(basename $(PYTHON_CONFIG))
PYTHON_VERSION=$(patsubst python%-config,%,$(PYTHON_CONFIG_BASENAME))
ifneq (,$(findstring 3.6,$(PYTHON_CONFIG)))
LIBS += $(shell $(PYTHON_CONFIG) --libs)
CXXFLAGS += $(shell $(PYTHON_CONFIG) --cflags)
else ifneq (,$(findstring 3.7,$(PYTHON_CONFIG)))
LIBS += $(shell $(PYTHON_CONFIG) --libs)
CXXFLAGS += $(shell $(PYTHON_CONFIG) --cflags)
else
LIBS += $(shell $(PYTHON_CONFIG) --embed --libs)
CXXFLAGS += $(shell $(PYTHON_CONFIG) --embed --cflags)
endif
CXXFLAGS += -fPIE
EXTRA_LIBS := -L/usr/lib64/OpenCL/vendors/amd/ -L/opt/AMDAPP/lib/x86_64/ -L/usr/lib/x86_64-linux-gnu/
all: CXXFLAGS += -O3
all : $(TARGET)
debug: CXXFLAGS += -ggdb -O0
debug: $(TARGET)
$(TARGET):$(OBJECTS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(CC) $(CXXFLAGS) $(EXTRA_LIBS) -o $(BUILDDIR)/$(TARGET) $(OBJECTS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
$(BINARYDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(BINARYDIR)
@mkdir -p $(BINARYTESTDIR)
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
$(CC) $(CXXFLAGS) -I/opt/AMDAPPSDK-3.0/include/ -I/opt/AMDAPP/include/ -I$(INCDIR) -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
clean :
-$(RM) $(OBJECTS)$(CPP_DEPS) $(BUILDDIR)/$(TARGET)
-@echo ' '
.PHONY: all clean dependents
.SECONDARY: