forked from ashkulz/NppFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (61 loc) · 2.57 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Makefile for building NppFTP
ifeq ($(OS),Windows_NT)
WINDRES = windres
RMDIR = if exist $(1) rd /s /q $(1)
else
WINDRES = i686-w64-mingw32-windres
RMDIR = rm -fr $(1)
endif
CXX = i686-w64-mingw32-g++
CFLAGS = -MMD -Os -O3 -Wall -Werror -fexpensive-optimizations -DLIBSSH_STATIC -DUNICODE -D_UNICODE
LFLAGS = -static -Lobj -L3rdparty/lib -lcomdlg32 -lcomctl32 -luuid -lole32 -lshlwapi -lssh -lssl -lcrypto -lz -lgdi32 -lws2_32
INC = -I3rdparty/include -Iinclude -Iinclude/Npp -Iinclude/Windows -Itinyxml/include -IUTCP/include
RES = obj/NppFTP.res
TGT = bin/NppFTP.dll
TXML_OBJ = $(patsubst tinyxml/src/%.cpp,obj/%.o,$(wildcard tinyxml/src/*.cpp))
UTCP_OBJ = $(patsubst UTCP/src/%.cpp,obj/%.o,$(wildcard UTCP/src/*.cpp))
NPP_OBJ = $(patsubst src/%.cpp,obj/%.o,$(wildcard src/*.cpp)) $(patsubst src/Windows/%.cpp,obj/%.o,$(wildcard src/Windows/*.cpp))
OBJECTS = $(TXML_OBJ) $(UTCP_OBJ) $(NPP_OBJ)
DEPENDS = ${OBJECTS:.o=.d}
TGT_D = bin/NppFTPd.dll
TXML_OBJ_D = $(patsubst tinyxml/src/%.cpp,obj/%_debug.o,$(wildcard tinyxml/src/*.cpp))
UTCP_OBJ_D = $(patsubst UTCP/src/%.cpp,obj/%_debug.o,$(wildcard UTCP/src/*.cpp))
NPP_OBJ_D = $(patsubst src/%.cpp,obj/%_debug.o,$(wildcard src/*.cpp)) $(patsubst src/Windows/%.cpp,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: bin obj $(TGT_D)
release: bin obj $(TGT)
@echo ============ creating NppFTP.zip ============
@zip -9 -r NppFTP.zip $(TGT) doc/
obj/%.o: tinyxml/src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
obj/%.o: UTCP/src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
obj/%.o: src/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
obj/%.o: src/Windows/%.cpp
@echo CXX $< & $(CXX) -c $(CFLAGS) $(INC) $< -o $@
obj/%_debug.o: tinyxml/src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
obj/%_debug.o: UTCP/src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
obj/%_debug.o: src/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
obj/%_debug.o: src/Windows/%.cpp
@echo CXX $< & $(CXX) -g -c $(CFLAGS) $(INC) $< -o $@
obj/%.res: src/Windows/%.rc
@echo RES $< & $(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)
bin:
@mkdir bin
obj:
@mkdir obj
clean:
@$(call RMDIR, bin)
@$(call RMDIR, obj)
-include ${DEPENDS}
-include ${DEPENDS_D}