providing option to connect to memcache at general connect time
[OpenSRF.git] / src / Makefile
1 # TOP level 'src' makefile for OpenSRF
2
3 export TMPDIR   = $(TMP)/opensrf
4 export OPENSRF  = opensrf
5 export BINDIR   = $(PREFIX)/bin
6 export LIBDIR   = $(PREFIX)/lib
7 export PERLDIR  = $(LIBDIR)/perl5
8 export JSDIR    = $(LIBDIR)/javascript
9 export INCLUDEDIR= $(PREFIX)/include
10
11 export LDLIBS   += 
12 export LDFLAGS  += -Wl,-rpath=$(LIBDIR) -L $(TMPDIR) -L .
13 export CFLAGS   += -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I ../../include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) 
14
15 ifeq ($(OSRF_LEGACY_JSON), 1)
16 export LDLIBS += -lobjson
17 endif
18
19 all:    prep \
20         opensrf \
21         router \
22         srfsh \
23         jserver \
24         gateway \
25         java
26
27 install:        install-prep \
28                 opensrf-install \
29                 gateway-install \
30                 router-install \
31                 srfsh-install \
32                 jserver-install \
33                 javascript-install \
34                 perl-install \
35                 python-install \
36                 java-install
37
38
39 # --------------------------------------------------------------------------------
40 # BINARIES and LIBS
41 # --------------------------------------------------------------------------------
42
43 prep:
44         mkdir -p $(TMPDIR)
45
46 opensrf:        prep
47         make -C libopensrf
48         make -C c-apps
49
50 router: opensrf
51         @echo $@
52         make -C router 
53
54 srfsh: opensrf
55         @echo $@
56         make -C srfsh
57
58 gateway:        opensrf
59         @echo $@
60         make -C gateway
61
62 jserver:        opensrf
63         @echo $@
64         make -C jserver
65
66
67 java:   prep
68         if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make; fi;
69
70
71 # --------------------------------------------------------------------------------
72 # INSTALL
73 # --------------------------------------------------------------------------------
74
75 # make sure the install directories exist
76 install-prep:   
77         @echo $@
78         mkdir -p $(LIBDIR)
79         mkdir -p $(BINDIR)
80         mkdir -p $(JSDIR)
81         mkdir -p $(PERLDIR)
82         mkdir -p $(INCLUDEDIR)
83         mkdir -p $(ETCDIR)
84
85 # installs libopensrf.so, opensrf-c, headers, example configs, and osrf_ctl.sh
86 opensrf-install:        install-prep
87         @echo $@
88         cp $(TMPDIR)/libopensrf.so $(LIBDIR)/libopensrf.so
89         cp -r ../include/opensrf $(INCLUDEDIR)
90         cp libopensrf/opensrf $(BINDIR)/opensrf-c
91         make -C c-apps install
92         cp ../bin/osrf_ctl.sh $(BINDIR)
93         cp ../examples/opensrf.xml.example $(ETCDIR)
94         cp ../examples/opensrf_core.xml.example $(ETCDIR)
95         cp ../examples/srfsh.xml.example $(ETCDIR)
96         if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then\
97                 cp -r ../include/objson $(INCLUDEDIR);\
98                 cp $(TMPDIR)/libobjson.so $(LIBDIR);\
99         fi
100
101 gateway-install:        install-prep opensrf-install    
102         @echo $@
103         make -C gateway install
104
105 router-install: install-prep opensrf-install
106         @echo $@
107         make -C router install
108
109 srfsh-install:  install-prep opensrf-install 
110         @echo $@
111         make -C srfsh install
112
113 jserver-install:        install-prep 
114         @echo $@
115         make -C jserver install
116
117 javascript-install:     install-prep
118         @echo $@
119         cp -r javascript/* $(JSDIR)/
120
121 perl-install:   install-prep
122         @echo $@
123         cp -r perlmods/* $(PERLDIR)/
124
125 python-install:
126         make -C python install
127
128 java-install:
129         if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make install; fi;
130
131 # --------------------------------------------------------------------------------
132 # CLEAN 
133 # --------------------------------------------------------------------------------
134 clean:
135         make -C libopensrf clean
136         make -C router clean
137         make -C gateway clean
138         make -C jserver clean
139         make -C srfsh clean
140         make -C c-apps clean
141         make -C java clean
142         make -C python clean
143         /bin/rm -rf $(TMPDIR) *.o
144
145