-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
115 lines (95 loc) · 2.77 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
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
#############################################################################
# #
# Makefile for building NppTags.dll with MinGW-w64 #
# #
#############################################################################
.SUFFIXES: .dll .o .c .cpp .rc .h
# Define the compilers and alike
ARCH = i686-w64-mingw32
CC = $(ARCH)-gcc
CXX = $(ARCH)-g++
WINDRES = $(ARCH)-windres
# The main targets
PROGRAM = NppTags
TARGET = $(PROGRAM).dll
now: $(TARGET)
all: clean now
# The general compiler flags
CFLAGS = -DUNICODE
CXXFLAGS = $(CFLAGS) -Wno-write-strings --std=c++11
LIBS = -static -lgdi32 -lcomctl32 -lcomdlg32
LDFLAGS = -Wl,--out-implib,$(TARGET) -shared
# Default target is RELEASE
DEBUG ?= 0
ifeq ($(DEBUG), 1)
# Add DEBUG define, debug info and specific optimizations
CFLAGS += -D_DEBUG -g -O0
CXXFLAGS += -D_DEBUG -g -O0
#CXXFLAGS += -D_DEBUG -g -O0 -gstabs
# Add dependencies flags
CFLAGS += -MMD -MP
CXXFLAGS += -MMD -MP
# Enable almost all warnings
CXXFLAGS += -W -Wall
else
# Set the optimizations
OPT = -fexpensive-optimizations -Os -O2
# Strip the dll
LDOPT = -s
endif
# Silent/verbose commands. For verbose output of commands set V=1
V ?= 0
ifeq ($(V), 0)
SILENT = @
V_CC = @echo [CC] $@;
V_CXX = @echo [CXX] $@;
V_RES = @echo [WINDRES] $@;
endif
# All the source files
PROGRAM_SRCS_CPP = \
DlgAbout.cpp \
DlgOptions.cpp \
DlgSelectTag.cpp \
DlgTree.cpp \
NppOptions.cpp \
NppTags.cpp \
SqliteDB.cpp \
Tag.cpp \
TagsDatabase.cpp \
TreeBuilder.cpp \
TreeBuilderCpp.cpp \
TreeBuilderCSharp.cpp \
TreeBuilderJava.cpp \
TreeBuilderRst.cpp \
TreeBuilderSql.cpp \
Options.cpp \
WaitCursor.cpp
PROGRAM_SRCS_C = \
readtags.c \
sqlite3.c
# All the build targets
.c.o:
$(V_CC) $(CC) -c $(CFLAGS) $(OPT) -o $@ $<
.cpp.o:
$(V_CXX) $(CXX) -c $(CXXFLAGS) $(OPT) -o $@ $<
.rc.o:
$(V_RES) $(WINDRES) -o $@ -i $<
PROGRAM_OBJS_CPP=$(PROGRAM_SRCS_CPP:.cpp=.o)
PROGRAM_OBJS_C=$(PROGRAM_SRCS_C:.c=.o)
PROGRAM_RC=$(PROGRAM)_res.rc
PROGRAM_OBJS_RC=$(PROGRAM_RC:.rc=.o)
PROGRAM_DEP_CPP=$(PROGRAM_SRCS_CPP:.cpp=.d)
PROGRAM_DEP_C=$(PROGRAM_SRCS_C:.c=.d)
$(PROGRAM).dll: version_git.h $(PROGRAM_OBJS_CPP) $(PROGRAM_OBJS_C) $(PROGRAM_OBJS_RC)
$(V_CXX) $(CXX) -o $@ $(PROGRAM_OBJS_CPP) $(PROGRAM_OBJS_C) $(PROGRAM_OBJS_RC) $(LDFLAGS) $(LDOPT) $(LIBS)
clean:
@echo Cleaning
$(SILENT) rm -f $(PROGRAM_OBJS_CPP) $(PROGRAM_OBJS_C) $(PROGRAM_OBJS_RC) version_git.h
$(SILENT) rm -f $(PROGRAM_DEP_CPP) $(PROGRAM_DEP_C) $(PROGRAM).dll
$(SILENT) rm -f tags tags.out tags.sqlite
version_git.h:
$(SILENT) ./version_git.sh
# The dependencies
$(PROGRAM)_res.o: $(PROGRAM)_res.rc
-include $(PROGRAM_DEP_CPP)
-include $(PROGRAM_DEP_C)