forked from EthanArmbrust/new-prime-seed-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (56 loc) · 1.71 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
#============================================
#=============Setting defaults===============
#============================================
CXX = g++
CXXFLAGS = -c -std=c++11 -O3
LDFLAGS = -static-libgcc -static-libstdc++
UNAME_S := $(shell uname -s)
FOR_WIN := FALSE
SOURCES = ./src/main.cpp ./src/Random.cpp ./src/logChecker.cpp ./src/BigInteger/BigUnsigned.cc ./src/BigInteger/BigUnsignedInABase.cc ./src/BigInteger/BigIntegerUtils.cc ./src/BigInteger/BigInteger.cc
OBJECTS= $(SOURCES:.cpp=.o)
BIN_DIR = ./bin/
WINDRES = windres
CLEANUP = ./src/*.o
#============================================
#=Operating system specific compiler options=
#============================================
ifeq ($(OS),Windows_NT)
EXECUTABLE := bin/SeedGenerator.exe
SOURCES += ./src/sgIcon.res
CLEANUP += ./src/*.res
else
ifeq ($(UNAME_S),Linux)
LDFLAGS += -pthread
EXECUTABLE := bin/SeedGeneratorLinux
endif
ifeq ($(UNAME_S),Darwin)
CXX := clang++
CXXFLAGS += -stdlib=libc++
LDFLAGS :=
EXECUTABLE := bin/SeedGeneratorMac
endif
ifeq ($(CXX),i686-w64-mingw32-g++-posix)
EXECUTABLE := bin/SeedGenerator.exe
WINDRES := i686-w64-mingw32-windres
SOURCES += ./src/sgIcon.res
LDFLAGS += -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
CLEANUP += ./src/*.res
endif
endif
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
@if [ -d "./bin" ]; then \
echo "\033[1;36mBin folder already exists"; else\
mkdir bin; \
fi
@echo "\033[1;34mLinking objects"
@$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
.cpp.o:
@echo "\033[1;32mBuilding \033[0;32m$<"
@$(CXX) $(CXXFLAGS) $< -o $@
src/sgIcon.res: src/sgIcon.rc
@echo "\033[1;32mBuilding \033[0;32m$<"
@$(WINDRES) $< -O coff -o $@
clean:
@echo "\033[1;31mDeleting compiled objects..."
@rm $(CLEANUP)