-
Notifications
You must be signed in to change notification settings - Fork 93
/
Makefile.mingw
85 lines (63 loc) · 3.1 KB
/
Makefile.mingw
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
# Makefile for building NppFTP
ifeq ($(BITS),64)
PREFIX = x86_64-w64-mingw32
OUTDIR = x64
else
PREFIX = i686-w64-mingw32
OUTDIR = x86
endif
CXX = $(PREFIX)-g++
CFLAGS = -MMD -Os -O3 -Wall -pedantic -Wformat=2 -Wno-deprecated-declarations -Wno-unused-value -Werror -fexpensive-optimizations -DLIBSSH_STATIC -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE
LFLAGS = -static -L$(OUTDIR)/obj -L$(OUTDIR)/3rdparty/lib -lcomdlg32 -lcomctl32 -luuid -lole32 -lshlwapi -lssh -lssl -lcrypto -lcrypt32 -lz -lgdi32 -lws2_32 -liphlpapi
INC = -I$(OUTDIR)/3rdparty/include -Isrc -Isrc/Windows -Itinyxml/include -IUTCP/include -I.
RES = $(OUTDIR)/obj/NppFTP.res
TGT = $(OUTDIR)/bin/NppFTP.dll
TXML_OBJ = $(patsubst tinyxml/src/%.cpp,$(OUTDIR)/obj/%.o,$(wildcard tinyxml/src/*.cpp))
UTCP_OBJ = $(patsubst UTCP/src/%.cpp,$(OUTDIR)/obj/%.o,$(wildcard UTCP/src/*.cpp))
NPP_OBJ = $(patsubst src/%.cpp,$(OUTDIR)/obj/%.o,$(wildcard src/*.cpp)) $(patsubst src/Windows/%.cpp,$(OUTDIR)/obj/%.o,$(wildcard src/Windows/*.cpp))
OBJECTS = $(TXML_OBJ) $(UTCP_OBJ) $(NPP_OBJ)
DEPENDS = ${OBJECTS:.o=.d}
TGT_D = $(OUTDIR)/bin/NppFTPd.dll
TXML_OBJ_D = $(patsubst tinyxml/src/%.cpp,$(OUTDIR)/obj/%_debug.o,$(wildcard tinyxml/src/*.cpp))
UTCP_OBJ_D = $(patsubst UTCP/src/%.cpp,$(OUTDIR)/obj/%_debug.o,$(wildcard UTCP/src/*.cpp))
NPP_OBJ_D = $(patsubst src/%.cpp,$(OUTDIR)/obj/%_debug.o,$(wildcard src/*.cpp)) $(patsubst src/Windows/%.cpp,$(OUTDIR)/obj/%_debug.o,$(wildcard src/Windows/*.cpp))
OBJECTS_D = $(TXML_OBJ_D) $(UTCP_OBJ_D) $(NPP_OBJ_D)
DEPENDS_D = ${OBJECTS_D:.o=.d}
all: release
debug: $(OUTDIR)/bin $(OUTDIR)/obj $(OUTDIR)/3rdparty $(TGT_D)
release: $(OUTDIR)/bin $(OUTDIR)/obj $(OUTDIR)/3rdparty $(TGT)
@echo ============ creating NppFTP-$(OUTDIR).zip ============
@cp -R docs/ $(OUTDIR)/bin/doc/ && cd $(OUTDIR)/bin && zip -9 -r ../../NppFTP-$(OUTDIR).zip .
$(OUTDIR)/obj/%.o: tinyxml/src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%.o: UTCP/src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%.o: src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%.o: src/Windows/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%_debug.o: tinyxml/src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%_debug.o: UTCP/src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%_debug.o: src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%_debug.o: src/Windows/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
$(OUTDIR)/obj/%.res: src/Windows/%.rc
@echo RES $< & $(PREFIX)-windres $(INC) -J rc -O coff -i $< -o $@
$(TGT): $(OBJECTS) $(RES)
@echo LINK $@ & $(CXX) -shared -Wl,--dll $(OBJECTS) $(RES) -o $@ -s $(LFLAGS)
$(TGT_D): $(OBJECTS_D) $(RES)
@echo LINK $@ & $(CXX) -shared -Wl,--dll $(OBJECTS_D) $(RES) -o $@ $(LFLAGS)
$(OUTDIR)/bin:
@mkdir -p $(OUTDIR)/bin
$(OUTDIR)/obj:
@mkdir -p $(OUTDIR)/obj
$(OUTDIR)/3rdparty:
@./build_3rdparty.py $(OUTDIR) $(PREFIX)
.PHONY: $(OUTDIR)/3rdparty
clean:
@rm -fr $(OUTDIR)
-include ${DEPENDS}
-include ${DEPENDS_D}