-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmakefile.cm
More file actions
494 lines (379 loc) · 12 KB
/
Copy pathmakefile.cm
File metadata and controls
494 lines (379 loc) · 12 KB
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
#This file is part of SECONDO.
#
#Copyright (C) 2004, University in Hagen, Department of Computer Science,
#Database Systems for New Applications.
#
#SECONDO is 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 2 of the License, or
#(at your option) any later version.
#
#SECONDO is 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 SECONDO; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
########################################################################
#
# makefile.cm - rules for CM and deployment related tasks
#
#########################################################################
# some direcories used to build tar.gz files for
# Secondo sources or installation kits
pref := SECONDO_INSTALLATION_KIT
net := $(SECONDO_INST_KIT_ROOT)/$(pref)
# local directory for tar archives
ifndef tempdir
tempdir := /tmp/make-$(USER)
endif
shrc := $(shell if [ ! -d $(tempdir) ]; then if ! mkdir -p $(tempdir); then echo "false"; fi fi)
ifeq ($(shrc),false)
$(error Could not create directory $(tempdir)!)
endif
# files which are used to indicate
# if some special targets need to be maked
tsdk := $(tempdir)/sdk_dist
tnew := $(tempdir)/sdk_changed
tupd := $(tempdir)/show_update_msg
# run some shell commands
shrc := $(shell rm -f $(tupd))
shrc := $(shell if [ ! -e $(tsdk) ]; then touch $(tsdk); fi)
shrc := $(shell if [ ! -e $(tnew) ]; then touch $(tnew); fi)
# Rules for copying configuration scripts
SCRIPT_DIR := ./CM-Scripts
SCRIPT_FILES_CMD := libutil.sh \
profile \
bashrc_example \
secondorc \
secondo.aliases \
secondo.setroot \
secondo.config.linux \
secondo.config.win32 \
secondo.config.mac_osx
SDK_SCRIPTS_CMD := $(addprefix $(SECONDO_SDK)/, $(SCRIPT_FILES_CMD))
INST_KIT_SCRIPTS := $(addprefix $(net)/scripts/, $(SCRIPT_FILES_CMD) )
ALL_INST_KIT_SCRIPTS := $(net)/installsdk $(INST_KIT_SCRIPTS)
# Files located at the web server
websrv := $(SECONDO_WEBSRV_ROOT)/files
lin_guide := Linux-Installation-Guide.pdf
win_guide := Windows-Installation-Guide.pdf
osx_guide := Mac-OSX-Installation-Guide.pdf
sdk_guide := SDK_SETUP.pdf
lin_sdk := mac-osx-sdk.tar.gz
osx_sdk := linux-sdk.tar.gz
win_sdk := win32-sdk.zip
iso_sdk := secondo-cd.iso.zip
INST_GUIDES := $(addprefix $(websrv)/, $(lin_guide) $(win_guide) $(osx_guide) $(sdk_guide))
INST_KITS := $(addprefix $(websrv)/, $(lin_sdk) $(win_sdk) $(osx_sdk))
INST_KITS_TMP := $(addprefix $(tempdir)/, $(lin_sdk) $(win_sdk) $(osx_sdk))
WIN_SRC := secondo-$(tag)-CP1252.zip
LIN_SRC := secondo-$(tag)-LAT1.tar.gz
SRC_FILES := $(WIN_SRC) $(LIN_SRC)
.PHONY: update-environment
update-environment: show-separator remove-old-apps remove-old-config $(SDK_SCRIPTS_CMD) show-update-msg
UPDATE_MSG := "\n\
Configuration Setup has been updated. If you have made changes\n\
in one of the files above please transfer them into the new versions.\n\
A backup copy ending with .backup will be kept.\n\n\
Afterwards please execute the command\n\
source \$SECONDO_SDK/secondorc or close this shell \n\
and start a new one.\n\n\
Make can't do this for you since all commands started within\n\
make are processed in a new subshell, hence the environment\n\
of your current running shell will not be modified.\n"
VPATH := $(SCRIPT_DIR)
$(SECONDO_SDK)/%: %
@touch $(tupd)
@cp $@ $@.backup
@cp $< $@
@echo " updating" $@
$(net)/scripts/%: %
cp $< $@
$(net)/%: %
cp $< $@
$(net)/installsdk: installsdk
cp $< $@
chmod 755 $@
.PHONY: show-update-msg
show-update-msg:
@if [ -e $(tupd) ]; then echo $(UPDATE_MSG); \
else echo " ... are up to date.\n"; fi
.PHONY: show-separator
show-separator:
@echo; echo " *** Bash environment setup files *** "; echo
# update the installation kit
.PHONY: inst-kit
inst-kit: checkrootdir $(tnew) $(tsdk)
# special target which only updates script files
.PHONY: checkrootdir sdk-scripts
sdk-scripts: $(tnew)
$(tnew): $(ALL_INST_KIT_SCRIPTS)
touch $@
# special target which create new secondo source archives
.PHONY: src-dist
src-dist: src-archives
touch $(tnew)
# create new installation kits
.PHONY: sdk-tars
sdk-tars: $(INST_KITS_TMP)
.PHONY: sdk-cd
sdk-cd: $(tempdir)/secondo-cd.iso.zip
vpath %-Installation-Guide.pdf $(net)
vpath %.zip $(tempdir)
vpath %.gz $(tempdir)
# copy to web server
.PHONY: copy2web
copy2web: checkrootdir $(INST_GUIDES) $(INST_KITS)
$(websrv)/%-Installation-Guide.pdf: %-Installation-Guide.pdf
cp $< $@
$(websrv)/%.zip: %.zip
cp $< $@
$(websrv)/%.gz: %.gz
cp $< $@
# check if a root for the secondo SDK tools is present
.PHONY: checkrootdir
checkrootdir:
ifndef SECONDO_INST_KIT_ROOT
@echo; echo "Error: SECONDO_INST_KIT_ROOT not defined!"; echo; exit 1
else
@if [ ! -e $(net) ]; then \
echo; echo "Directory net=\"$(net)\" does not exist!"; echo; exit 2; fi
endif
$(tempdir)/linux-sdk.tar.gz: $(tnew)
rm -f $@
tar -C $(SECONDO_INST_KIT_ROOT) -cvzf $@ \
$(pref)/$(lin_guide) $(pref)/$(sdk_guide) $(pref)/installsdk $(pref)/linux $(pref)/scripts --exclude $(pref)/linux/j2sdk*
$(tempdir)/mac-osx-sdk.tar.gz: $(tnew)
rm -f $@
tar -C $(SECONDO_INST_KIT_ROOT) -cvzf $@ \
$(pref)/$(osx_guide) $(pref)/$(sdk_guide) $(pref)/installsdk $(pref)/linux $(pref)/mac_osx $(pref)/scripts --exclude $(pref)/linux/j2sdk*
$(tempdir)/win32-sdk.zip: $(tnew)
rm -f $@
cd $(SECONDO_INST_KIT_ROOT) && zip -9 -r $@ \
$(pref)/$(win_guide) $(pref)/$(sdk_guide) $(pref)/MSYS-* $(pref)/installsdk \
$(pref)/win32/prolog $(pref)/win32/mingw $(pref)/win32/non-gnu $(pref)/win32/gnu $(pref)/scripts
# create a iso image with Rockridge and Joliet extensions
.PHONY: isoimage
isoimage: $(tempdir)/secondo-cd.iso.zip
$(tempdir)/secondo-cd.iso.zip: $(tempdir)/secondo-cd.iso
rm -rf $@
zip -9 $@ $<
$(tempdir)/secondo-cd.iso: $(tnew)
rm -rf $@
mkisofs -J -r -iso-level 2 -graft-points -o $@ /=$(net)
.PHONY: doc-dist
doc-dist: $(net)/documentation
rm -f $(tempdir)/secondo-$@.zip
cd $(net) && zip -9 -r $(tempdir)/secondo-$@.zip documentation
OLD_APPS := bin/SecondoTTYBDB \
bin/SecondoMonitorBDB \
bin/SecondoServerBDB \
bin/TestRunner \
bin/TestRunnerApp \
Optimizer/SecondoPL \
Optimizer/SecondoPLCS \
.PHONY: remove-old-apps
remove-old-apps:
rm -f $(OLD_APPS)
.PHONY: remove-old-config
remove-old-config:
rm -f bin/SecondoConfig.ini Optimizer/SecondoConfig.ini
## rules for building a demo version
SECONDO_DEMO = ./sec-demo/secondo
DEMO_MAN := Documents/SecondoManual.pdf
ifeq ($(platform),win32)
DEMO_DEPS := $(PL_LIB_DIR)/*dll \
$(PL_LIB_DIR)/pthreadVC*dll \
$(JPL_JAR) \
$(SECONDO_SDK)/auxtools/bin/libgsl*dll \
$(SECONDO_SDK)/auxtools/bin/jpeg*dll
else
DEMO_DLL := $(PL_LIB_DIR)/libpl* \
$(SECONDO_SDK)/auxtools/lib/libgsl*dll \
$(SECONDO_SDK)/bdb/lib/libdb_cxx*
endif
TPC := Tools/Generators/TPC-H
TPC_GEN = $(TPC)/dbgen.exe $(TPC)/dists.dss $(TPC)/secondo/restore_objs
vpath Secondo% bin
.PHONY: demo
demo: mkdemodir cp_deps cp_files
.PHONY: mkdemodir
mkdemodir:
rm -rf $(SECONDO_DEMO)
mkdir -p $(SECONDO_DEMO)/bin
mkdir -p $(SECONDO_DEMO)/Optimizer
.PHONY: cp_deps
cp_deps: $(DEMO_MAN) $(DEMO_DEPS) $(TPC_GEN)
make -C Tools/Generators/TPC-H
cp $^ $(SECONDO_DEMO)/bin
cp $(PL_LIB_DIR)/../boot32.prc $(SECONDO_DEMO)
cp -R $(PL_LIB_DIR)/../boot $(SECONDO_DEMO)
cp -R $(PL_LIB_DIR)/../library $(SECONDO_DEMO)
.PHONY: cp_files
cp_files:
cp -R Optimizer $(SECONDO_DEMO)
cp -R bin $(SECONDO_DEMO)
cp CM-Scripts/initdemo.sh $(SECONDO_DEMO)
.PHONY: demo2
demo2: cp_gui demo
.PHONY: cp_gui
cp_gui:
mkdir -p $(SECONDO_DEMO)/Javagui
cp -R Javagui/Demo/* $(SECONDO_DEMO)/Javagui
.PHONY: tar_demo
tar_demo:
cd ./sec-demo; tar -cvzf ../sec-demo.tgz \
--exclude-from ../opt_demo.exclude \
--exclude-from ../bin_demo.exclude *
srcprefix := secondo
define checkTag
@if [ -z "$(tag)" ]; then echo; echo "Error: Variable \"tag\" not set! "; echo; exit 1; fi
endef
define checkDir
@if [ -d $(srcprefix) ]; then echo ; echo "Error: subdirectory $(srcprefix) already present! "; echo;exit 1; fi
endef
.PHONY: tag-version
tag-version:
$(checkTag)
cvs -Q tag -F $(tag)
fileList := $(tempdir)/_SRC_FILE_LIST
.PHONY: public-linux
public-linux: rmList mkLat1
.PHONY: public-version
public-version: rmList mkLat1 mkcp1252
.PHONY: cp-sources
cp-sources:
cp $(LIN_SRC) $(net)
cp $(WIN_SRC) $(net)
.PHONY: src-archive
src-archive:
cvs -Q export -rHEAD -dsecondo secondo
tar -czf secondo.tgz secondo
.PHONY: mkLat1
mkLat1: $(fileList)
rm -rf $(SRC_FILES)
tar -czf $(LIN_SRC) -T $<
.PHONY: mkcp1252
mkcp1252: $(fileList)
# a list of file endings which need not to be recoded
find $(srcprefix) ! \( \
-type d \
-or -name "*.bmp" \
-or -name "*.book" \
-or -name "*.canvas" \
-or -name "*.dll" \
-or -name "*.eps" \
-or -name "*.fig" \
-or -name "*.fm" \
-or -name "*.gz" \
-or -name "*.gif" \
-or -name "*.tgz" \
-or -name "*.jar" \
-or -name "*.zar" \
-or -name "*.jpg" \
-or -name "*.pdf" \
-or -name "*.png" \
-or -name "*.sxd" \
-or -name "*.sxc" \
-or -name "*.xls" \
-or -name "*.sda" \
-or -name "*.vsd" \
-or -name "*.zip" \
-or -name "*.icns" \
-or -path "*javazoom*" \
-or -path "*TPC-D*" \
\) \
-exec recode lat1..cp1252 {} \;
cat $< | zip -9 -r $(WIN_SRC) -@ > /dev/null
.PHONY: rmList
rmList:
$(checkDir)
rm -f $(fileList)
$(fileList): $(srcprefix)/makefile
CM-Scripts/mkpublic.sh nonpublic.filelist $@ $(srcprefix)
$(srcprefix)/makefile:
$(checkTag)
cvs -Q export -r$(tag) -d$(srcprefix) secondo
# store modified files in a tar archive
.PHONY: showdiff
showdiff:
cvs -nq update | grep "^. "
/tmp/cvs.list:
cvs -nq update | grep "^. " > $@
/tmp/tar.list: /tmp/cvs.list
cat $< | sed 's/. //' > $@
# you may need to setup ~/.cvsignore in order
# to prevent storing generated stuff
.PHONY: backup
backup: removeLists backup.tgz
.PHONY: removeLists
removeLists:
rm -f /tmp/tar.list
rm -f /tmp/cvs.list
backup.tgz: /tmp/tar.list
rm -f $@
tar -cvzf $@ -T $<
.PHONY: cscope
cscope: cscope.files
cscope -bq -i $<
cscope.files:
find . -iname "*.cpp" -or -iname "*.c" \
-or -iname "*.y" \
-or -iname "*.l" \
-or -iname "*.h" \
-or -iname "makefile*" > $@
.PHONY: backup-all
backup-all:
dir=$${PWD##*/}; tar -czf $$dir.tgz --exclude-from exclude.pat -C.. $$dir
.PHONY: sync-test
sync-test:
ifdef syncdir
rsync -nvau --exclude-from exclude.pat * $$syncdir
else
echo "Error: Variable syncdir undefined!"
endif
.PHONY: sync-now
sync-now:
ifdef syncdir
rsync -au --exclude-from exclude.pat * $$syncdir
else
echo "Error: Variable syncdir undefined!"
endif
.PHONY: showtags
showtags:
cvs log -h makefile
.PHONY: showpubtags
showpubtags:
cvs log -h makefile | grep public
.PHONY: changelog
changelog: ChangeLog updateChgLog ../secondo-src/Documents/ChangeLog
ChangeLog:
ifdef to
ifdef from
cvs -Q update -dP
cvs tag public-$(to)
cvs2cl.pl --delta public-$(from):public-$(to)
endif
endif
.PHONY: updateChgLog
updateChgLog: Documents/ChangeLog
Documents/ChangeLog: ChangeLog
mv Documents/ChangeLog ChangeLog.old
cat ChangeLog ChangeLog.old > Documents/ChangeLog
../secondo-src/Documents/ChangeLog: Documents/ChangeLog
cp $< ../secondo-src/Documents
# todo: write a shell script which recurses into sub directories and builds
# a complete list of new directories and new files.
.PHONY: newfiles
newfiles:
cvs -nq update | grep "^? " | sed 's#? ##' > newfiles.txt
.PHONY: addfiles
addfiles:
cvs add $(cat newfiles.txt)
# pattern rule for creating an tar ball
%.tar.gz : %
tar -czf $@ $<