forked from 1inch/profanity2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (47 loc) · 1.77 KB
/
Copy pathMakefile
File metadata and controls
54 lines (47 loc) · 1.77 KB
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
CC=g++
CDEFINES=
SOURCES=Dispatcher.cpp Mode.cpp precomp.cpp profanity.cpp SpeedSample.cpp
OBJECTS=$(SOURCES:.cpp=.o)
# On Windows the OS environment variable is always set to Windows_NT.
# Checking it first avoids calling `uname`, which is unavailable outside
# of MSYS2/Cygwin shells (e.g. when using mingw32-make from cmd.exe).
ifeq ($(OS),Windows_NT)
EXECUTABLE=profanity2.exe
# -mcmodel=large is not reliably supported by MinGW GCC on Windows
# targets, and htonl/ntohl live in ws2_32 there.
# -static bundles the MinGW runtimes (libstdc++, libgcc, winpthread) so
# the exe runs outside the MSYS2 shell; OpenCL.dll itself must stay
# dynamic (it is the system ICD loader), but with -static the linker
# skips .dll.a import libs for -lOpenCL, hence the explicit -l: name.
LDFLAGS=-s -static -l:libOpenCL.dll.a -lws2_32
CFLAGS=-c -std=c++11 -Wall -mmmx -O2
# MSYSTEM is set inside MSYS2 shells, where unix commands are available.
ifdef MSYSTEM
RM=rm -f
else
RM=del /Q
endif
else
EXECUTABLE=profanity2.x64
RM=rm -f
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS=-framework OpenCL
CFLAGS=-c -std=c++11 -Wall -O2
else
LDFLAGS=-s -lOpenCL -mcmodel=large
CFLAGS=-c -std=c++11 -Wall -mmmx -O2 -mcmodel=large
endif
endif
HEADERS=ArgParser.hpp CLMemory.hpp create2.hpp Dispatcher.hpp help.hpp lexical_cast.hpp Mode.hpp precomp.hpp SpeedSample.hpp types.hpp
all: $(SOURCES) $(EXECUTABLE)
# Every object against every header. Coarse, and coarse is the right side to err
# on: what the alternative gets wrong is a binary built from a header that has
# changed since, which runs and is wrong rather than failing to build.
$(OBJECTS): $(HEADERS)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $(CDEFINES) $< -o $@
clean:
$(RM) *.o