-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
131 lines (126 loc) · 3.9 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- makefile -*-
#####################################################################
# #
# Make file for SOH page #
# #
# author: t isobe ([email protected]) #
# last update: Apr 25, 2019 #
# #
#####################################################################
#
#--- Change the following lines to appropriate ones
#
# TASK: task name; the script will be kept there
# ROOT: main script directory
# WEB: main web directory
# WDIR: the directory where the html pages will be kept
# NPYTHON: python path
#
TASK = CSH
VERSION = 1.0
ROOT = /home/isobe/proj
WEB = /home/isobe/www
SOFT = /soft
NSITE = $(WEB)/$(TASK)
NBIN = $(ROOT)/bin
NBDATA = $(ROOT)/bdata
NPYTHON = /proj/sot/ska/bin/python
NPERL = /usr/bin/perl
NPPKG = /usr/bin/python2.7/site-packages
NWADRS = cxc.cfa.harvard.edu/mta
#
#--- Define generic installation paths
#
ifndef INSTALL
INSTALL = $(ROOT)
endif
ifndef TASK
TASK = share
endif
ifndef INSTALL_SHARE
INSTALL_SHARE = $(INSTALL)/$(TASK)
endif
#
#--- this is where all scripts will be kept
#
NSCRIPT = $(INSTALL_SHARE)/Scripts
NHPATH = $(NSCRIPT)/house_keeping
#
#--- changing lines in scripts (they will be replaced by the lines defined above)
#
OROOT = /data/mta/Script
OMAIN = $(OROOT)/SOH
OSCRIPT = $(OMAIN)
OWEB = /data/mta4/www
OWEB2 = /data/mta4/www
OSITE = $(OWEB)/CSH
OHPATH = $(OMAIN)/house_keeping
ASCDS = /home/ascds
OPYTHON = /proj/sot/ska/bin/python
OPPKG = /proj/sot/ska/arch/x86_64-linux_CentOS-5/lib/python2.7/site-packages
OPERL = /usr/local/bin/perl
OBIN = /data/mta/MTA/bin
OBDATA = /data/mta/MTA/data
OWADRS = cxc.cfa.harvard.edu/mta
#
#--- files, directories to be copied/modified
#
SHARE = *.py *_script* *_script.sh *_daemonize.c README
S_LIST = $(wildcard *.py *_script* _script.sh *_daemonize.c) README
HK = house_keeping
J_LIST = $(wildcard CSH/js_*/*.js CSH/js_*/*/*.js)
SUB_LIST= Plots
#
#--- Installation
#
install:
ifdef SHARE
mkdir -p $(NSCRIPT)
rsync --times --cvs-exclude $(SHARE) $(NSCRIPT)/
rsync -r --times --cvs-exclude $(HK) $(NSCRIPT)/
mkdir -p $(INSTALL_SHARE)/Data
#
#--- change lines in the python scripts to appropriate ones
#
for ENT in $(S_LIST); do \
sed -i "s,$(OPYTHON),$(NPYTHON),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OPERL),$(NPERL),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OPPKG),$(NPPKG),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OSITE),$(NSITE),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OHPATH),$(NHPATH),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OSCRIPT),$(NSCRIPT),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OMAIN),$(INSTALL_SHARE),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OROOT),$(ROOT),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(ASCDS),$(SOFT),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OWEB),$(WEB),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OWEB2),$(WEB),g" $(NSCRIPT)/$$ENT;\
sed -i "s,$(OWADRS),$(NWADRS),g" $(NSCRIPT)/$$ENT;\
done
#
#--- change lines in the dir_list_py to appropriate ones
#
for ENT in $(H_LIST); do \
sed -i "s,$(OBIN),$(NBIN),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OBDATA),$(NBDATA),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OHPATH),$(NHPATH),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OSITE),$(NSITE),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OSCRIPT),$(NSCRIPT),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OMAIN),$(INSTALL_SHARE),g" $(NSCRIPT)/$(HK)/$$ENT;\
sed -i "s,$(OROOT),$(ROOT),g" $(NSCRIPT)/$(HK)/$$ENT;\
done
#
#--- change js files
#
for ENT in $(J_LIST); do \
sed -i "s,$(OSITE),$(NSITE),g" $(NSCRIPT)/$$ENT;\
done
endif
#
#--- Create a distribution tar file for this program
#
dist:
mkdir $(TASK)-$(VERSION)
rsync -aruvz --cvs-exclude --exclude $(TASK)-$(VERSION) * $(TASK)-$(VERSION)
tar cvf $(TASK)-$(VERSION).tar $(TASK)-$(VERSION)
gzip --best $(TASK)-$(VERSION).tar
rm -rf $(TASK)-$(VERSION)/