forked from qunying/rhide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.src
453 lines (370 loc) · 13.6 KB
/
makefile.src
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# Copyright (C) 1996-2000 Robert H”hne, see COPYING.RH for details
# This file is part of RHIDE.
#
ifeq ($(strip $(RHIDESRC)),)
export RHIDESRC:=$(shell pwd)
endif
srcdir=$(RHIDESRC)
VPATH=$(srcdir)
projects=gpr2mak rhide_ rhide gprexp rh tolf tocrlf copyrite rh_comm
project=
cfg_files=
txt_conv_DJGPP=tocrlf.exe
txt_conv_CYGWIN=tocrlf.exe
txt_conv_Linux=tolf.exe
po_files=\
gpr2mak.cc idecolor.cc idedebug.cc idedefau.cc ideexter.cc \
ideflags.cc ideforma.cc idegcc.cc idehelp.cc idehints.cc \
idemain.cc idemak.cc idemenu.cc idemsg.cc ideopt.cc ideprj.cc \
idestatu.cc idestrm.cc ideutil.cc openedit.cc \
ideuser.cc idecomp.cc idespec.cc idesupp.cc idebug.cc idesynta.cc \
rhassert.c ideenv.cc fstrcmp.c ideapp.cc idedial.cc \
idercs.cc commands.cc idecheck.cc gprexp.cc
src_files=$(po_files) Makefile common.mak README.IDE RHIDE.BIN RHIDE.SRC \
COPYING.RH COPYING wrong.c copyrite.c makefile.src \
gpr2mak.gpr rhide_.gpr rhide.gpr gpr2mak.mak rhide_.mak rhide.mak \
rhide_ch.log todo rhide.env \
LINUX.TXT rhide.var VCSA.SH common.var configure \
ideversi.in ideversi.cc readme.key rhide_.env iconv.c \
moveifch gprexp.gpr gprexp.mak rh.gpr rh.mak conio.o \
tolf.cc tolf.gpr tolf.mak tocrlf.gpr tocrlf.mak \
copyrite.gpr copyrite.mak rhidex rhgdbx eterm-rhide \
rhide.spec aclocal.m4 config.guess config.in config.sub \
configure.in configure.sub install.sh rh_comm.gpr rh_comm.mak
subdirs=libide librhgdb libtvgdb libtvuti include doc libgdb \
rhgdb debobj nodebobj po tvdemo librhuti share\
$(ADD_SUBDIRS)
my_subdirs=libide librhgdb libtvgdb include doc libgdb rhgdb po libtvuti \
debobj nodebobj librhuti
po_subdirs=libide librhgdb libtvgdb libtvuti rhgdb tvdemo
additional_bin_files=
ifeq ($(rhide_OS),Linux)
additional_bin_files=rhidex rhgdbx
endif
install_bin_files=gpr2mak$(exe) gprexp$(exe) rhide$(exe) $(additional_bin_files)
install_doc_files=readme.key COPYING COPYING.RH README.IDE RHIDE.BIN\
LINUX.TXT VCSA.SH
install_data_files_common=rhide_.env
install_data_files_Linux=eterm-rhide
install_data_files=$(install_data_files_common) $(install_data_files_$(rhide_OS))
main_executables=gpr2mak.exe gprexp.exe idegc.exe rhgdb/rhgdb.exe
include $(RHIDESRC)/common.mak
programs=gpr2mak.exe idegc.exe rhgdb/rhgdb.exe gprexp.exe
all:: libgdb/libgdbrh.h init.version $(programs)
# these are the targets, which cannot build with RHIDE
.PHONY: needed touch_gprs
needed: libgdb/libgdbrh.h libgdb/libgdbrh.a init.version
libgdb/libgdbrh.h libgdb/libgdbrh.a:
$(MAKE) -C libgdb $(FLAGS_TO_PASS) $(notdir $@)
rhgdb/rhgdb.exe:: rhgdb/version.cc
$(MAKE) -C rhgdb $(FLAGS_TO_PASS)
gprexp.exe:: gprexp.mak force
$(MAKE) -f gprexp.mak $(FLAGS_TO_PASS)
gpr2mak.exe:: gpr2mak.mak force
$(MAKE) -f gpr2mak.mak $(FLAGS_TO_PASS)
ide.exe:: rhide_.mak force
$(MAKE) -f rhide_.mak $(FLAGS_TO_PASS)
idegc.exe rhgdb/rhgdb.exe:: libgdb/libgdbrh.a
idegc.exe ide.exe gpr2mak.exe gprexp.exe:: ideversi.cc
idegc.exe:: rhide.mak force
$(MAKE) -f rhide.mak $(FLAGS_TO_PASS)
rhide.exe:: idegc.exe
$(LN_SF) $< $@
rhide: rhide.exe
$(LN_SF) $< $@
tolf.exe:: tolf.mak force
$(MAKE) -f tolf.mak $(FLAGS_TO_PASS)
tocrlf.exe:: tocrlf.mak force
$(MAKE) -f tocrlf.mak $(FLAGS_TO_PASS)
clean::
rm -f rhide
gpr2mak: gpr2mak.exe
$(LN_SF) $< $@
clean::
rm -f gpr2mak
gprexp: gprexp.exe
$(LN_SF) $< $@
clean::
rm -f gprexp
force::
tmp.start:
rm -rf $(copy_dir)
ifeq ($(rhide_OS),DJGPP)
install_prefix_src=contrib/$(PACKAGE)$(DIR_VERSION)
else
install_prefix_src=$(PACKAGE)$(DIR_VERSION)
endif
touch_gprs:
@touch $(shell find -name "*.gpr" -print)
check.files.internal: init.version gpr2mak.exe gprexp.exe touch_gprs
@echo Checking in $(obj_dir)
@$(MAKE) --no-print-directory check_src_files \
update_src_file="cp -p" \
update_gpr_file=$(top_obj_dir)/gprexp.exe
check.files:
@$(MAKE) check.files.internal LFN=y FNCASE=y
copy.files:
@-rm -f $(list_file)
$(MAKE) prefix=$(prefix) list_file=$(list_file) \
list_prefix=$(install_prefix_src)/ copy_src_files \
--no-print-directory
mft.src:
$(INSTALL_DIR) $(copy_dir)/manifest
touch $(copy_dir)/manifest/$(rhides).mft $(copy_dir)/manifest/$(rhides).ver
echo manifest/$(rhides).mft manifest/$(rhides).ver >> $(list_file)
cp $(list_file) __mft__
printf "%s\n" @__mft__ | sort > $(copy_dir)/manifest/$(rhides).mft
rm -f __mft__
_VERSION=$(subst ",,$(subst \",,$(subst -DIDEVERSION=,,$(LOCAL_OPT))))
ver.src:
$(INSTALL_DIR) $(copy_dir)/manifest
echo $(rhides) Version $(VERSION) \(sources\) \
> $(copy_dir)/manifest/$(rhides).ver
copyrite_srcdir=$(srcdir)
mark_dirs=$(my_subdirs)
mark_files=$(src_files)
mark_find_files=rhide.env rhide.var Makefile makefile.src *.mak
ifeq ($(rhide_OS),DJGPP)
Markfiles=$(addsuffix /.../*,$(addprefix $(copyrite_srcdir)/,$(mark_dirs))) \
$(addprefix $(copyrite_srcdir)/,$(mark_files)) \
$(addprefix $(copyrite_srcdir)/.../,$(mark_find_files))
else
Markfiles=$(shell find $(addprefix $(copyrite_srcdir)/,$(mark_dirs)) -not -type d -print) \
$(addprefix $(copyrite_srcdir)/,$(mark_files)) \
$(shell find $(copyrite_srcdir) -name "$(word 1,$(mark_find_files))" \
$(foreach name,$(filter-out $(word 1,$(mark_find_files)),$(mark_find_files)),\
-o -name "$(name)") -print)
endif
mark.copyright: $(copyrite.exe)
$(copyrite.exe) $(Markfiles)
_languages.src: $(addsuffix .po,$(LANGUAGES))
languages.src languages:
$(MAKE) -C po languages.src
ifeq ($(rhide_OS),DJGPP)
MANIFEST_SRC=mft.src ver.src
LANGUAGES.SRC=
INSTALLED_RHIDE=rhide.exe
INSTALLED_GPR2MAK=gpr2mak.exe
bin_archive=$(rhideb).zip
src_archive=$(rhides).zip
else
MANIFEST_SRC=
LANGUAGES.SRC=
INSTALLED_RHIDE=rhide
INSTALLED_GPR2MAK=gpr2mak
bin_archive=$(PACKAGE)$(DIR_VERSION).bin$(archive_id).`uname -s | sed 's/ /-/g'`.tar.gz
src_archive=$(PACKAGE)$(DIR_VERSION).tar.gz
endif
distrib.src_: $(notdir $(txt_conv)) $(LANGUAGES.SRC) tmp.start copy.files \
$(MANIFEST_SRC)
rm -f $(src_archive)
$(MAKE) mark.copyright copyrite_srcdir=$(prefix)
ifneq ($(txt_conv),)
find $(copy_dir) -not -type d -a -not -name "*.gpr" \
-a -not -name "*.o" -exec $(txt_conv) {} \;
endif
ifeq ($(rhide_OS),DJGPP)
cd $(copy_dir); zip -9r $(obj_dir)/$(src_archive) \
@$(copy_dir)/manifest/$(rhides).mft; \
cd /; cd $(obj_dir)
else
tar -C $(copy_dir) -cvf - `ls $(copy_dir) | sed 's,$(copy_dir)/,,g'` \
| gzip -9c > $(obj_dir)/$(src_archive)
endif
rm -rf $(copy_dir)
init.version: ideversi.cc rhgdb/version.cc
ideversi.cc: ideversi.in common.mak
@sed -e s,@version@,$(VERSION),g \
-e "s/WARN/This file is generated automatically, do not edit!/g" \
$(srcdir)/ideversi.in > _vers_
@$(move-if-change) _vers_ $@
@-rm -f _vers_
clean::
rm -f ideversi.cc
rhgdb/version.cc: rhgdb/version.in common.mak
@sed -e s,@version@,$(VERSION),g \
-e "s/WARN/This file is generated automatically, do not edit!/g" \
$(srcdir)/rhgdb/version.in > _vers_
@$(move-if-change) _vers_ $@
-rm -f _vers_
distrib.src: check_perms init.version touch_gprs
$(MAKE) $(FLAGS_TO_PASS) gpr2mak.exe
$(MAKE) $(FLAGS_TO_PASS) \
prefix=$(copy_dir)/$(install_prefix_src) \
LFN=y FNCASE=y txt_conv="$(top_obj_dir)/$(txt_conv_$(rhide_OS))" \
distrib.src_
doc info dvi:
$(MAKE) -C doc $@
_install.languages:
$(MAKE) -C po install prefix=$(prefix) logfile=../languages.log \
$(FLAGS_TO_PASS)
_install.doc:
$(MAKE) -C doc install prefix=$(prefix) logfile=../doc.log \
$(FLAGS_TO_PASS)
install.rhgdb:
$(MAKE) -C rhgdb install prefix=$(prefix) logfile=../$(logfile) \
$(FLAGS_TO_PASS)
install.programs: all install.rhgdb
$(INSTALL_DIR) $(prefix)/$(install_bindir)
$(INSTALL_PROGRAM) idegc.exe $(prefix)/$(install_bindir)/$(INSTALLED_RHIDE)
$(INSTALL_PROGRAM) gpr2mak.exe $(prefix)/$(install_bindir)/$(INSTALLED_GPR2MAK)
ifeq ($(use_upx),yes)
$(UPX) $(addprefix $(prefix)/$(install_bindir)/, \
$(INSTALLED_RHIDE) $(INSTALLED_GPR2MAK))
endif
echo $(install_bindir)/$(INSTALLED_RHIDE) \
$(install_bindir)/$(INSTALLED_GPR2MAK) >> $(logfile)
install.start:
rm -f $(logfile)
_install: install.start install.programs install.languages install.doc
cat languages.log doc.log rhgdb.log editor.log >> $(logfile)
rm -f languages.log doc.log rhgdb.log editor.log
manifest.bin:
$(INSTALL_DIR) $(prefix)/manifest
printf "%s\n" $(sort $(shell cat $(logfile)) manifest/$(rhideb).mft \
manifest/$(rhideb).ver) \
> $(prefix)/manifest/$(rhideb).mft
ver.bin:
$(INSTALL_DIR) $(prefix)/manifest
echo $(rhideb) Version $(VERSION) \(binaries\) \
> $(prefix)/manifest/$(rhideb).ver
manifest: manifest.bin ver.bin
ifeq ($(rhide_OS),DJGPP)
MANIFEST=manifest
else
MANIFEST=
endif
bin_src_data_files_DJGPP=
bin_src_data_files_Linux=LINUX.TXT
bin_src_data_files=RHIDE.BIN README.IDE COPYING.RH COPYING rhide_ch.log \
$(bin_src_data_files_$(rhide_OS))
bin_src_bin_files_DJGPP=
bin_src_bin_files_Linux=VCSA.SH configure
bin_src_bin_files=$(bin_src_bin_files_$(rhide_OS))
bin_src_files=$(bin_src_data_files) $(bin_src_bin_files)
bin_src_prefix_DJGPP=$(install_prefix_src)/
bin_src_prefix_Linux=
bin_src_prefix=$(bin_src_prefix_$(rhide_OS))
install.bin_src_files:
$(INSTALL_DIR) $(prefix)/$(bin_src_prefix)
$(INSTALL_DATA) $(addprefix $(srcdir)/,$(bin_src_files)) $(prefix)/$(bin_src_prefix)
ifneq ($(bin_src_bin_files),)
chmod +x $(addprefix $(prefix)/$(bin_src_prefix),$(bin_src_bin_files))
endif
echo $(addprefix $(bin_src_prefix),$(bin_src_files)) >> $(logfile)
ifneq ($(txt_conv),)
$(txt_conv) $(addprefix $(prefix)/$(bin_src_prefix),$(bin_src_files))
endif
ifneq ($(link_type),dynamic)
DISTRIB_BIN_FLAGS=\
"LDFLAGS=$(LDFLAGS) -s -static" \
LFN=Y \
FNCASE=Y
else
DISTRIB_BIN_FLAGS=\
"LDFLAGS=$(LDFLAGS) -s -dynamic" \
LFN=Y \
FNCASE=Y
endif
ifeq ($(rhide_OS),DJGPP)
install_prefix_bin=
else
install_prefix_bin=/$(PACKAGE_DIR)$(DIR_VERSION)
endif
install::
$(MAKE) $(FLAGS_TO_PASS) subdir_do SUBDIR_TARGET=install
install.all:
$(MAKE) $(FLAGS_TO_PASS) install logfile=$(logfile)
distrib.bin_: $(notdir $(txt_conv)) install.all install.bin_src_files $(MANIFEST)
distrib.dynamic:
$(MAKE) link_type=dynamic archive_id=.dynamic distrib.bin
distrib.build.bin: distrib.src
rm -rf $(build_dir)
mkdir -p $(build_dir)
ifeq ($(rhide_OS),DJGPP)
-unzip -d $(build_dir) $(src_archive)
else
tar -C $(build_dir) -xzvf $(obj_dir)/$(src_archive)
endif
cd $(build_dir)/$(install_prefix_src); $(build_dir)/$(install_prefix_src)/configure \
--with-dummy-iconv
make -C $(build_dir)/$(install_prefix_src) \
top_obj_dir=$(build_dir)/$(install_prefix_src) \
distrib.bin
cp $(build_dir)/$(install_prefix_src)/$(bin_archive) $(top_obj_dir)
distrib.bin: check_perms init.version touch_gprs
rm -rf $(copy_dir)
rm -f $(main_executables)
# make at first gpr2mak
$(MAKE) $(FLAGS_TO_PASS) $(DISTRIB_BIN_FLAGS) gpr2mak.exe
$(MAKE) $(FLAGS_TO_PASS) prefix=$(copy_dir)$(install_prefix_bin) \
logfile=rhide.log $(DISTRIB_BIN_FLAGS) \
txt_conv="$(top_obj_dir)/$(txt_conv_$(rhide_OS))" \
distrib.bin_
ifeq ($(rhide_OS),DJGPP)
# On DJGPP the ZIP format is default
rm -f $(bin_archive)
cd $(copy_dir); zip -9r $(obj_dir)/$(bin_archive) \
@$(copy_dir)/manifest/$(rhideb).mft; \
cd /; cd $(obj_dir)
else
tar -C $(copy_dir) -cvf - `ls $(copy_dir) | sed 's,$(copy_dir)/,,g'` \
| gzip -9c > $(obj_dir)/$(bin_archive)
endif
RAW_TV_SRC=$(sort $(subst .o,.cc,$(shell ar t $(TVOBJ)/librhtv.a)))
TV_SRC=\
$(wildcard $(addprefix $(REAL_TVSRC)/classes/,$(RAW_TV_SRC)))\
$(wildcard $(addprefix $(REAL_TVSRC)/linux/,$(RAW_TV_SRC)))\
$(wildcard $(addprefix $(REAL_TVSRC)/djgpp/,$(RAW_TV_SRC)))\
$(wildcard $(addprefix $(REAL_TVSRC)/classes/linux/,$(RAW_TV_SRC)))\
$(wildcard $(addprefix $(REAL_TVSRC)/classes/djgpp/,$(RAW_TV_SRC)))
RAW_SET_SRC_BASE=$(subst .o,.cc,$(shell ar t $(SETOBJ)/libset.a))
ifneq ($(wildcard $(SETOBJ)/easydiag.a),)
RAW_SET_SRC_EASY=$(subst .o,.cc,$(shell ar t $(SETOBJ)/easydiag.a))
endif
RAW_SET_SRC=$(sort $(RAW_SET_SRC_BASE) $(RAW_SET_SRC_EASY))
SET_SRC=\
$(wildcard $(addprefix $(REAL_SETSRC)/calcu/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/doc/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/easydiag/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/infview/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/mainsrc/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/setedit/,$(RAW_SET_SRC)))\
$(wildcard $(addprefix $(REAL_SETSRC)/settvuti/,$(RAW_SET_SRC)))
additional_po_files=$(TV_SRC) $(SET_SRC)
_additional_po_files:=$(wildcard $(REAL_TVSRC)/*.cc)\
$(wildcard $(REAL_TVSRC)/classes/*.cc)\
$(wildcard $(REAL_TVSRC)/linux/*.cc)\
$(wildcard $(REAL_TVSRC)/djgpp/*.cc)\
$(wildcard $(REAL_TVSRC)/classes/linux/*.cc)\
$(wildcard $(REAL_TVSRC)/classes/djgpp/*.cc)\
\
$(wildcard $(REAL_SETSRC)/calcu/*.cc)\
$(wildcard $(REAL_SETSRC)/doc/*.c)\
$(wildcard $(REAL_SETSRC)/easydiag/*.cc)\
$(wildcard $(REAL_SETSRC)/infview/*.cc)\
$(wildcard $(REAL_SETSRC)/mainsrc/*.cc)\
$(wildcard $(REAL_SETSRC)/setedit/*.cc)\
$(wildcard $(REAL_SETSRC)/settvuti/*.cc)
check_perms:
ifneq ($(rhide_OS),DJGPP)
-find $(srcdir) -not -type d -exec chmod 644 {} \;
-find $(srcdir) -type d -o -name "*.exe" -exec chmod 755 {} \;
-chmod 755 $(srcdir)/configure $(srcdir)/rhidex $(srcdir)/rhgdbx \
$(srcdir)/config.guess $(srcdir)/config.sub \
$(srcdir)/configure.sub $(srcdir)/install.sh
endif
distrib.deb: distrib.src
ifneq ($(rhide_OS),DJGPP)
rm -rf $(copy_dir)
mkdir -p $(copy_dir)
tar -C $(copy_dir) -xzvf $(obj_dir)/$(PACKAGE)$(DIR_VERSION).tar.gz
cd $(copy_dir)/$(PACKAGE)$(DIR_VERSION); echo s | deb-make
cd $(copy_dir)/$(PACKAGE)$(DIR_VERSION); fakeroot debian/rules binary
endif
distrib.rpm: distrib.src
ifneq ($(rhide_OS),DJGPP)
ln -sf $(obj_dir)/$(PACKAGE)$(DIR_VERSION).tar.gz /usr/src/packages/SOURCES/$(PACKAGE)$(DIR_VERSION).tar.gz
rpm -ba --clean $(srcdir)/rhide.spec
rm -f /usr/src/packages/SOURCES/$(PACKAGE)$(DIR_VERSION).tar.gz
endif