Patch from Scott McKellar implementing cleaner daemonization; moved daemonizing code...
[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 ../examples/bootstrap.conf.example $(ETCDIR)
90         cp ../bin/osrf_ctl.sh $(BINDIR)
91         cp ../examples/opensrf.xml.example $(ETCDIR)
92         cp ../examples/opensrf_core.xml.example $(ETCDIR)
93         cp ../examples/srfsh.xml.example $(ETCDIR)
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
116 # --------------------------------------------------------------------------------
117 # CLEAN 
118 # --------------------------------------------------------------------------------
119 clean:
120         make -C libopensrf clean
121         make -C router clean
122         make -C gateway clean
123         make -C jserver clean
124         make -C objson clean
125         make -C srfsh clean
126         make -C c-apps clean
127         /bin/rm -rf $(TMPDIR) *.o
128
129