5458e259aa21700ec6ba85b6cb683d8fa27a4901
[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                  += -L $(TMPDIR) -L .
13 export CFLAGS                   += -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
14                                                                 -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) -I$(TMPDIR)
15
16 LIBOPENSRF                              = libopensrf.so
17
18 OPENSRF_TARGETS = libtransport/transport_session.o \
19                                                 libtransport/transport_client.o \
20                                                 libtransport/transport_message.o \
21                                                 libstack/osrf_app_session.o \
22                                                 libstack/osrf_stack.o \
23                                                 libstack/osrfConfig.o \
24                                                 libstack/osrf_settings.o \
25                                                 libstack/osrf_message.o \
26                                                 libstack/osrf_prefork.o \
27                                                 libstack/osrf_system.o \
28                                                 libstack/xml_utils.o \
29                                                 utils/socket_bundle.o \
30                                                 utils/string_array.o \
31                                                 utils/utils.o \
32                                                 utils/logging.o \
33                                                 utils/md5.o \
34                                                 utils/sha.o \
35
36 OPENSRF_HEADERS = libtransport/transport_session.h \
37                                                 libtransport/transport_client.h \
38                                                 libtransport/transport_message.h \
39                                                 libstack/osrf_app_session.h \
40                                                 libstack/osrf_stack.h \
41                                                 libstack/osrfConfig.h \
42                                                 libstack/osrf_settings.h \
43                                                 libstack/osrf_message.h \
44                                                 libstack/osrf_prefork.h \
45                                                 libstack/osrf_system.h \
46                                                 libstack/xml_utils.h \
47                                                 utils/socket_bundle.h \
48                                                 utils/string_array.h \
49                                                 utils/utils.h \
50                                                 utils/logging.h \
51                                                 utils/md5.h \
52                                                 utils/sha.h \
53
54
55 all: prep libopensrf.so router srfsh jserver gateway
56
57 install: install-prep opensrf-install gateway-install   router-install \
58                 srfsh-install jserver-install perl-install objson-install
59
60 prep:
61         mkdir -p $(TMPDIR)
62
63 libopensrf.so:  objson/libobjson.so
64         @echo utils
65         make -C utils
66         @echo transport
67         make -C libtransport
68         @echo stack
69         make -C libstack
70         @echo $@
71         $(CC) -shared -W1 $(LDFLAGS) -lobjson $(OPENSRF_TARGETS) -o $(TMPDIR)/$(LIBOPENSRF)
72
73
74 opensrf-install:
75         @echo $@
76         cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)/$(LIBOPENSRF)
77         cp $(OPENSRF_HEADERS) $(INCLUDEDIR)/opensrf/
78
79
80 objson/libobjson.so: 
81         @echo $@
82         make -C objson
83
84 # --------------------------------------------------------------------------------
85 # BINARIES
86 # --------------------------------------------------------------------------------
87 router: libopensrf.so
88         @echo $@
89         make -C router 
90
91 srfsh: libopensrf.so
92         @echo $@
93         make -C srfsh
94
95 gateway:        libopensrf.so
96         @echo $@
97         make -C gateway
98
99 jserver:        libopensrf.so
100         @echo $@
101         make -C jserver
102
103
104 # --------------------------------------------------------------------------------
105 # INSTALL
106 # --------------------------------------------------------------------------------
107 install-prep:   
108         @echo $@
109         mkdir -p $(LIBDIR)
110         mkdir -p $(BINDIR)
111         mkdir -p $(PERLDIR)
112         mkdir -p $(INCLUDEDIR)
113         mkdir -p $(INCLUDEDIR)/$(OPENSRF)
114         mkdir -p $(ETCDIR)
115         mkdir -p $(TEMPLATEDIR)
116
117 objson-install: install-prep 
118         @echo $@
119         make -C objson install
120
121 libopensrf-install:     install-prep
122         @echo $@
123         cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)
124
125 gateway-install:        install-prep opensrf-install    
126         @echo $@
127         make -C gateway install
128
129 router-install: install-prep opensrf-install
130         @echo $@
131         make -C router install
132
133 srfsh-install:  install-prep opensrf-install 
134         @echo $@
135         make -C srfsh install
136
137 jserver-install:        install-prep 
138         @echo $@
139         make -C jserver install
140
141 perl-install:   install-prep
142         @echo $@
143         cp -r perlmods/* $(PERLDIR)/
144         cp ../examples/bootstrap.conf.example $(ETCDIR)
145         cp ../bin/opensrf_ctl $(BINDIR)
146         cp ../bin/opensrf_all $(BINDIR)
147         cp ../examples/opensrf.xml.example $(ETCDIR)
148         cp ../examples/opensrf_core.xml.example $(ETCDIR)
149         cp ../examples/srfsh.xml.example $(ETCDIR)
150
151
152 # --------------------------------------------------------------------------------
153 # CLEAN 
154 # --------------------------------------------------------------------------------
155 clean:
156         @echo $@
157         make -C libtransport clean
158         make -C libstack clean
159         make -C router clean
160         make -C gateway clean
161         make -C jserver clean
162         make -C utils clean
163         make -C objson clean
164         make -C srfsh clean
165         echo "Removing directory [$(TMPDIR)]"
166         /bin/rm -rf $(TMPDIR)
167
168