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