-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
433 lines (361 loc) · 10.3 KB
/
Makefile.in
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# -*- mode: mak; -*-
# $Id: Makefile.in,v 1.16 2022/03/20 13:48:58 cvsuser Exp $
# winxsh - top level makefile.
#
#
# Copyright (c) 2015 - 2022, Adam Young.
# All rights reserved.
#
# This file is part of the WinRSH/WinSSH project.
#
# The applications are free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3.
#
# Redistributions of source code must retain the above copyright
# notice, and must be distributed with the license document above.
#
# Redistributions in binary form must reproduce the above copyright
# notice, and must include the license document above in
# the documentation and/or other materials provided with the
# distribution.
#
# The applications are distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ==end==
#
@SET_MAKE@
ROOT = @abs_top_builddir@
PACKAGE = @PACKAGE@
PKG_NAME = @PACKAGE_NAME@
PKG_BUGREPORT = @PACKAGE_BUGREPORT@
ifeq ("$(PKG_NAME)","")
PKG_NAME = WinRSH/WinSSH
endif
PKG_STRING = @PACKAGE_STRING@
PKG_TARNAME = @PACKAGE_TARNAME@
PKG_URL = @PACKAGE_URL@
PKG_VERSION = @PACKAGE_VERSION@
ifeq ("","$(PKG_VERSION)")
PKG_VERSION = 0.3.0
endif
PATH_SEPARATOR = @PATH_SEPARATOR@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
# directory components
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
# directory results
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
libdir = @libdir@
datadir = @datadir@
# package directories
pkgname = winsh
ifeq (rief,$(findstring rief,$(libexecdir)))
pkglibexecdir = $(libexecdir)
pkglibdir = $(libdir)
else
pkglibexecdir = $(libexecdir)/$(pkgname)
pkglibdir = $(libdir)/$(pkgname)
endif
ifeq (rief,$(findstring rief,$(libexecdir)))
pkgdatadir = $(datadir)
else
pkgdatadir = $(datadir)/$(pkgname)
endif
BINDIR = $(bindir)
SBINDIR = $(sbindir)
LIBEXECDIR = $(pkglibexecdir)
LIBDIR = $(pkglibdir)
DATADIR = $(pkgdatadir)
top_build_prefix= @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# File extensions
E=
A= .a
O= .o
LP= lib
E= .exe
CLEAN= *.bak *~ *.BAK *.swp *.tmp core *.core a.out
XCLEAN= $(D_BIN)/*.map
# Configuration
BUSYBOX= @BUSYBOX@
ifeq ($(BUSYBOX),busybox)
BUSYBOX= $(shell which busybox 2>/dev/null)
endif
ifeq ("$(BUILD_TYPE)","") #default
.PHONY: help clean vclean build package
help clean vclean build package:
ifneq ("$(word 1,$(MAKECMDGOALS))","debug")
ifneq ("$(word 1,$(MAKECMDGOALS))","release")
@$(BUSYBOX) echo -n -e '\
|\n\
| make [release or debug] target \n\
|\n\
| Build one or more of the following targets recursively within each sub-directory. \n\
|\n\
| Targets: \n\
|\n\
| build - build everything. \n\
| package - build package. \n\
| clean - delete everything which can be remade. \n\
| vclean - delete all. \n\
| help - command line usage. \n\
'
endif
endif
@echo .
.PHONY: release
release:
$(MAKE) BUILD_TYPE=release $(filter-out release, $(MAKECMDGOALS))
.PHONY: debug
debug:
$(MAKE) BUILD_TYPE=debug $(filter-out debug, $(MAKECMDGOALS))
else # BUILD_TYPE
ifeq ("$(BUILD_TYPE)","debug")
RTSUFFIX=d
else
ifneq ("$(BUILD_TYPE)","release")
$(error invalid BUILD_TYPE; debug or release expected)
endif
endif
# Directories
D_INC= $(ROOT)/include
D_BIN= $(ROOT)/bin@TOOLCHAINEXT@/$(BUILD_TYPE)
D_LIB= $(ROOT)/lib@TOOLCHAINEXT@/$(BUILD_TYPE)
D_OBJ= $(ROOT)/objects@TOOLCHAINEXT@/$(BUILD_TYPE)
LW= $(D_LIB)/$(LP)
D_ETC= $(D_BIN)/etc
D_PLUGIN= $(D_BIN)/plugin
D_SHARE= $(D_BIN)/share
D_DOC= $(D_BIN)/doc
D_LOCALE= $(D_BIN)/locale
# Compilers, programs
CC= @CC@
CXX= @CXX@
AR= @AR@
RM= @RM@
RMDIR= @RMDIR@
CP= @CP@
RC= @RC@
PERL= @PERL@
TAR= @TAR@
INSTALL= @INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA= @INSTALL_DATA@
INNO= @INNO@
ifeq ($(INNO),) # Inno5: allowing legacy XP installations
INNO= "C:/Program Files (x86)/Inno Setup 5/Compil32"
endif
# Common flags
XFLAGS=
CFLAGS= @CFLAGS@
CWARN= @CWARN@
CDEBUG= @CDEBUG@
CRELEASE= @CRELEASE@
LDDEBUG= @LDDEBUG@
LDRELEASE= @LDRELEASE@
CINCLUDE= -I. -I$(MCSOURCE) -I$(D_INC) -I$(D_INC)/glib-2.0 @CINCLUDE@
CEXTRA= @DEFS@ -DLIBW32_DYNAMIC
ifeq ("$(BUILD_TYPE)","release")
CFLAGS+= $(CRELEASE) $(CWARN) $(CINCLUDE) $(CEXTRA) $(XFLAGS)
LDFLAGS= $(LDRELEASE) @LDFLAGS@
else
CFLAGS+= $(CDEBUG) $(CWARN) $(CINCLUDE) $(CEXTRA) $(XFLAGS)
LDFLAGS= $(LDDEBUG) @LDFLAGS@
endif
LDLIBS= -L$(D_LIB) @LIBS@ @EXTRALIBS@
ARFLAGS= rcv
RMFLAGS= -f
RMDFLAGS= -rf
#########################################################################################
# Targets
ifeq ("wcl386","$(CC)")
ifeq ("@TOOLCHAIN@","owc20")
CLBRNAME= clbr20
MT7RNAME= mt7r20
PLBRNAME= plbr20
else
CLBRNAME= clbr19
MT7RNAME= mt7r19
PLBRNAME= plbr19
endif
LIBCLBRPATH= $(shell which $(CLBRNAME).dll)
LIBMT7RPATH= $(shell which $(MT7RNAME).dll)
LIBPLBRPATH= $(shell which $(PLBRNAME).dll)
endif
BUILDINFO= include/buildinfo.h
PACKAGEINFO= packageinfo.h
BINS=\
$(D_BIN)/slogin$(E) \
$(D_BIN)/rlogin$(E) \
$(D_BIN)/rsh$(E) \
$(D_BIN)/rcmd$(E) \
$(D_BIN)/rlogind$(E)
ifneq "" "$(filter mingw32 win32,@build_os@)"
LIBS= $(LW)w32$(A)
endif
LIBS+=\
$(LW)z$(A) \
$(LW)mbedtls$(A) \
$(LW)ssh2$(A) \
$(LW)termemu$(A) \
$(LW)NTService$(A)
IMPORT=
ifeq ("wcl386","$(CC)")
IMPORT+=\
$(D_BIN)/$(CLBRNAME).dll \
$(D_BIN)/$(MT7RNAME).dll \
$(D_BIN)/$(PLBRNAME).dll
endif
#########################################################################################
# rules
.DEFAULT:
.PHONY: build
build: directories buildinfo libs bins import
.PHONY: help
help:
@$(BUSYBOX) echo -e '\
|\n\
| make [release or debug] target \n\
|\n\
| Build one or more of the following targets recursively within each sub-directory. \n\
|\n\
| Targets: \n\
|\n\
| build - build everything. \n\
| package - build all packages. \n\
| clean - delete everything which can be remade. \n\
| help - command line usage. \n\
'
.PHONY: release
release:
$(MAKE) BUILD_TYPE=release $(filter-out release, $(MAKECMDGOALS))
.PHONY: debug
debug:
$(MAKE) BUILD_TYPE=debug $(filter-out debug, $(MAKECMDGOALS))
new_release: new_buildnumber
$(MAKE) build
# Build support
BUILD_DATE= $(shell $(BUSYBOX) date +'%Y%m%d')
ifneq ($(APPVEYOR_BUILD_NUMBER),)
BUILD_NUMBER= $(APPVEYOR_BUILD_NUMBER)
else ifneq ($(GITHUB_RUN_NUMBER),)
BUILD_NUMBER= $(GITHUB_RUN_NUMBER)
else
BUILD_NUMBER= $(shell $(BUSYBOX) cat BUILDNUMBER)
endif
.PHONY: buildinfo
buildinfo:
@echo updating buildinfo.h ...
-@$(PERL) ./buildinfo.pl -o $(BUILDINFO) --prefix="WINSH_" --package="$(PACKAGE)" --name="$(PKG_NAME)" --version="$(PKG_VERSION)" \
--date="$(BUILD_DATE)" --build="$(BUILD_NUMBER)" --toolchain="@TOOLCHAINEXT@"
.PHONY: packageinfo
packageinfo:
-@$(PERL) ./buildinfo.pl -o $(PACKAGEINFO) --prefix="WINSH_" --package="$(PACKAGE)" --name="$(PKG_NAME)" --version="$(PKG_VERSION)" \
--date="$(BUILD_DATE)" --build="$(BUILD_NUMBER)" --toolchain="@TOOLCHAINEXT@" --type="$(BUILD_TYPE)"
buildinfo.h: BUILDNUMBER
ifneq ($(APPVEYOR_BUILD_NUMBER),)
BUILDNUMBER:
@echo importing appveyor build number ...
@echo $(APPVEYOR_BUILD_NUMBER)>$@
endif
new_buildnumber:
-@chmod +w BUILDNUMBER >nul 2>&1
@echo incrementing build number ...
-@sh -c '\
if [ ! -f BUILDNUMBER ]; then echo 1 >BUILDNUMBER; fi;\
echo $$(($$(cat BUILDNUMBER) + 1)) >BUILDNUMBER;\
'
-@chmod -w BUILDNUMBER >/dev/null 2>&1
# Components
directories: $(D_OBJ)/.created $(D_LIB)/.created $(D_BIN)/.created $(D_INC)/.created
%/.created:
-@$(PERL) ./support/mkdir_p.pl $(@D)
@echo "++ do not delete, managed content ++" > $@
bins: $(BINS)
$(D_BIN)/%$(E): libs
@echo --- building $@
$(MAKE) -C $(notdir $(basename $@))
libs: $(LIBS)
$(LW)%$(A): $(D_LIB)/.created $(D_OBJ)/.created
@echo --- bulding $@
$(MAKE) -C $(notdir $(basename $@))
.PHONY: import
import: $(IMPORT)
ifeq ("wcl386","$(CC)")
$(D_BIN)/$(CLBRNAME).dll: $(LIBCLBRPATH)
@echo importing $(LIBCLBRPATH)
@$(CP) -f $(subst /,\,$^) $@
$(D_BIN)/$(MT7RNAME).dll: $(LIBMT7RPATH)
@echo importing $(LIBMT7RPATH)
@$(CP) -f $^ $@
$(D_BIN)/$(PLBRNAME).dll: $(LIBPLBRPATH)
@echo importing $(LIBPLBRPATH)
@$(CP) -f $(subst /,\,$^) $@
endif
install: all
-mkdir -p $(BINDIR)
-mkdir -p $(DATADIR)
$(INSTALL_PROGRAM) -m 0755 -c -o bin -g bin $(D_BIN)/rlogin$(E) $(BINDIR)
$(INSTALL_PROGRAM) -m 0755 -c -o bin -g bin $(D_BIN)/slogin$(E) $(BINDIR)
.PHONY: package
package: packageinfo
$(INNO) ./releases/xsh-inno-setup.iss
-$(RM) $(PACKAGEINFO)
clean:
@echo $(BUILD_TYPE) clean
$(MAKE) -C libw32 clean
$(MAKE) -C libz clean
$(MAKE) -C libssh2 clean
$(MAKE) -C libmbedtls clean
$(MAKE) -C libtermemu clean
$(MAKE) -C libNTService clean
$(MAKE) -C rsh clean
$(MAKE) -C rcmd clean
$(MAKE) -C rlogin clean
$(MAKE) -C rlogind clean
$(MAKE) -C slogin clean
vclean: clean
-@$(RM) $(IMPORT) >nul 2>&1
-@$(RM) $(RMDFLAGS) $(D_BIN)/* $(D_MACROS)/* $(D_HELP)/* $(D_LIB)/* $(D_OBJ)/*
-rmdir $(D_BIN) $(D_MACROS) $(D_HELP) $(D_LIB) $(D_OBJ)
distclean: clean
$(RM) $(RMFLAGS) config.cache config.log config.status \
slogin/Makefile \
rlogind/Makefile \
rlogin/Makefile \
rcmd/Makefile \
rsh/Makefile \
libNTService/Makefile \
libtermemu/Makefile \
libmbedtls/Makefile \
libssh2/Makefile \
libz/Makefile \
libw32/Makefile \
include/config.h \
Makefile
#end
endif # BUILD_TYPE