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