adding support for alternate APR header dirs
[working/Evergreen.git] / OpenSRF / src / Makefile
1 # TOP level 'src' makefile for OpenSRF
2
3
4 export TMPDIR                   = $(TMP)/opensrf
5 export OPENSRF                  = opensrf
6 export BINDIR                   = $(PREFIX)/bin
7 export LIBDIR                   = $(PREFIX)/lib
8 export PERLDIR                  = $(LIBDIR)/perl5
9 export INCLUDEDIR               = $(PREFIX)/include
10
11 export LDLIBS                   += 
12 export LDFLAGS                  += -L $(TMPDIR) -L . -L /opt/lib
13 export CFLAGS                   += -pipe -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
14                                                                 -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) \
15                                                                 -I$(APR_HEADERS) -I$(TMPDIR)
16
17 LIBOPENSRF                              = libopensrf.so
18
19 OPENSRF_TARGETS = libtransport/transport_session.o \
20                                                 libtransport/transport_client.o \
21                                                 libtransport/transport_message.o \
22                                                 libstack/osrf_app_session.o \
23                                                 libstack/osrf_stack.o \
24                                                 libstack/osrfConfig.o \
25                                                 libstack/osrf_settings.o \
26                                                 libstack/osrf_message.o \
27                                                 libstack/osrf_prefork.o \
28                                                 libstack/osrf_system.o \
29                                                 libstack/osrf_application.o \
30                                                 libstack/osrf_cache.o \
31                                                 libstack/xml_utils.o \
32                                                 libstack/osrf_transgroup.o \
33                                                 libstack/osrf_list.o \
34                                                 libstack/osrf_hash.o \
35                                                 libstack/osrf_log.o \
36                                                 utils/socket_bundle.o \
37                                                 utils/string_array.o \
38                                                 utils/utils.o \
39                                                 utils/logging.o \
40                                                 utils/md5.o \
41                                                 utils/sha.o \
42
43 OPENSRF_HEADERS = libtransport/transport_session.h \
44                                                 libtransport/transport_client.h \
45                                                 libtransport/transport_message.h \
46                                                 libstack/osrf_app_session.h \
47                                                 libstack/osrf_stack.h \
48                                                 libstack/osrfConfig.h \
49                                                 libstack/osrf_settings.h \
50                                                 libstack/osrf_message.h \
51                                                 libstack/osrf_prefork.h \
52                                                 libstack/osrf_system.h \
53                                                 libstack/osrf_application.h \
54                                                 libstack/osrf_cache.h \
55                                                 libstack/xml_utils.h \
56                                                 libstack/osrf_log.h \
57                                                 libstack/osrf_transgroup.h \
58                                                 libstack/osrf_list.h \
59                                                 libstack/osrf_hash.h \
60                                                 utils/socket_bundle.h \
61                                                 utils/string_array.h \
62                                                 utils/utils.h \
63                                                 utils/logging.h \
64                                                 utils/md5.h \
65                                                 utils/sha.h \
66
67
68 all: prep libopensrf.so libstack/opensrf router srfsh jserver gateway
69
70 install: install-prep opensrf-install gateway-install   router-install \
71                 srfsh-install jserver-install perl-install objson-install
72
73 prep:
74         mkdir -p $(TMPDIR)
75
76 libopensrf.so:  objson/libobjson.so
77         @echo utils
78         make -C utils
79         @echo transport
80         make -C libtransport
81         @echo stack
82         make -C libstack
83         @echo $@
84         $(CC) -shared -W1 $(LDFLAGS) -lJudy -lxml2 -lmemcache -lobjson $(OPENSRF_TARGETS) -o $(TMPDIR)/$(LIBOPENSRF)
85         @echo apps
86         make -C  c-apps
87
88
89 opensrf-install:        objson-install
90         @echo $@
91         cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)/$(LIBOPENSRF)
92         cp $(OPENSRF_HEADERS) $(INCLUDEDIR)/opensrf/
93         cp libstack/opensrf $(BINDIR)/opensrf-c
94         make -C c-apps install
95
96
97 objson/libobjson.so:    prep
98         @echo $@
99         make -C objson
100
101 # --------------------------------------------------------------------------------
102 # BINARIES
103 # --------------------------------------------------------------------------------
104 libstack/opensrf.o:     libstack/opensrf.c
105 libstack/opensrf:       libstack/opensrf.o
106         $(CC) $(CFLAGS) $(LDFLAGS) -lJudy -lxml2 -lopensrf -lobjson libstack/opensrf.o -o $@
107         
108
109 router: libopensrf.so
110         @echo $@
111         make -C router 
112
113 srfsh: libopensrf.so
114         @echo $@
115         make -C srfsh
116
117 gateway:        libopensrf.so
118         @echo $@
119         make -C gateway
120
121 jserver:        libopensrf.so
122         @echo $@
123         make -C jserver
124
125
126 # --------------------------------------------------------------------------------
127 # INSTALL
128 # --------------------------------------------------------------------------------
129 install-prep:   
130         @echo $@
131         mkdir -p $(LIBDIR)
132         mkdir -p $(BINDIR)
133         mkdir -p $(PERLDIR)
134         mkdir -p $(INCLUDEDIR)
135         mkdir -p $(INCLUDEDIR)/$(OPENSRF)
136         mkdir -p $(ETCDIR)
137         mkdir -p $(TEMPLATEDIR)
138
139 objson-install: install-prep 
140         @echo $@
141         make -C objson install
142
143 libopensrf-install:     install-prep
144         @echo $@
145         cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)
146
147 gateway-install:        install-prep opensrf-install    
148         @echo $@
149         make -C gateway install
150
151 router-install: install-prep opensrf-install
152         @echo $@
153         make -C router install
154
155 srfsh-install:  install-prep opensrf-install 
156         @echo $@
157         make -C srfsh install
158
159 jserver-install:        install-prep 
160         @echo $@
161         make -C jserver install
162
163 perl-install:   install-prep
164         @echo $@
165         cp -r perlmods/* $(PERLDIR)/
166         cp ../examples/bootstrap.conf.example $(ETCDIR)
167         cp ../bin/opensrf_ctl $(BINDIR)
168         cp ../bin/opensrf_all $(BINDIR)
169         cp ../examples/opensrf.xml.example $(ETCDIR)
170         cp ../examples/opensrf_core.xml.example $(ETCDIR)
171         cp ../examples/srfsh.xml.example $(ETCDIR)
172
173
174 # --------------------------------------------------------------------------------
175 # CLEAN 
176 # --------------------------------------------------------------------------------
177 clean:
178         @echo $@
179         make -C libtransport clean
180         make -C libstack clean
181         make -C router clean
182         make -C gateway clean
183         make -C jserver clean
184         make -C utils clean
185         make -C objson clean
186         make -C srfsh clean
187         make -C c-apps clean
188         echo "Removing directory [$(TMPDIR)]"
189         /bin/rm -rf $(TMPDIR) *.o
190
191