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