-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (34 loc) · 1010 Bytes
/
Makefile
File metadata and controls
40 lines (34 loc) · 1010 Bytes
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
UNAME_S := $(shell uname -s)
TARGET := genSD
SRC := src/generatingSD_unix.cpp
HEADERS := include/generatingSD.hpp include/generatingSD_unix.hpp
CXXFLAGS += -O3 -std=c++17
CPPFLAGS +=
LDFLAGS +=
LDLIBS +=
OPENMP_FLAGS :=
SYSROOT_FLAGS :=
ifeq ($(UNAME_S),Darwin)
ifeq ($(origin CXX),default)
CXX := clang++
endif
SDKROOT := $(shell xcrun --show-sdk-path)
CPPFLAGS += -I/opt/homebrew/include -I/opt/homebrew/opt/libomp/include
OPENMP_FLAGS := -Xpreprocessor -fopenmp
SYSROOT_FLAGS := -isysroot $(SDKROOT)
LDFLAGS += -L/opt/homebrew/opt/libomp/lib -Wl,-rpath,/opt/homebrew/opt/libomp/lib
LDLIBS += -lomp
else ifeq ($(UNAME_S),Linux)
ifeq ($(origin CXX),default)
CXX := g++
endif
OPENMP_FLAGS := -fopenmp
else
$(error Unsupported system "$(UNAME_S)". Supported systems: Darwin and Linux)
endif
all: $(TARGET)
$(TARGET): $(SRC) $(HEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(SYSROOT_FLAGS) $(OPENMP_FLAGS) $< -o $@ $(LDFLAGS) $(SYSROOT_FLAGS) $(OPENMP_FLAGS) $(LDLIBS)
clean:
rm -f $(TARGET)
.PHONY: all clean