Make cleaning in Python dir optional as well, to avoid problems with missing setuptools
[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         python-build
27
28 install:        install-prep \
29                 opensrf-install \
30                 gateway-install \
31                 router-install \
32                 srfsh-install \
33                 jserver-install \
34                 javascript-install \
35                 perl-install \
36                 python-install \
37                 java-install
38
39
40 # --------------------------------------------------------------------------------
41 # BINARIES and LIBS
42 # --------------------------------------------------------------------------------
43
44 prep:
45         mkdir -p $(TMPDIR)
46
47 opensrf:        prep
48         make -C libopensrf
49         make -C c-apps
50
51 router: opensrf
52         @echo $@
53         make -C router 
54
55 srfsh: opensrf
56         @echo $@
57         make -C srfsh
58
59 gateway:        opensrf
60         @echo $@
61         make -C gateway
62
63 jserver:        opensrf
64         @echo $@
65         make -C jserver
66
67
68 java:   prep
69         if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make; fi;
70
71 python-build:
72         if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python build; fi;
73
74 # --------------------------------------------------------------------------------
75 # INSTALL
76 # --------------------------------------------------------------------------------
77
78 # make sure the install directories exist
79 install-prep:   
80         @echo $@
81         mkdir -p $(LIBDIR)
82         mkdir -p $(BINDIR)
83         mkdir -p $(JSDIR)
84         mkdir -p $(PERLDIR)
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 python-install:
129         if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python install; fi;
130
131 java-install:
132         if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make install; fi;
133
134 # --------------------------------------------------------------------------------
135 # CLEAN 
136 # --------------------------------------------------------------------------------
137 clean:
138         make -C libopensrf clean
139         make -C router clean
140         make -C gateway clean
141         make -C jserver clean
142         make -C srfsh clean
143         make -C c-apps clean
144         make -C java clean
145         if [ -n "$(OSRF_INSTALL_PYTHON)" ]; then echo $@; make -C python clean; fi;
146         /bin/rm -rf $(TMPDIR) *.o
147
148