-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile-mingw64-static
62 lines (45 loc) · 1.77 KB
/
Makefile-mingw64-static
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
CC=gcc
CXX=g++
AS=g++
AR=ar
TARGET_ROOT = ./target
TARGET = $(TARGET_ROOT)/release-win-gcc-static-x64
OBJ_ROOT = obj
OBJ ?= $(OBJ_ROOT)/release-win-gcc-static-x64
LIB_NAME=libio
LIBS?=-liconv.dll -lgnutls.dll -lWs2_32
INCLUEDS?=-Iinclude -Iinclude/win -Iinclude/net -Isrc
PLATFORM_OPT_OPTIONS?=-minline-stringops-dynamically -mavx -mavx2 -mlzcnt -mmovbe
OPTIMIZE?=-mtune=generic -O3 -fno-exceptions -fno-rtti -fdeclone-ctor-dtor -fdevirtualize-at-ltrans $(PLATFORM_OPT_OPTIONS)
SHARED-DEFINES?=-DIO_BUILD
DEFINES ?= -DNDEBUG $(SHARED-DEFINES)
CPPFLAGS?= -std=gnu++14 -fno-exceptions -fno-rtti -Winline -pedantic $(OPTIMIZE) $(INCLUEDS)
LDFLAGS?=$(LIBS)
MODULES=. win net
SRC_DIR := $(addprefix ./src/,$(MODULES))
SOURCE_FILES := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
OBJ_FILES := $(addprefix $(OBJ)/, $(notdir $(SOURCE_FILES:.cpp=.o)) )
SOURCE_FILES := $(SOURCE_FILES) src/tls/gnutls_secure_channel.cpp
OBJ_FILES := $(OBJ_FILES) $(OBJ)/gnutls_secure_channel.o
DESTDIR?=target
all: clean link
link: compile
$(AR) -r -s $(TARGET)/$(LIB_NAME).a $(OBJ_FILES)
compile: $(OBJ)/stdafx.hpp.gch $(OBJ_FILES)
$(OBJ)/stdafx.hpp.gch: src/stdafx.hpp
$(CXX) $(CPPFLAGS) $(DEFINES) -c src/stdafx.hpp -o $(OBJ)/stdafx.hpp.gch
$(OBJ)/%.o: src/%.cpp
$(CXX) $(CPPFLAGS) $(DEFINES) -iquoteobj$(OBJ)/stdafx.hpp.gch -c $< -o $@
$(OBJ)/%.o: src/win/%.cpp
$(CXX) $(CPPFLAGS) $(DEFINES) -iquoteobj$(OBJ)/stdafx.hpp.gch -c $< -o $@
$(OBJ)/%.o: src/net/%.cpp
$(CXX) $(CPPFLAGS) $(DEFINES) -iquoteobj$(OBJ)/stdafx.hpp.gch -c $< -o $@
$(OBJ)/gnutls_secure_channel.o: src/tls/gnutls_secure_channel.cpp
$(CXX) $(CPPFLAGS) $(DEFINES) -iquoteobj$(OBJ)/stdafx.hpp.gch -c $< -o $@
clean:
mkdir -p $(OBJ_ROOT)
mkdir -p $(TARGET_ROOT)
rm -rf $(OBJ)
rm -rf $(TARGET)
mkdir $(OBJ)
mkdir $(TARGET)