blob: e479b36941f2995db58f7567bd5d1424a3710c7d (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
DPP_ROOT = .
ACTIVATE_SH = ./w64-mingw32-sysroot/x86_64/activate.sh
MAKE_PID := $(shell echo $$PPID)
JOBS := $(shell ps T | sed -n 's/.*$(MAKE_PID).*$(MAKE).* \(-j\|--jobs=\) *\([0-9][0-9]*\).*/\2/p')
ifndef JOBS
JOBS := 1
endif
ifndef BUILD_NATIVE
include Makefile.inc
else
include Makefile.native.inc
endif
all: deps
$(DPP_ROOT)/CRT/kcrt$(NAME_SUFFIX).o: $(CC) $(DPP_ROOT)/CRT/kcrt.c
$(Q)$(CC) -std=c99 $(CFLAGS) -c CRT/kcrt.c -o $@
@echo 'CC $@'
$(DPP_ROOT)/CRT/kcrt$(NAME_SUFFIX).opp: $(CXX) $(DPP_ROOT)/CRT/kcrt.cpp
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(EASTL_CXXFLAGS) -c CRT/kcrt.cpp -o $@
@echo 'CXX $@'
$(DPP_ROOT)/CRT/ucrt$(NAME_SUFFIX).opp: $(CXX) $(DPP_ROOT)/CRT/ucrt.cpp
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(EASTL_CXXFLAGS) -c CRT/ucrt.cpp -o $@
@echo 'CXX $@'
$(DPP_ROOT)/CRT/DriverThread$(NAME_SUFFIX).opp: $(CXX) $(DPP_ROOT)/CRT/DriverThread.cpp $(DPP_ROOT)/CRT/DriverThread.hpp
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(EASTL_CXXFLAGS) -c CRT/DriverThread.cpp -o $@
@echo 'CXX $@'
ifndef BUILD_NATIVE
deps-print-local-notice: $(CC)
ifeq ($(CC),$(LOCAL_MINGW64_CC))
@echo
@echo "-- [Build Config]"
@echo "-- CC : $(realpath $(CC))"
@echo "-- CXX: $(realpath $(CXX))"
@echo "-- DDK: $(realpath $(DDK_INCLUDE_DIR))"
@echo
endif
$(LOCAL_MINGW64_BUILD_SCRIPT):
ifeq ($(CC),$(LOCAL_MINGW64_CC))
@echo
@echo "------------------------------------------------------------------------------"
@echo "-- ./mingw-w64-build/mingw-w64-build does not exist, clonging git submodule --"
@echo "------------------------------------------------------------------------------"
@echo
git submodule update --init mingw-w64-build
endif
$(LOCAL_MINGW64_CC): $(LOCAL_MINGW64_BUILD_SCRIPT)
ifeq ($(CC),$(LOCAL_MINGW64_CC))
@echo
@echo "------------------------------------------------------------------------------------------------"
@echo "-- ./w64-mingw32-sysroot/x86_64/bin/x86_64-w64-mingw32-gcc does not exist, building toolchain --"
@echo "------------------------------------------------------------------------------------------------"
@echo
env -i ./mingw-w64-build/mingw-w64-build --root="$(shell realpath ./w64-mingw32-sysroot)" --disable-threads --jobs $(JOBS) x86_64
@echo '#!/usr/bin/env bash' >$(ACTIVATE_SH)
@echo >>$(ACTIVATE_SH)
@echo 'MYDIR="$$(realpath $$(dirname $${BASH_SOURCE[0]}))"' >>$(ACTIVATE_SH)
@echo 'export PATH="$${MYDIR}/w64-mingw32-sysroot/x86_64/bin:$${MYDIR}/bin:${PATH}"' >>$(ACTIVATE_SH)
@chmod +x $(ACTIVATE_SH)
endif
ifeq ($(CC),$(LOCAL_MINGW64_CC))
$(LOCAL_MINGW64_CXX): $(LOCAL_MINGW64_CC)
endif
deps-build: \
$(LOCAL_MINGW64_BUILD_SCRIPT) \
$(LOCAL_MINGW64_CC) \
$(EASTL_STATIC_LIB) \
$(DRIVER_ADDITIONAL_OBJS) \
$(DRIVER_CRT) \
$(DRIVER_CRTPLUSPLUS) \
$(USER_CRT) \
$(SIGNTOOL_PREFIX)
deps: deps-print-local-notice deps-build
$(EASTL_STATIC_LIB): $(CXX) $(EASTL_DEPS)
mkdir -p $(EASTL_BUILDDIR)
cd $(EASTL_BUILDDIR) && \
$(CMAKE) ../EASTL \
-DCMAKE_CXX_COMPILER="$(realpath $(CXX))" \
-DCMAKE_RC_COMPILER="$(realpath $(RC))" \
-DCMAKE_SYSTEM_NAME="Windows" \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_CXX_FLAGS='$(CFLAGS) $(CXXFLAGS) $(EASTL_CXXFLAGS)' && \
$(MAKE) $(CMAKE_Q)
$(SIGNTOOL_PREFIX)-code.p12:
./create_codesign_ca.sh $(SIGNTOOL_PREFIX)
$(SIGNTOOL_PREFIX): $(SIGNTOOL_PREFIX)-code.p12
distclean: clean
rm -f $(SIGNTOOL_PREFIX)-ca-* $(SIGNTOOL_PREFIX)-code*
rm -rf $(LOCAL_MINGW64_BUILD_DIR)
git submodule deinit --all
clean: $(EASTL_STATIC_LIB)
rm -f $(DRIVER_CRT) $(DRIVER_CRTPLUSPLUS) $(USER_CRT) $(EASTL_STATIC_LIB)
rm -f $(DRIVER_ADDITIONAL_OBJS)
rm -rf $(EASTL_BUILDDIR)
else
deps-build: \
$(EASTL_STATIC_LIB) \
$(USER_CRT)
deps: deps-build
$(EASTL_STATIC_LIB): $(CXX) $(EASTL_DEPS)
mkdir -p $(EASTL_BUILDDIR)
cd $(EASTL_BUILDDIR) && \
$(CMAKE) ../EASTL \
-DCMAKE_CXX_COMPILER="$(realpath $(CXX))" \
-DCMAKE_SYSTEM_NAME="Linux" \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_CXX_FLAGS='$(CFLAGS) $(CXXFLAGS) $(EASTL_CXXFLAGS)' && \
$(MAKE) $(CMAKE_Q)
distclean: clean
clean: $(EASTL_STATIC_LIB)
rm -f $(USER_CRT) $(EASTL_STATIC_LIB)
rm -rf $(EASTL_BUILDDIR)
endif
help:
@echo '[Makefile.deps]'
$(call HELP_MAKE_OPTIONS)
@echo -e '\tJOBS = $(JOBS)'
@echo -e '\tWERROR = $(WERROR)'
@echo -e '\tQ = $(Q)'
.PHONY: all deps-print-local-notice deps-build deps distclean clean help
.DEFAULT_GOAL := all
|