-
Notifications
You must be signed in to change notification settings - Fork 19
/
makefile.mvc.xrep
267 lines (220 loc) · 7.19 KB
/
makefile.mvc.xrep
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
`{`#makefile.vars.xrep @`}
##
## Usage:
## make [<target1> [<target2>] [...]]
##
## where:
## <target> is: to:
## all make all targets
## dtm creates make.dtm
## clean clean all targets
## usage display this output
##
`{`[`$libs`;20`,## \? make \$.lib target`+\n`]`}
`{`[`$dyn_libs`;20`,## \? make \$.dll target`+\n`]`}
`{`[`$executables`;20`,## \? make \$.exe target`+\n`]`}
##
# Flags for tools...
!ifdef DEBUG
DEBUG_CFLAGS=/Zi /Od
DEBUG_LFLAGS=/DEBUG
DEBUG_AFLAGS=
DEBUG_SUFFIX=d
!else
DEBUG_CFLAGS=/O2
DEBUG_LFLAGS=
DEBUG_AFLAGS=
DEBUG_SUFFIX=
!endif
CPPFLAGS=/nologo /Zc:forScope,wchar_t /EHa /GR /Gy /wd4068 /wd4355 /D_CRT_SECURE_NO_DEPRECATE /I. $(CFLAGS) $(DEBUG_CFLAGS)
BINDFLAGS=/NOLOGO $(DEBUG_AFLAGS)
# The ignore is to stop the "all references to 'xxx' discarded by /OPT:REF" linker warning.
LINKFLAGS=/NOLOGO $(DEBUG_LFLAGS) /IGNORE:4089 shell32.lib
# Remove incremental linking for now due to quick and dirty manifest embedding (need to rework to use incremental linking).
#LINKFLAGS=/NOLOGO /INCREMENTAL $(DEBUG_LFLAGS) /IGNORE:4089 shell32.lib
# Libraries and object files...
CONSOLE_LIBS=ole32.lib oleaut32.lib
CONSOLE_RTOBJS=
CONSOLE_LFLAGS=
DYNAMIC_LIBS=ole32.lib
DYNAMIC_RTOBJS=
DYNAMIC_LFLAGS=/DLL
COMMON_LIBS=psapi.lib rpcrt4.lib advapi32.lib
WINSOCK_LIBS=ws2_32.lib iphlpapi.lib
OPENSSL_LIBS=libeay32.lib ssleay32.lib
LIBFCGI_LIBS=libfcgi.lib
LIBHARU_LIBS=libhpdf.lib
LIBICONV_LIBS=iconv.lib
MYSQL_LIBS=libmysql.lib
ZLIB_LIBS=zlib1.lib
# Tools and implicit rules...
CPP=cl.exe
BIND=@echo Binding $*............... &lib
LINK=@echo Linking $*............... &link
MANIFEST=manifest
.SUFFIXES: .cpp .cms
# Remove implicit .cpp to .exe rule to ensure correct linkage.
.cpp.exe:
# Change implicit .cpp to .obj rule to support multiple source file compilation.
.cpp.obj::
@compile.bat $<
# @test_compile.bat $<
# Custom rule to generate command definitions.
.cms.cmh:
@generate_commands $*.cms
#CPP_NORMAL_OPT=STATIC_RTL_SINGLE_THREAD
#CPP_NORMAL_OPT=STATIC_RTL_MULTIPLE_THREADS
CPP_NORMAL_OPT=DYNAMIC_RTL_MULTIPLE_THREADS
CPP_DYNAMIC_OPT=DYNAMIC_RTL_MULTIPLE_THREADS
CPP_NORMAL_SRTL_ST=@$(CPP) $(CPPFLAGS) /ML$(DEBUG_SUFFIX) /c
CPP_NORMAL_SRTL_MT=@$(CPP) $(CPPFLAGS) /MT$(DEBUG_SUFFIX) /c
CPP_NORMAL_DRTL_MT=@$(CPP) $(CPPFLAGS) /MD$(DEBUG_SUFFIX) /c
CPP_DYNAMIC_DRTL_MT=$(CPP_NORMAL_DRTL_MT)
BIND_NORMAL=$(BINDFLAGS) /NOLOGO /OUT:$@
LINK_NORMAL=$(LINKFLAGS) /SUBSYSTEM:CONSOLE $(CONSOLE_LFLAGS) $** $(CONSOLE_RTOBJS) /LIBPATH:"$(LIB)" /OUT:$*.exe
LINK_DYNAMIC=$(LINKFLAGS) /SUBSYSTEM:CONSOLE $(DYNAMIC_LFLAGS) $** $(DYNAMIC_RTOBJS) /LIBPATH:"$(LIB)" /OUT:$*.dll
!if "$(CPP_NORMAL_OPT)" == "STATIC_RTL_SINGLE_THREAD"
CPP_NORMAL=$(CPP_NORMAL_SRTL_ST)
!elseif "$(CPP_NORMAL_OPT)" == "STATIC_RTL_MULTIPLE_THREADS"
CPP_NORMAL=$(CPP_NORMAL_SRTL_MT)
!elseif "$(CPP_NORMAL_OPT)" == "DYNAMIC_RTL_MULTIPLE_THREADS"
CPP_NORMAL=$(CPP_NORMAL_DRTL_MT)
!else
! error Unexpected CPP_NORMAL_OPT value $(CPP_NORMAL_OPT)
!endif
!if "$(CPP_DYNAMIC_OPT)" == "DYNAMIC_RTL_MULTIPLE_THREADS"
CPP_DYNAMIC=$(CPP_DYNAMIC_DRTL_MT)
!else
! error Unexpected CPP_DYNAMIC_OPT value $(CPP_DYNAMIC_OPT)
!endif
`{`[`$libs`,\
TARGET_\^=\$.lib
TARGET_\^_INCLUDE=\$.inc
TARGET_\^_OBJECTS=`{`[`$\$_cpps`/.cpp`/.obj`,\\?`+\\\\\\n `]`}
`+
`]`}
`{`[`$dyn_libs`,\
TARGET_\^=\$.dll
TARGET_\^_INCLUDE=\$.inc
TARGET_\^_OBJECTS=`{`[`$\$_cpps`/.cpp`/.obj`,\\?`+\\\\\\n `]`}
`{`?`$\$_cmss`[`$\$_cmss`/.cms`/.cmh`'TARGET_\^_COMMANDS=`'\\?`+\\\\\\\n `]\\n`}`+
`]`}
`{`[`$executables`,\
TARGET_\^=\$.exe
TARGET_\^_INCLUDE=\$.inc
TARGET_\^_OBJECTS=`{`[`$\$_cpps`/.cpp`/.obj`,\\?`+\\\\\\n `]`}
`{`?`$\$_cmss`[`$\$_cmss`/.cms`/.cmh`'TARGET_\^_COMMANDS=`'\\?`+\\\\\\\n `]\\n`}`+
`]`}
`{`[`$dlink_targets`,\
TARGET_\^=\$.dll
`]`}
ALL_TARGETS=\
`{`[`$all_targets`, $(TARGET_\^)`+\\
`]`}
ALL_INCLUDES=\
`{`[`$all_targets`, $(TARGET_\^_INCLUDE)`+\\
`]`}
ALL_OBJECTS=\
`{`[`$all_targets`, $(TARGET_\^_OBJECTS)`+\\
`]`}
`{`$all_cms_targets`=`'`'`}
`{`[`$all_targets`,`{`(`?`$\$_cmss`)`$all_cms_targets`=`$all_cms_targets`+`'\$`'`}`]`}
ALL_COMMANDS=\
`{`[`$all_cms_targets`, $(TARGET_\^_COMMANDS)`+\\
`]`}
usage: make_usage
all: $(ALL_TARGETS)
`{`[`$libs`,\$: $(TARGET_\^)`+\n`]`}
`{`[`$dyn_libs`,\$: $(TARGET_\^)`+\n`]`}
`{`[`$executables`,\$: $(TARGET_\^)`+\n`]`}
dtm:
@echo %date% %time%>make.dtm
make_usage:
@usage.bat makefile.mvc
touch_incs:
`{`[`$libs`,\
@touch.bat \$.inc\
`+\n`]`}
`{`[`$dyn_libs`,\
@touch.bat \$.inc\
`+\n`]`}
`{`[`$executables`,\
@touch.bat \$.inc\
`+\n`]`}
`{`[`$libs`,\
!ifndef NO_INC_FILES
! include $(TARGET_\^_INCLUDE)
!endif
$(TARGET_\^:.lib=.compile):
@echo @call gendeps.bat %* >compile.bat
@echo $(CPP_NORMAL) %* >>compile.bat
@geninc $(TARGET_\^_OBJECTS:.obj=) >$(TARGET_\^_INCLUDE)
$(TARGET_\^):: $(TARGET_\^:.lib=.compile)
@
$(TARGET_\^):: $(TARGET_\^_OBJECTS)
$(BIND) @<<
$(BIND_NORMAL) $(TARGET_\^_OBJECTS)
<<
`+\n`]`}
`{`[`$dyn_libs`,\
!ifndef NO_INC_FILES
! include $(TARGET_\^_INCLUDE)
!endif
$(TARGET_\^:.dll=.compile):
@echo @call gendeps.bat %* >compile.bat
@echo $(CPP_DYNAMIC) %* >>compile.bat
@geninc $(TARGET_\^_OBJECTS:.obj=) >$(TARGET_\^_INCLUDE)
$(TARGET_\^)::\
`{`?`$\$_libs`[`$\$_libs`, $(TARGET_\\^)`]`}\
`{`?`$\$_dylk`[`$\$_dylk`, $(TARGET_\\^)`]`}\
`{`(`?`$\$_cmss`) $(TARGET_GENERATE_COMMANDS) $(TARGET_\^_COMMANDS)`} $(TARGET_\^:.dll=.compile)
@
$(TARGET_\^):: $(TARGET_\^_OBJECTS)\
`{`?`$\$_libs`[`$\$_libs`, $(TARGET_\\^)`]`}\
`{`?`$\$_dylk`[`$\$_dylk`, $(TARGET_\\^:.dll=.lib)`]`}
$(LINK) @<<
$(LINK_DYNAMIC) $(COMMON_LIBS)`{`(`?`$\$_issk`) $(WINSOCK_LIBS)`}`{`(`?`$\$_ossl`) $(OPENSSL_LIBS)`}\
`{`(`?`$\$_haru`) $(LIBHARU_LIBS)`}`{`(`?`$\$_icnv`) $(LIBICONV_LIBS)`}`{`(`?`$\$_msql`) $(MYSQL_LIBS)`}`{`(`?`$\$_zlib`) $(ZLIB_LIBS)`}
<<
!ifdef MANIFEST
@$(MANIFEST) $(TARGET_\^)
!endif
`+\n`]`}
`{`[`$executables`,\
!ifndef NO_INC_FILES
! include $(TARGET_\^_INCLUDE)
!endif
$(TARGET_\^:.exe=.compile):
@echo @call gendeps.bat %* >compile.bat
@echo $(CPP_NORMAL) %* >>compile.bat
@geninc $(TARGET_\^_OBJECTS:.obj=) >$(TARGET_\^_INCLUDE)
$(TARGET_\^)::\
`{`?`$\$_libs`[`$\$_libs`, $(TARGET_\\^)`]`}\
`{`?`$\$_dylk`[`$\$_dylk`, $(TARGET_\\^)`]`}\
`{`(`?`$\$_cmss`) $(TARGET_GENERATE_COMMANDS) $(TARGET_\^_COMMANDS)`} $(TARGET_\^:.exe=.compile)
@
$(TARGET_\^):: $(TARGET_\^_OBJECTS)\
`{`?`$\$_libs`[`$\$_libs`, $(TARGET_\\^)`]`}\
`{`?`$\$_dylk`[`$\$_dylk`, $(TARGET_\\^:.dll=.lib)`]`}
$(LINK) @<<
$(LINK_NORMAL) $(COMMON_LIBS)`{`(`?`$\$_issk`) $(WINSOCK_LIBS)`}`{`(`?`$\$_ossl`) $(OPENSSL_LIBS)`}\
`{`(`?`$\$_fcgi`) $(LIBFCGI_LIBS)`}`{`(`?`$\$_haru`) $(LIBHARU_LIBS)`}`{`(`?`$\$_icnv`) $(LIBICONV_LIBS)`}`{`(`?`$\$_msql`) $(MYSQL_LIBS)`}`{`(`?`$\$_zlib`) $(ZLIB_LIBS)`}
<<`{`(`?`$\$_gext`)`[`$\$_gext`!
@if exist *.\\$ del *.\\$`]`}
!ifdef MANIFEST
@$(MANIFEST) $(TARGET_\^)
!endif
`+\n`]`}
clean::
@killfiles $(ALL_TARGETS)
@killfiles $(ALL_TARGETS:.exe=.ilk)
@killfiles $(ALL_TARGETS:.exe=.map)
@killfiles $(ALL_TARGETS:.exe=.pdb)
@killfiles $(ALL_TARGETS:.dll=.ilk)
@killfiles $(ALL_TARGETS:.dll=.map)
@killfiles $(ALL_TARGETS:.dll=.exp)
@killfiles $(ALL_TARGETS:.dll=.pdb)
@killfiles $(ALL_INCLUDES)
@killfiles $(ALL_OBJECTS)
@killfiles $(ALL_OBJECTS:.obj=.dep)
@killfiles $(ALL_COMMANDS)