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