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