completing previous commit (hold loop calcuation upgrade scripts)
[Evergreen.git] / Open-ILS / src / Makefile.am
1 # Copyright (C) 2008 Equinox Software, Inc.
2 # Kevin Beswick <kevinbeswick00@gmail.com>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 ## Process this file with automake to generate Makefile.in
15
16
17 export INCDIR = "$(INCLUDEDIR)/openils/"
18 export STAFF_CLIENT_BUILD_ID = `/bin/cat @top_srcdir@/Open-ILS/xul/staff_client/build/BUILD_ID`
19 export DEF_LDFLAGS = -L. -L$(TMP) -L$(OPENSRF_LIBS)
20 export DEF_CFLAGS = -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I@top_srcdir@/include -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS)  -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) -I$(OPENSRF_HEADERS)
21 export DEF_LDLIBS = -lopensrf 
22
23
24 # Establish some installation directories and such
25 prefix=@prefix@
26 exec_prefix=@exec_prefix@
27 datadir=@localstatedir@/data
28 circrulesdir=@localstatedir@/circ
29 catalogscriptdir=@localstatedir@/catalog
30 penaltyrulesdir=@localstatedir@/penalty
31 examples = @top_srcdir@/Open-ILS/examples
32 jsbackend = @srcdir@/javascript/backend
33 supportscr = @srcdir@/support-scripts
34 webdir = $(WEBDIR)
35 opacjsdir = $(DESTDIR)$(WEBDIR)/opac/common/js
36 jsdojodir = $(DESTDIR)$(WEBDIR)/js/dojo
37 jsdojoosrfdir = $(DESTDIR)$(WEBDIR)/js/dojo/opensrf
38 opacextrasdir = $(DESTDIR)$(WEBDIR)/opac/extras/xsl/
39 reportsdir = $(DESTDIR)$(WEBDIR)/reports/
40
41 # Collect files to be used by multiple targets
42
43 autojsbinscripts = @srcdir@/extras/fieldmapper.pl \
44          @srcdir@/extras/locale_html_options.pl \
45          @srcdir@/extras/org_tree_js.pl \
46          @srcdir@/extras/org_lasso_js.pl \
47          @srcdir@/extras/org_tree_html_options.pl \
48          @srcdir@/extras/org_tree_proximity.pl \
49          @srcdir@/extras/autogen.sh \
50          @srcdir@/support-scripts/offline-blocked-list.pl 
51
52 # Decide which entities to build
53
54 #----------------------------
55 # Build ILS CORE
56 #----------------------------
57
58 if BUILDILSCORE
59
60 #Add directories to build
61 OILSCORE_DIRS = c-apps extras 
62 #Add manual (non-automake) install targets for simplicity of installing.
63 OILSCORE_INST = ilscore-install
64
65 core_data = @srcdir@/extras/ils_events.xml \
66             $(examples)/hold_notification_template.example
67
68 sysconf_DATA = $(examples)/opensrf.xml.example \
69                $(examples)/opensrf_core.xml.example \
70                $(examples)/fm_IDL.xml \
71                $(examples)/oils_sip.xml.example \
72                $(examples)/oils_web.xml.example \
73                $(examples)/lib_ips.txt.example
74
75 core_scripts =   $(examples)/oils_ctl.sh \
76                  $(supportscr)/fine_generator.pl \
77                  $(supportscr)/hold_targeter.pl \
78                  $(supportscr)/reshelving_complete.srfsh \
79                  $(supportscr)/juv_to_adult.srfsh \
80                  $(supportscr)/thaw_expired_frozen_holds.srfsh \
81                  $(supportscr)/long-overdue-status-update.pl \
82                  $(srcdir)/extras/openurl_map.pl \
83                  $(srcdir)/extras/fast-extract \
84                  $(srcdir)/extras/import/marc_add_ids
85          
86 installautojs = $(autojsbinscripts)
87
88 #circ-rules-install
89 circrules_SCRIPTS = $(jsbackend)/circ/circ_duration.js \
90                     $(jsbackend)/circ/circ_groups.js \
91                     $(jsbackend)/circ/circ_item_config.js \
92                     $(jsbackend)/circ/circ_lib.js \
93                     $(jsbackend)/circ/circ_permit_copy.js \
94                     $(jsbackend)/circ/circ_permit_hold.js \
95                     $(jsbackend)/circ/circ_permit_patron.js \
96                     $(jsbackend)/circ/circ_permit_renew.js 
97 penaltyrules_SCRIPTS = $(jsbackend)/penalty/patron_penalty.js
98 catalogscript_SCRIPTS = $(jsbackend)/catalog/biblio_descriptor.js \
99                         $(jsbackend)/catalog/biblio_fingerprint.js \
100                         $(jsbackend)/catalog/fixed_fields.js \
101                         $(jsbackend)/catalog/phys_char.js \
102                         $(jsbackend)/catalog/record_type.js
103
104 endif
105
106 #--------------------
107 # Build ILS WEB
108 #--------------------
109
110 if BUILDILSWEB
111 OILSWEB_DIRS = apachemods
112 OILSWEB_INST = webcore-install offline-install cgi-bootstrap
113
114 #webcore-install
115
116 reports_SCRIPTS = @top_srcdir@/Open-ILS/xul/staff_client/server/admin/adminlib.js
117 opacjs_SCRIPTS = $(OPENSRF_LIBS)/javascript/DojoSRF.js \
118                  $(OPENSRF_LIBS)/javascript/JSON_v0.js \
119                  $(OPENSRF_LIBS)/javascript/JSON_v1.js \
120                  $(OPENSRF_LIBS)/javascript/md5.js \
121                  $(OPENSRF_LIBS)/javascript/opensrf.js \
122                  $(OPENSRF_LIBS)/javascript/opensrf_xhr.js \
123                  $(OPENSRF_LIBS)/javascript/opensrf_xmpp.js \
124                  @top_srcdir@/Open-ILS/xul/staff_client/chrome//content//util/date.js
125 jsdojo_SCRIPTS = $(OPENSRF_LIBS)/javascript/DojoSRF.js
126 jsdojoosrf_SCRIPTS = $(OPENSRF_LIBS)/javascript/md5.js \
127                      $(OPENSRF_LIBS)/javascript/JSON_v1.js \
128                      $(OPENSRF_LIBS)/javascript/opensrf.js \
129                      $(OPENSRF_LIBS)/javascript/opensrf_xhr.js \
130                      $(OPENSRF_LIBS)/javascript/opensrf_xmpp.js
131
132 installautojs = $(autojsbinscripts)
133
134
135 endif
136
137
138 #---------------------
139 # Build ILS Reporter
140 #---------------------
141
142 if BUILDILSREPORTER
143 OILSREP_INST = reporter-install
144 #reporter-install
145 reporter_scripts = @srcdir@/reporter/clark-kent.pl \
146                    @srcdir@/reporter/find_orphaned_reports.pl
147 reporter_data = @srcdir@/reporter/report-fail \
148                @srcdir@/reporter/report-success
149 endif
150
151 #------------------------------
152 # Build ILS XUL CLIENT/SERVER
153 #------------------------------
154
155 if BUILDILSCLIENT
156 OILSCLIENT_DIRS = ../xul/staff_client
157 OILSSERVER_INST = server-xul
158 endif
159
160 #------------------------------
161 # Build EVERGREEN PYTHON
162 #------------------------------
163
164 if BUILDEGPYTHON
165 OILSPYTHON_DIR = python
166 endif
167
168 #------------------------------
169 # Build EVERGREEN JAVA
170 #------------------------------
171
172 if BUILDEGJAVA
173 OILSJAVA_DIR = java
174 endif
175
176 bin_SCRIPTS = $(core_scripts) $(reporter_scripts) $(installautojs) @srcdir@/extras/eg_config
177 data_DATA = $(core_data) $(reporter_data)
178
179 # Take care of which subdirectories to build, and which extra files to include in a distibution.
180
181 SUBDIRS = $(OILSCORE_DIRS) $(OILSWEB_DIRS) $(OILSCLIENT_DIRS) $(OILSPYTHON_DIR) $(OILSJAVA_DIR)
182
183 EXTRA_DIST = @srcdir@/perlmods @srcdir@/templates @top_srcdir@/Open-ILS/xsl @srcdir@/cgi-bin
184
185 # Install header files
186
187 oilsincludedir = $(DESTDIR)@includedir@/openils
188 headsdir = @top_srcdir@/Open-ILS/include/openils
189 oilsinclude_HEADERS = $(headsdir)/idl_fieldmapper.h $(headsdir)/oils_constants.h $(headsdir)/oils_event.h $(headsdir)/oils_idl.h $(headsdir)/oils_utils.h
190
191 # Install everything that did not get installed by autotools
192
193 install-data-hook: $(OILSCORE_INST) $(OILSWEB_INST) $(OILSREP_INST) $(OILSSERVER_INST)
194
195 uninstall-hook:
196         rm -R $(perldir)
197         rm -R $(TEMPLATEDIR)
198         rm -R $(XSLDIR)
199         rm -R $(CGIDIR)
200         rm -R $(webdir)
201         rm -R $(opacextrasdir)
202
203
204 #perl-install and string-templates-install      
205 ilscore-install:
206         @echo $@
207         @echo "Installing Perl modules"
208         mkdir -p $(perldir)
209         mkdir -p $(TEMPLATEDIR)
210         cp -r @srcdir@/perlmods/* $(perldir)
211         cp -r @srcdir@/templates/marc $(TEMPLATEDIR)
212         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@libdir@/perl5/OpenILS/WWW/Web.pm'
213         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@libdir@/perl5/OpenILS/WWW/Method.pm'
214         @echo "Installing string templates to $(TEMPLATEDIR)"
215         mkdir -p $(TEMPLATEDIR)
216         mkdir -p $(datadir)/overdue/
217         cp -r @srcdir@/templates/strings $(TEMPLATEDIR)
218         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
219         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
220         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
221         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
222         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
223         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
224         sed -i 's|LIBDIR|@libdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
225         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/autogen.sh'
226         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@bindir@/autogen.sh'
227         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/autogen.sh'
228         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/reshelving_complete.srfsh'
229         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/juv_to_adult.srfsh'
230         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
231         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
232         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/thaw_expired_frozen_holds.srfsh'
233         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/offline-blocked-list.pl'
234
235 webcore-install:
236         mkdir -p $(WEBDIR)
237         mkdir -p $(WEBDIR)/opac/extras/slimpac/
238         mkdir -p $(WEBDIR)/standalone/
239         mkdir -p $(opacextrasdir)
240         mkdir -p $(DESTDIR)$(reportsdir)
241         mkdir -p $(XSLDIR)
242         rm -f $(DESTDIR)$(reportsdir)/fm_IDL.xml
243         cp $(DESTDIR)@sysconfdir@/fm_IDL.xml $(DESTDIR)$(WEBDIR)/reports/
244         cp -r @top_srcdir@/Open-ILS/web/. $(DESTDIR)$(WEBDIR)
245         cp @top_srcdir@/Open-ILS/xsl/*.xsl $(opacextrasdir)
246         cp @top_srcdir@/Open-ILS/xsl/*.xsl $(XSLDIR)
247         cp -r $(DESTDIR)$(WEBDIR)/opac/skin/default/* $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/
248         cp -r @top_srcdir@/Open-ILS/web/opac/skin/craftsman/* $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/
249         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/mresult.xml
250         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/rresult.xml
251         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/rdetail.xml
252         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/advanced.xml
253         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/myopac.xml
254         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/cnbrowse.xml
255         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/mresult.xml
256         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/rresult.xml
257         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/rdetail.xml
258         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/advanced.xml
259         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/myopac.xml
260         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/craftsman/xml/cnbrowse.xml
261
262
263 offline-install:
264         @echo "Installing offline CGIs to $(CGIDIR)/offline";
265         mkdir -p $(TMP)
266         mkdir -p $(CGIDIR)/offline;
267         mkdir -p $(datadir)/offline;
268         perl -pe "s{##CONFIG##}{@sysconfdir@}" < @srcdir@/offline/offline.pl > $(TMP)/offline.pl;
269         cp $(TMP)/offline.pl $(DESTDIR)$(CGIDIR)/offline/
270         chmod +x $(DESTDIR)$(CGIDIR)/offline/offline.pl
271
272 cgi-bootstrap:
273         @echo "Installing cgi's to $(CGIDIR)"
274         mkdir -p $(TMP)/cgi-bin
275         mkdir -p $(CGIDIR)
276         for i in @srcdir@/cgi-bin/*cgi; do perl -pe "s{##CONFIG##}{@sysconfdir@}" < $$i > $(TMP)/$$i; done
277         cp $(TMP)/cgi-bin/*cgi $(CGIDIR)
278         cp -r @srcdir@/cgi-bin/support $(CGIDIR)
279         chmod 755 $(DESTDIR)$(CGIDIR)/*cgi
280
281 server-xul:
282         @echo $@
283         mkdir -p $(WEBDIR)
284         mkdir -p $(WEBDIR)/xul/
285         @echo "BUILD_ID = $(STAFF_CLIENT_BUILD_ID)"
286         @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
287         mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
288         cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"
289
290 reporter-install:
291         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/clark-kent.pl'
292         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/find_orphaned_reports.pl'
293
294