Make Evergreen Perl modules installable via Module::Build to match OpenSRF
[working/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
35 # Collect files to be used by multiple targets
36
37 autojsbinscripts = @srcdir@/extras/fieldmapper.pl \
38          @srcdir@/extras/locale_html_options.pl \
39          @srcdir@/extras/org_tree_js.pl \
40          @srcdir@/extras/org_lasso_js.pl \
41          @srcdir@/extras/facet_types_js.pl \
42          @srcdir@/extras/org_tree_html_options.pl \
43          @srcdir@/extras/org_tree_proximity.pl \
44          @srcdir@/extras/autogen.sh \
45          @srcdir@/support-scripts/offline-blocked-list.pl 
46
47 # Decide which entities to build
48
49 sysconf_DATA = $(examples)/action_trigger_filters.json.example \
50                $(examples)/opensrf.xml.example \
51                $(examples)/opensrf_core.xml.example \
52                $(examples)/fm_IDL.xml \
53                $(examples)/oils_sip.xml.example \
54                $(examples)/oils_web.xml.example \
55                $(examples)/lib_ips.txt.example
56
57 #----------------------------
58 # Build ILS CORE
59 #----------------------------
60
61 if BUILDILSCORE
62
63 #Add directories to build
64 OILSCORE_DIRS = c-apps extras perlmods
65 #Add manual (non-automake) install targets for simplicity of installing.
66 OILSCORE_INST = ilscore-install
67
68 core_data = @srcdir@/extras/ils_events.xml \
69             $(examples)/hold_notification_template.example
70
71 core_scripts =   $(examples)/oils_ctl.sh \
72                  $(supportscr)/fine_generator.pl \
73                  $(supportscr)/hold_targeter.pl \
74                  $(supportscr)/reshelving_complete.srfsh \
75                  $(supportscr)/clear_expired_circ_history.srfsh \
76                  $(supportscr)/update_hard_due_dates.srfsh \
77                  $(supportscr)/juv_to_adult.srfsh \
78                  $(supportscr)/thaw_expired_frozen_holds.srfsh \
79                  $(supportscr)/long-overdue-status-update.pl \
80                  $(supportscr)/action_trigger_runner.pl \
81                  $(srcdir)/extras/openurl_map.pl \
82                  $(srcdir)/extras/import/marc_add_ids
83          
84 installautojs = $(autojsbinscripts)
85
86 #circ-rules-install
87 circrules_SCRIPTS = $(jsbackend)/circ/circ_duration.js \
88                     $(jsbackend)/circ/circ_groups.js \
89                     $(jsbackend)/circ/circ_item_config.js \
90                     $(jsbackend)/circ/circ_lib.js \
91                     $(jsbackend)/circ/circ_permit_copy.js \
92                     $(jsbackend)/circ/circ_permit_hold.js \
93                     $(jsbackend)/circ/circ_permit_patron.js \
94                     $(jsbackend)/circ/circ_permit_renew.js 
95 penaltyrules_SCRIPTS = $(jsbackend)/penalty/patron_penalty.js
96 catalogscript_SCRIPTS = $(jsbackend)/catalog/biblio_descriptor.js \
97                         $(jsbackend)/catalog/biblio_fingerprint.js \
98                         $(jsbackend)/catalog/fixed_fields.js \
99                         $(jsbackend)/catalog/phys_char.js \
100                         $(jsbackend)/catalog/record_type.js
101
102 endif
103
104 #--------------------
105 # Build Apache modules
106 #--------------------
107
108 if BUILDAPACHEMODS
109 OILSWEB_DIR = apachemods
110 endif
111
112 #---------------------
113 # Build ILS Reporter
114 #---------------------
115
116 if BUILDILSREPORTER
117 OILSREP_INST = reporter-install
118 #reporter-install
119 reporter_scripts = @srcdir@/reporter/clark-kent.pl \
120                    @srcdir@/reporter/find_orphaned_reports.pl
121 reporter_data = @srcdir@/reporter/report-fail \
122                @srcdir@/reporter/report-success
123 endif
124
125 #------------------------------
126 # Build EVERGREEN PYTHON
127 #------------------------------
128
129 if BUILDEGPYTHON
130 OILSPYTHON_DIR = python
131 endif
132
133 #------------------------------
134 # Build EVERGREEN JAVA
135 #------------------------------
136
137 if BUILDEGJAVA
138 OILSJAVA_DIR = java
139 endif
140
141 bin_SCRIPTS = $(core_scripts) $(reporter_scripts) $(installautojs) @srcdir@/extras/eg_config @srcdir@/extras/fast-extract
142 data_DATA = $(core_data) $(reporter_data)
143
144 # Take care of which subdirectories to build, and which extra files to include in a distribution.
145
146 SUBDIRS = $(OILSCORE_DIRS) $(OILSWEB_DIR) $(OILSPYTHON_DIR) $(OILSJAVA_DIR)
147
148 EXTRA_DIST = @srcdir@/perlmods @srcdir@/templates @top_srcdir@/Open-ILS/xsl @srcdir@/cgi-bin
149
150 # Install header files
151
152 oilsincludedir = $(DESTDIR)@includedir@/openils
153 headsdir = @top_srcdir@/Open-ILS/include/openils
154 oilsinclude_HEADERS = $(headsdir)/idl_fieldmapper.h $(headsdir)/oils_constants.h $(headsdir)/oils_event.h $(headsdir)/oils_idl.h $(headsdir)/oils_utils.h
155
156 # Install everything that did not get installed by autotools
157
158 install-data-hook: $(OILSCORE_INST) $(OILSWEB_INST) $(OILSUPDATES_INST) $(OILSREP_INST)
159
160 uninstall-hook:
161         rm -R $(TEMPLATEDIR)
162         rm -R $(XSLDIR)
163         rm -R $(CGIDIR)
164
165
166 #perl-install and string-templates-install      
167 ilscore-install:
168         @echo $@
169         $(MKDIR_P) $(TEMPLATEDIR)
170         cp -r @srcdir@/templates/marc $(TEMPLATEDIR)
171         cp -r @srcdir@/templates/password-reset $(TEMPLATEDIR)
172         @echo "Installing string templates to $(TEMPLATEDIR)"
173         $(MKDIR_P) $(TEMPLATEDIR)
174         $(MKDIR_P) $(datadir)/overdue/
175         cp -r @srcdir@/templates/strings $(TEMPLATEDIR)
176         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
177         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
178         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
179         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
180         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
181         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
182         sed -i 's|LIBDIR|@libdir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
183         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/autogen.sh'
184         sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@bindir@/autogen.sh'
185         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/autogen.sh'
186         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/reshelving_complete.srfsh'
187         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/clear_expired_circ_history.srfsh'
188         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/update_hard_due_dates.srfsh'
189         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/juv_to_adult.srfsh'
190         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
191         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
192         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/thaw_expired_frozen_holds.srfsh'
193         sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/offline-blocked-list.pl'
194
195 reporter-install:
196         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/clark-kent.pl'
197         sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/find_orphaned_reports.pl'
198
199