ad3abff0208ffa72dd02a351b61835e39f1c46bd
[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 admindir = $(ADMINDIR)
36 opacjsdir = $(DESTDIR)$(WEBDIR)/opac/common/js
37 jsdojodir = $(DESTDIR)$(WEBDIR)/js/dojo
38 jsdojoosrfdir = $(DESTDIR)$(WEBDIR)/js/dojo/opensrf
39 opacextrasdir = $(DESTDIR)$(WEBDIR)/opac/extras/xsl/
40 reportsdir = $(DESTDIR)$(WEBDIR)/reports/
41
42 # Collect files to be used by multiple targets
43
44 autojsbinscripts = @srcdir@/extras/fieldmapper.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)/lib_ips.txt.example
73
74 core_scripts =   $(examples)/oils_ctl.sh \
75                  $(supportscr)/fine_generator.pl \
76                  $(supportscr)/hold_targeter.pl \
77                  $(supportscr)/reshelving_complete.srfsh \
78                  $(supportscr)/thaw_expired_frozen_holds.srfsh \
79                  $(supportscr)/long-overdue-status-update.pl \
80                  $(srcdir)/extras/openurl_map.pl 
81          
82 installautojs = $(autojsbinscripts)
83
84 #circ-rules-install
85 circrules_SCRIPTS = $(jsbackend)/circ/circ_duration.js \
86                     $(jsbackend)/circ/circ_groups.js \
87                     $(jsbackend)/circ/circ_item_config.js \
88                     $(jsbackend)/circ/circ_lib.js \
89                     $(jsbackend)/circ/circ_permit_copy.js \
90                     $(jsbackend)/circ/circ_permit_hold.js \
91                     $(jsbackend)/circ/circ_permit_patron.js \
92                     $(jsbackend)/circ/circ_permit_renew.js 
93 penaltyrules_SCRIPTS = $(jsbackend)/penalty/patron_penalty.js
94 catalogscript_SCRIPTS = $(jsbackend)/catalog/biblio_descriptor.js \
95                         $(jsbackend)/catalog/biblio_fingerprint.js \
96                         $(jsbackend)/catalog/fixed_fields.js \
97                         $(jsbackend)/catalog/phys_char.js \
98                         $(jsbackend)/catalog/record_type.js
99
100 endif
101
102 #--------------------
103 # Build ILS WEB
104 #--------------------
105
106 if BUILDILSWEB
107 OILSWEB_DIRS = apachemods
108 OILSWEB_INST = webcore-install offline-install cgi-bootstrap
109
110 #webcore-install
111
112 reports_SCRIPTS = @top_srcdir@/Open-ILS/xul/staff_client/server/admin/adminlib.js
113 opacjs_SCRIPTS = $(OPENSRF_LIBS)/javascript/DojoSRF.js \
114                  $(OPENSRF_LIBS)/javascript/JSON_v0.js \
115                  $(OPENSRF_LIBS)/javascript/JSON_v1.js \
116                  $(OPENSRF_LIBS)/javascript/md5.js \
117                  $(OPENSRF_LIBS)/javascript/opensrf.js \
118                  $(OPENSRF_LIBS)/javascript/opensrf_xhr.js \
119                  $(OPENSRF_LIBS)/javascript/opensrf_xmpp.js \
120                  @top_srcdir@/Open-ILS/xul/staff_client/chrome//content//util/date.js
121 jsdojo_SCRIPTS = $(OPENSRF_LIBS)/javascript/DojoSRF.js
122 jsdojoosrf_SCRIPTS = $(OPENSRF_LIBS)/javascript/md5.js \
123                      $(OPENSRF_LIBS)/javascript/JSON_v1.js \
124                      $(OPENSRF_LIBS)/javascript/opensrf.js \
125                      $(OPENSRF_LIBS)/javascript/opensrf_xhr.js \
126                      $(OPENSRF_LIBS)/javascript/opensrf_xmpp.js
127
128 installautojs = $(autojsbinscripts)
129
130
131 endif
132
133
134 #---------------------
135 # Build ILS Reporter
136 #---------------------
137
138 if BUILDILSREPORTER
139 OILSREP_INST = reporter-install
140 #reporter-install
141 reporter_scripts = @srcdir@/reporter/clark-kent.pl \
142                    @srcdir@/reporter/find_orphaned_reports.pl
143 reporter_data = @srcdir@/reporter/report-fail \
144                @srcdir@/reporter/report-success
145 endif
146
147 #------------------------------
148 # Build ILS XUL CLIENT/SERVER
149 #------------------------------
150
151 if BUILDILSCLIENT
152 OILSCLIENT_DIRS = ../xul/staff_client
153 OILSSERVER_INST = server-xul
154 endif
155
156 #------------------------------
157 # Build EVERGREEN PYTHON
158 #------------------------------
159
160 if BUILDEGPYTHON
161 OILSPYTHON_DIR = python
162 endif
163
164 #------------------------------
165 # Build EVERGREEN JAVA
166 #------------------------------
167
168 if BUILDEGJAVA
169 OILSJAVA_DIR = java
170 endif
171
172 bin_SCRIPTS = $(core_scripts) $(reporter_scripts) $(installautojs) @srcdir@/extras/eg_config
173 data_DATA = $(core_data) $(reporter_data)
174
175 # Take care of which subdirectories to build, and which extra files to include in a distibution.
176
177 SUBDIRS = $(OILSCORE_DIRS) $(OILSWEB_DIRS) $(OILSCLIENT_DIRS) $(OILSPYTHON_DIR) $(OILSJAVA_DIR)
178
179 EXTRA_DIST = @srcdir@/perlmods @srcdir@/templates @top_srcdir@/Open-ILS/xsl @srcdir@/cgi-bin
180
181 # Install header files
182
183 oilsincludedir = $(DESTDIR)@includedir@/openils
184 headsdir = @top_srcdir@/Open-ILS/include/openils
185 oilsinclude_HEADERS = $(headsdir)/idl_fieldmapper.h $(headsdir)/oils_constants.h $(headsdir)/oils_event.h $(headsdir)/oils_idl.h $(headsdir)/oils_utils.h
186
187 # Install everything that did not get installed by autotools
188
189 install-data-hook: $(OILSCORE_INST) $(OILSWEB_INST) $(OILSREP_INST) $(OILSSERVER_INST)
190
191 uninstall-hook:
192         rm -R $(perldir)
193         rm -R $(TEMPLATEDIR)
194         rm -R $(XSLDIR)
195         rm -R $(CGIDIR)
196         rm -R $(admindir) 
197         rm -R $(webdir)
198         rm -R $(opacextrasdir)
199
200
201 #perl-install and string-templates-install      
202 ilscore-install:
203         @echo $@
204         @echo "Installing Perl modules"
205         mkdir -p $(perldir)
206         mkdir -p $(TEMPLATEDIR)
207         cp -r @srcdir@/perlmods/* $(perldir)
208         cp -r @srcdir@/templates/marc $(TEMPLATEDIR)
209         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@libdir@/perl5/OpenILS/WWW/Web.pm'
210         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@libdir@/perl5/OpenILS/WWW/Method.pm'
211         @echo "Installing string templates to $(TEMPLATEDIR)"
212         mkdir -p $(TEMPLATEDIR)
213         mkdir -p $(datadir)/overdue/
214         cp -r @srcdir@/templates/strings $(TEMPLATEDIR)
215         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
216         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
217         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
218         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
219         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
220         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
221         sed -i 's|LIBDIR|@libdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
222         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/autogen.sh'
223         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@bindir@/autogen.sh'
224         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/reshelving_complete.srfsh'
225         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
226         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
227         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/thaw_expired_frozen_holds.srfsh'
228         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/offline-blocked-list.pl'
229
230 webcore-install:
231         mkdir -p $(WEBDIR)
232         mkdir -p $(WEBDIR)/opac/extras/slimpac/
233         mkdir -p $(WEBDIR)/standalone/
234         mkdir -p $(opacextrasdir)
235         mkdir -p $(XSLDIR)
236         cp -r @top_srcdir@/Open-ILS/admin/ @localstatedir@
237         cp -r @top_srcdir@/Open-ILS/web/ @localstatedir@
238         cp @top_srcdir@/Open-ILS/xsl/*.xsl $(opacextrasdir)
239         cp @top_srcdir@/Open-ILS/xsl/*.xsl $(XSLDIR)
240         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/mresult.xml
241         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/rresult.xml
242         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/rdetail.xml
243         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/advanced.xml
244         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/myopac.xml
245         ln -sf $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/index.xml $(DESTDIR)$(WEBDIR)/opac/skin/default/xml/cnbrowse.xml
246         ln -sf $(DESTDIR)@sysconfdir@/fm_IDL.xml $(DESTDIR)$(WEBDIR)/reports/
247         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@localstatedir@/admin/ils_admin/settings.py.example'
248
249
250 offline-install:
251         @echo "Installing offline CGIs to $(CGIDIR)/offline";
252         mkdir -p $(TMP)
253         mkdir -p $(CGIDIR)/offline;
254         mkdir -p $(datadir)/offline;
255         perl -pe "s{##CONFIG##}{@sysconfdir@}" < @srcdir@/offline/offline.pl > $(TMP)/offline.pl;
256         cp @srcdir@/offline/offline-config.pl @sysconfdir@
257         cp $(TMP)/offline.pl $(DESTDIR)$(CGIDIR)/offline/
258         chmod +x $(DESTDIR)$(CGIDIR)/offline/offline.pl
259
260 cgi-bootstrap:
261         @echo "Installing cgi's to $(CGIDIR)"
262         mkdir -p $(TMP)/cgi-bin
263         mkdir -p $(CGIDIR)
264         for i in @srcdir@/cgi-bin/*cgi; do perl -pe "s{##CONFIG##}{@sysconfdir@}" < $$i > $(TMP)/$$i; done
265         cp $(TMP)/cgi-bin/*cgi $(CGIDIR)
266         cp -r @srcdir@/cgi-bin/support $(CGIDIR)
267         cp @srcdir@/cgi-bin/setup.pl @sysconfdir@/live-db-setup.pl
268         chmod 755 $(DESTDIR)$(CGIDIR)/*cgi
269
270 server-xul:
271         @echo $@
272         mkdir -p $(WEBDIR)
273         mkdir -p $(WEBDIR)/xul/
274         @echo "BUILD_ID = $(STAFF_CLIENT_BUILD_ID)"
275         @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
276         mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
277         cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"
278
279 reporter-install:
280         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/clark-kent.pl'
281         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/find_orphaned_reports.pl'
282
283