14823ab380d91450c5da4559f512479f067cb104
[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                  += -Wl,-rpath=$(LIBDIR) -L $(TMPDIR) -L .
13 export CFLAGS                   += -pipe -g -Wall -O2 -fPIC -I ../../include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
14                                                                 -I$(LIBXML2_HEADERS)/libxml -I$(APR_HEADERS) 
15
16 all:    prep \
17         opensrf \
18         router \
19         srfsh \
20         jserver \
21         gateway
22
23 install:        install-prep \
24                 opensrf-install \
25                 gateway-install \
26                 router-install \
27                 srfsh-install \
28                 jserver-install \
29                 perl-install \
30                 objson-install
31
32
33 # --------------------------------------------------------------------------------
34 # BINARIES and LIBS
35 # --------------------------------------------------------------------------------
36
37 prep:
38         mkdir -p $(TMPDIR)
39
40 objson/libobjson.so:    prep
41         @echo $@
42         make -C objson
43
44 opensrf:        objson/libobjson.so
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 $(INCLUDEDIR)
76         mkdir -p $(ETCDIR)
77
78 objson-install: install-prep 
79         @echo $@
80         make -C objson install
81
82 # installs libopensrf.so, opensrf-c, headers, example configs, and osrf_ctl.sh
83 opensrf-install:        objson-install
84         @echo $@
85         cp $(TMPDIR)/libopensrf.so $(LIBDIR)/libopensrf.so
86         cp -r ../include/opensrf $(INCLUDEDIR)
87         cp libopensrf/opensrf $(BINDIR)/opensrf-c
88         make -C c-apps install
89         cp ../bin/osrf_ctl.sh $(BINDIR)
90         cp ../examples/opensrf.xml.example $(ETCDIR)
91         cp ../examples/opensrf_core.xml.example $(ETCDIR)
92         cp ../examples/srfsh.xml.example $(ETCDIR)
93
94 gateway-install:        install-prep opensrf-install    
95         @echo $@
96         make -C gateway install
97
98 router-install: install-prep opensrf-install
99         @echo $@
100         make -C router install
101
102 srfsh-install:  install-prep opensrf-install 
103         @echo $@
104         make -C srfsh install
105
106 jserver-install:        install-prep 
107         @echo $@
108         make -C jserver install
109
110 perl-install:   install-prep
111         @echo $@
112         cp -r perlmods/* $(PERLDIR)/
113
114
115 # --------------------------------------------------------------------------------
116 # CLEAN 
117 # --------------------------------------------------------------------------------
118 clean:
119         make -C libopensrf clean
120         make -C router clean
121         make -C gateway clean
122         make -C jserver clean
123         make -C objson clean
124         make -C srfsh clean
125         make -C c-apps clean
126         /bin/rm -rf $(TMPDIR) *.o
127
128