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