This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile.win32
49 lines (39 loc) · 2.18 KB
/
makefile.win32
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
CC = i686-w64-mingw32-gcc
CXX = i686-w64-mingw32-g++
RES = i686-w64-mingw32-windres
CXXFLAGS = --std=c++11
CFLAGS = -Os -fdata-sections -ffunction-sections -Isrc/lib/curl/include -static-libgcc -static-libstdc++ -DCURL_STATICLIB
CMAKE_COMMANDS = env CFLAGS="-fdata-sections -ffunction-sections" CXXFLAGS="-fdata-sections -ffunction-sections"
LDFLAGS = -lm -s -Wl,--gc-sections -static-libgcc -static-libstdc++ -mwindows -lcomctl32 -lole32 -ld2d1 -ldwrite -lws2_32 -lcrypt32 -lpthread -static
OBJ_DIR = obj/mingw32
electron.exe: $(OBJ_DIR)/main.o $(OBJ_DIR)/resources.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a $(OBJ_DIR)/libcurl.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron.exe
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(OBJ_DIR)/main.o: src/main.cpp | $(OBJ_DIR)
$(CXX) $(CXXFLAGS) $(CFLAGS) -o $(OBJ_DIR)/main.o -c src/main.cpp
$(OBJ_DIR)/resources.o: src/resources.rc | $(OBJ_DIR)
$(RES) src/resources.rc $(OBJ_DIR)/resources.o
$(OBJ_DIR)/zip.o: src/lib/zip/src/zip.c src/lib/zip/src/zip.h src/lib/zip/src/miniz.h | $(OBJ_DIR)
$(CC) $(CFLAGS) -o $(OBJ_DIR)/zip.o -c src/lib/zip/src/zip.c
$(OBJ_DIR)/libui.a: src/lib/libui/build/meson-out/libui.a | $(OBJ_DIR)
cp -rf src/lib/libui/build/meson-out/libui.a $(OBJ_DIR)/libui.a
$(OBJ_DIR)/libcurl.a: src/lib/curl-build-mingw32/lib/libcurl.a | $(OBJ_DIR)
cp -rf src/lib/curl-build-mingw32/lib/libcurl.a $(OBJ_DIR)/libcurl.a
.PHONY: src/lib/curl-build-mingw32/lib/libcurl.a
src/lib/curl-build-mingw32/lib/libcurl.a:
/bin/mkdir -p src/lib/curl-build-mingw32
cd src/lib/curl-build-mingw32;\
cmake -E $(CMAKE_COMMANDS)\
cmake ../curl -DCMAKE_TOOLCHAIN_FILE=../../../toolchains/windows.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=OFF -DHTTP_ONLY=ON -DCMAKE_USE_WINSSL=ON -DCMAKE_USE_OPENSSL=OFF -DCURL_CA_PATH=none;\
make libcurl
.PHONY: src/lib/libui/build/meson-out/libui.a
src/lib/libui/build/meson-out/libui.a:
cd src/lib/libui;\
meson setup build --buildtype=release --default-library=static --cross-file=../../../toolchains/windows.meson
ninja -C src/lib/libui/build
.PHONY: clean
clean:
rm -rf src/lib/libui/build
rm -rf src/lib/curl-build-mingw32
rm -rf $(OBJ_DIR)