# TOP level 'src' makefile for OpenSRF
-#
-#
-
-# Change to suit...
-#export PREFIX = /usr
-#export APXS2 = /pines/apps/apache2/bin/apxs
-#export TMP = /tmp/opensrf_build
-#export APACHE2_HEADERS = /pines/apps/apache2/include
export TMPDIR = $(TMP)/opensrf
export LIBDIR = $(PREFIX)/lib
export PERLDIR = $(LIBDIR)/perl5
export INCLUDEDIR = $(PREFIX)/include
-export CC = gcc
-export LD_OPTS = -L $(TMPDIR) -L .
-export CC_OPTS = -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
- -I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(TMPDIR)
-
-all: prep router srfsh jserver gateway
+export LDLIBS +=
+export LDFLAGS += -L $(TMPDIR) -L .
+export CFLAGS += -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
+ -I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(TMPDIR)
-install: install-prep transport-install stack-install gateway-install \
- router-install srfsh-install jserver-install perl-install \
- objson-install utils-install info
+LIBOPENSRF = libopensrf.so
+
+OPENSRF_TARGETS = libtransport/transport_session.o \
+ libtransport/transport_client.o \
+ libtransport/transport_message.o \
+ libstack/osrf_app_session.o \
+ libstack/osrf_stack.o \
+ libstack/osrfConfig.o \
+ libstack/osrf_settings.o \
+ libstack/osrf_message.o \
+ libstack/osrf_prefork.o \
+ libstack/osrf_system.o \
+ libstack/xml_utils.o \
+ utils/socket_bundle.o \
+ utils/string_array.o \
+ utils/utils.o \
+ utils/logging.o \
+ utils/md5.o \
+ utils/sha.o \
+
+OPENSRF_HEADERS = libtransport/transport_session.h \
+ libtransport/transport_client.h \
+ libtransport/transport_message.h \
+ libstack/osrf_app_session.h \
+ libstack/osrf_stack.h \
+ libstack/osrfConfig.h \
+ libstack/osrf_settings.h \
+ libstack/osrf_message.h \
+ libstack/osrf_prefork.h \
+ libstack/osrf_system.h \
+ libstack/xml_utils.h \
+ utils/socket_bundle.h \
+ utils/string_array.h \
+ utils/utils.h \
+ utils/logging.h \
+ utils/md5.h \
+ utils/sha.h \
+
+
+all: prep libopensrf.so router srfsh jserver gateway
+
+install: install-prep opensrf-install gateway-install router-install \
+ srfsh-install jserver-install perl-install objson-install
prep:
mkdir -p $(TMPDIR)
-# --------------------------------------------------------------------------------
-# LIBS
-# --------------------------------------------------------------------------------
-c_utils: prep
+libopensrf.so: objson/libobjson.so
+ @echo utils
make -C utils
-
-transport: c_utils
+ @echo transport
make -C libtransport
+ @echo stack
+ make -C libstack
+ @echo $@
+ $(CC) -shared -W1 $(LDFLAGS) -lobjson $(OPENSRF_TARGETS) -o $(TMPDIR)/$(LIBOPENSRF)
-objson: c_utils
- make -C objson
-stack: objson transport
- make -C libstack
+opensrf-install:
+ @echo $@
+ cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)/$(LIBOPENSRF)
+ cp $(OPENSRF_HEADERS) $(INCLUDEDIR)/opensrf/
+
+objson/libobjson.so:
+ @echo $@
+ make -C objson
# --------------------------------------------------------------------------------
# BINARIES
# --------------------------------------------------------------------------------
-router: stack
+router: libopensrf.so
+ @echo $@
make -C router
-srfsh: stack
+srfsh: libopensrf.so
+ @echo $@
make -C srfsh
-gateway: stack
+gateway: libopensrf.so
+ @echo $@
make -C gateway
-jserver: c_utils
+jserver: libopensrf.so
+ @echo $@
make -C jserver
# INSTALL
# --------------------------------------------------------------------------------
install-prep:
- @echo "Creating install directories"
+ @echo $@
mkdir -p $(LIBDIR)
mkdir -p $(BINDIR)
mkdir -p $(PERLDIR)
mkdir -p $(ETCDIR)
mkdir -p $(TEMPLATEDIR)
-transport-install: install-prep utils-install
- make -C libtransport install
-
-utils-install: install-prep
- make -C utils install
-
-objson-install: install-prep utils-install
+objson-install: install-prep
+ @echo $@
make -C objson install
-stack-install: install-prep transport-install objson-install
- make -C libstack install
+libopensrf-install: install-prep
+ @echo $@
+ cp $(TMPDIR)/$(LIBOPENSRF) $(LIBDIR)
-gateway-install: install-prep stack-install
+gateway-install: install-prep opensrf-install
+ @echo $@
make -C gateway install
-router-install: install-prep stack-install
+router-install: install-prep opensrf-install
+ @echo $@
make -C router install
-srfsh-install: install-prep stack-install
+srfsh-install: install-prep opensrf-install
+ @echo $@
make -C srfsh install
-jserver-install: install-prep utils-install
+jserver-install: install-prep
+ @echo $@
make -C jserver install
perl-install: install-prep
+ @echo $@
cp -r perlmods/* $(PERLDIR)/
cp ../examples/bootstrap.conf.example $(ETCDIR)
cp ../bin/opensrf_ctl $(BINDIR)
# --------------------------------------------------------------------------------
-# INFO
-# --------------------------------------------------------------------------------
-info:
- @echo
- @echo "OpenSRF is installed in $(PREFIX)"
- @echo ""
- @echo "It may be helpful to set some environment variables if the install "
- @echo "was set to a non-standard location. These include:"
- @echo ""
- @echo "export LD_LIBRARY_PATH=$(LIBDIR):\$$LD_LIBRARY_PATH"
- @echo "export PERL5LIB=$(PERLDIR):\$$PERL5LIB"
- @echo "export PATH=$(BINDIR):\$$PATH"
- @echo ""
-
-
-# --------------------------------------------------------------------------------
# CLEAN
# --------------------------------------------------------------------------------
clean:
+ @echo $@
make -C libtransport clean
make -C libstack clean
make -C router clean
make -C utils clean
make -C objson clean
make -C srfsh clean
+ echo "Removing directory [$(TMPDIR)]"
/bin/rm -rf $(TMPDIR)
-# -------------------------------------------------------------------------------
-#CC_OPTS = -Wall -O2 -I /opt/include -I /openils/include -I /usr/include/libxml2
-#LD_OPTS = -L /openils/lib
-#APXS2 = /opt/bin/apxs
-#TMPDIR = /tmp/blah
-#ETCDIR = /tmp/blah
-# -------------------------------------------------------------------------------
+CCFLAGS += -DASSUME_STATELESS
+LDLIBS += -lobjson -lxml2 -lopensrf
-CC_OPTS += -DASSUME_STATELESS
-LD_OPTS += -lc_utils -lobjson -lxml2 -lopensrf_transport -lopensrf_stack
-
-all: msg ils_gateway
-
-ils_gateway: libmod_ils_gateway.so
-
-msg:
- echo "-> $$(pwd)"
+all: libmod_ils_gateway.so
install:
- echo installing ils_gateway
$(APXS2) -i -a -n ils_gateway libmod_ils_gateway.so
libmod_ils_gateway.so: mod_ils_gateway.o
- echo $@
- $(CC) $(LD_OPTS) -shared -W1 mod_ils_gateway.o -o libmod_ils_gateway.so
-
+ $(CC) -shared -W1 mod_ils_gateway.o -o libmod_ils_gateway.so
-mod_ils_gateway.o: mod_ils_gateway.c
- echo $@
- $(CC) -c $(CC_OPTS) mod_ils_gateway.c
+mod_ils_gateway.o: mod_ils_gateway.h mod_ils_gateway.c
clean:
/bin/rm -f *.o *.so
-LD_OPTS += -lc_utils -lxml2
-OBJECTS = jserver-c.o jserver-c_main.o jserver-c_session.o
+LDLIBS += -lopensrf -lobjson -lxml2
+OBJECTS = jserver-c.o jserver-c_main.o jserver-c_session.o
-
-all: msg jserver-c
-
-msg:
- echo "-> $$(pwd)"
+all: jserver-c
jserver-c: $(OBJECTS)
- echo $@
- $(CC) $(LD_OPTS) $(OBJECTS) -o $@
+# $(CC) $(LD_OPTS) $(OBJECTS) -o $@
jserver-c_main.o: jserver-c_main.c
- echo $@
- $(CC) -c $(CC_OPTS) jserver-c_main.c -o $@
-
jserver-c.o: jserver-c.c jserver-c.h
- echo $@
- $(CC) -c $(CC_OPTS) jserver-c.c -o $@
-
jserver-c_session.o: jserver-c_session.c jserver-c_session.h
- echo $@
- $(CC) -c $(CC_OPTS) jserver-c_session.c -o $@
install:
- echo installing jserver
cp jserver-c $(BINDIR)
-
clean:
/bin/rm -f *.o jserver-c
-CC_OPTS += -DASSUME_STATELESS
-LD_OPTS += -lxml2 -lopensrf_transport -lopensrf_stack -lobjson -lc_utils
+
+CFLAGS += -DASSUME_STATELESS
+LDLIBS += -lxml2 -lobjson
TARGETS = osrf_message.o osrf_app_session.o osrf_stack.o osrf_system.o osrf_settings.o osrf_prefork.o osrfConfig.o xml_utils.o
HEADERS = osrf_message.h osrf_app_session.h osrf_stack.h osrf_system.h osrf_settings.h osrf_prefork.h osrfConfig.h xml_utils.h
-all: msg xml_utils.o libopensrf_stack.so
-
-msg:
- echo "-> $$(pwd)"
-
-test: test.o
- echo $@
- $(CC) $(LD_OPTS) test.o xml_utils.o -o $@
-
-test.o: test.c xml_utils.o
- echo $@
- $(CC) -c $(CC_OPTS) test.c -o $@
+all: xml_utils.o $(TARGETS) copy
xml_utils.o:
- echo $@
cp ../utils/xml_utils.h .
cp ../utils/xml_utils.c .
- $(CC) -c $(CC_OPTS) xml_utils.c -o $@
+ $(CC) -c $(CFLAGS) xml_utils.c -o $@
-# -------------------------------------------------------------
-
-
-libopensrf_stack.so: $(TARGETS)
- echo $@
- $(CC) -shared -W1 $(TARGETS) -o libopensrf_stack.so
- $(CC) -shared -W1 $(TARGETS) -o $(TMPDIR)/libopensrf_stack.so
+copy:
cp $(HEADERS) $(TMPDIR)/
osrf_message.o: osrf_message.c osrf_message.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_message.c -o $@
-
osrf_app_session.o: osrf_app_session.c osrf_app_session.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_app_session.c -o $@
-
osrf_stack.o: osrf_stack.c osrf_stack.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_stack.c -o $@
-
osrf_system.o: osrf_system.c osrf_system.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_system.c -o $@
-
osrf_settings.o: osrf_settings.c osrf_settings.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_settings.c -o $@
-
osrf_prefork.o: osrf_prefork.c osrf_prefork.h
- echo $@; $(CC) -c $(CC_OPTS) osrf_prefork.c -o $@
-
-
osrfConfig.o: osrfConfig.c osrfConfig.h xml_utils.o
- echo $@; $(CC) -c $(CC_OPTS) osrfConfig.c -o $@
-
-install:
- echo installing libopensrf_stack.so
- cp $(HEADERS) $(INCLUDEDIR)/$(OPENSRF)
- cp $(TMPDIR)/libopensrf_stack.so $(LIBDIR)/
clean:
/bin/rm -f *.o libopensrf_stack.so test xml_utils.h xml_utils.c
-# set this shell variable prior to calling make to run with malloc_check enabled
-#MALLOC_CHECK_=1 # XXX debug only
-LD_OPTS += -lxml2 -lc_utils
-
-SOURCES = transport_session.c transport_message.c transport_client.c
TARGETS = transport_message.o transport_session.o transport_client.o
HEADERS = transport_message.h transport_session.h transport_client.h
TARGET = libopensrf_transport.so
-all: msg libopensrf_transport.so
-
-msg:
- echo "-> $$(pwd)"
+all: $(TARGETS) copy
-libopensrf_transport.so: $(TARGETS)
- echo $@
- $(CC) -shared -W1 $(LD_OPTS) $(TARGETS) -o libopensrf_transport.so
- $(CC) -shared -W1 $(LD_OPTS) $(TARGETS) -o $(TMPDIR)/libopensrf_transport.so
+copy:
cp $(HEADERS) $(TMPDIR)
transport_session.o: transport_session.c transport_session.h
- echo $@
- $(CC) -c $(CC_OPTS) transport_session.c -o $@
-
transport_message.o: transport_message.c transport_message.h
- echo $@
- $(CC) -c $(CC_OPTS) transport_message.c -o $@
-
transport_client.o: transport_client.c transport_client.h
- echo $@
- $(CC) -c $(CC_OPTS) transport_client.c -o $@
-install:
- echo installing $(TARGET)
- cp $(TMPDIR)/libopensrf_transport.so $(LIBDIR)/
- cp $(HEADERS) $(INCLUDEDIR)/$(OPENSRF)
clean:
- echo $@
- /bin/rm -f *.o libopensrf_transport.so
+ /bin/rm -f *.o
#
# --------------------------------------------------------------------
-OBJS = object.o json_parser.o utils.o
-UTIL_DIR = ../utils
-DEST_INCLUDE = objson
-CC_OPTS += -DSTRICT_JSON_WRITE #-DSTRICT_JSON_READ
+OBJS = utils.o object.o json_parser.o
+UTIL_DIR = ../utils
+DEST_INCLUDE = objson
+CFLAGS += -DSTRICT_JSON_WRITE #-DSTRICT_JSON_READ
-# -------------
-#CC_OPTS += -I ../utils/
-#LD_OPTS += -L .
-#TMPDIR = .
-# -------------
+JSON_HEADERS = object.h json_parser.h
-all: msg test
+all: test
-msg:
- echo "-> $$(pwd)"
+test: libobjson.so objson_test.o
-test: libobjson.so
- echo $@
- $(CC) $(CC_OPTS) $(LD_OPTS) -lobjson objson_test.c -o $@
+objson_test.o: objson_test.c
+object.o: object.h object.c
+json_parser.o: json_parser.h json_parser.c
install:
- echo installing libobjson.so
mkdir -p $(INCLUDEDIR)/$(DEST_INCLUDE)
cp $(TMPDIR)/$(DEST_INCLUDE)/*.h $(INCLUDEDIR)/objson/
cp $(TMPDIR)/libobjson.so $(LIBDIR)/libobjson.so
libobjson.so: $(OBJS)
- echo $@
$(CC) -shared -W1 $(OBJS) -o $(TMPDIR)/libobjson.so
$(CC) -shared -W1 $(OBJS) -o libobjson.so
mkdir -p $(TMPDIR)/$(DEST_INCLUDE)/
- cp *.h $(TMPDIR)/$(DEST_INCLUDE)/
-
-object.o: object.h object.c
- echo $@
- $(CC) -c $(CC_OPTS) object.c -o $@
-
-json_parser.o: json_parser.h json_parser.c
- echo $@
- $(CC) -c $(CC_OPTS) json_parser.c -o $@
+ cp $(JSON_HEADERS) $(TMPDIR)/$(DEST_INCLUDE)/
utils.o: $(UTIL_DIR)/utils.h $(UTIL_DIR)/utils.c
- echo $@
- $(CC) -c $(CC_OPTS) $(UTIL_DIR)/utils.c -o $@
+ cp $(UTIL_DIR)/utils.h .
+ cp $(UTIL_DIR)/utils.c .
+ $(CC) -c $(CFLAGS) utils.c -o $@
clean:
- /bin/rm -f *.o *.so test libobjson.so
+ /bin/rm -f *.o *.so utils.c utils.h libobjson.so
+
#include <stdio.h>
#include "object.h"
-#include "opensrf/utils.h"
+#include "utils.h"
#include <stdlib.h>
#include <string.h>
-#include "opensrf/utils.h"
+#include "utils.h"
/* json object types */
#define JSON_HASH 0
-# set this shell variable prior to calling make to run with malloc_check enabled
#MALLOC_CHECK_=1 # XXX debug only
-LD_OPTS += -lc_utils -lxml2 -lopensrf_stack -lobjson
-LP = ../libtransport
-LIB_SOURCES = $(LP)/transport_session.c $(LP)/transport_message.c $(LP)/transport_client.c
+LDLIBS += -lxml2 -lopensrf -lobjson
+CFLAGS += -D_ROUTER
-all: msg router
-
-msg:
- echo "-> $$(pwd)"
+all: router
install:
- echo installing router
cp router $(BINDIR)
-router: router.c $(LIB_SOURCES)
- echo $@
- $(CC) $(LD_OPTS) -D_ROUTER $(CC_OPTS) $(LIB_SOURCES) router.c -o $@
+router: router.o
+router.o: router.c router.h
clean:
/bin/rm -f *.o router
# if EXEC_DEFAULT is defined, then srfsh will send all unknown commands to the shell for execution
-LD_OPTS += -lobjson -lreadline -lxml2 -lopensrf_transport -lopensrf_stack -lncurses -lc_utils -DEXEC_DEFAULT
+LDLIBS += -lobjson -lreadline -lxml2 -lopensrf -lncurses
+LDFLAGS += -DEXEC_DEFAULT
-all: msg srfsh
+all: srfsh
-msg:
- echo "-> $$(pwd)"
+srfsh: srfsh.o
+srfsh.o: srfsh.c srfsh.h
install:
- echo installing srfsh
cp srfsh $(BINDIR)
-srfsh: srfsh.c srfsh.h
- echo $@
- $(CC) $(CC_OPTS) $(LD_OPTS) srfsh.c -o $@
-
clean:
/bin/rm -f *.o srfsh
-# ------------------------------------------------------------------------
-#CC_OPTS = -O2 -Wall
-#TMPDIR = ./tmp
-# ------------------------------------------------------------------------
+UTIL_HEADERS = logging.h utils.h socket_bundle.h md5.h sha.h string_array.h xml_utils.h
+UTIL_OBJECTS = logging.o utils.o socket_bundle.o md5.o sha.o string_array.o
-UTIL_SOURCES = logging.c utils.c socket_bundle.c md5.c sha.c string_array.c
-UTIL_HEADERS = logging.h utils.h socket_bundle.h md5.h sha.h string_array.h
-UTIL_OBJECTS = logging.o utils.o socket_bundle.o md5.o sha.o string_array.o
+all: $(UTIL_OBJECTS) copy
-all: msg libc_utils.so
-
-msg:
- echo "-> $$(pwd)"
-
-
-install:
- echo installing libc_utils.so
- cp $(UTIL_HEADERS) $(INCLUDEDIR)/$(OPENSRF)/
- cp xml_utils.h $(INCLUDEDIR)/$(OPENSRF)/
- cp $(TMPDIR)/libc_utils.so $(LIBDIR)/
-
-libc_utils.so: $(UTIL_OBJECTS)
- @echo $@
- $(CC) -shared -W1 $(UTIL_OBJECTS) -o libc_utils.so
- $(CC) -shared -W1 $(UTIL_OBJECTS) -o $(TMPDIR)/libc_utils.so
- cp $(UTIL_HEADERS) $(TMPDIR)/
+copy:
+ cp $(UTIL_HEADERS) $(TMPDIR)
logging.o: logging.c logging.h
- @echo $@
- $(CC) -c $(CC_OPTS) logging.c -o $@
-
utils.o: utils.c utils.h
- @echo $@
- $(CC) -c $(CC_OPTS) utils.c -o $@
-
socket_bundle.o: socket_bundle.c socket_bundle.h
- @echo $@
- $(CC) -c $(CC_OPTS) socket_bundle.c -o $@
-
md5.o: md5.c md5.h
- @echo $@
- $(CC) -c $(CC_OPTS) md5.c -o $@
-
sha.o: sha.c sha.h
- @echo $@
- $(CC) -c $(CC_OPTS) sha.c -o $@
-
string_array.o: string_array.c string_array.h
- @echo $@
- $(CC) -c $(CC_OPTS) string_array.c -o $@
-clean:
- /bin/rm -f *.o socket_test libc_utils.so test
-
-
-
-#fieldmapper: fieldmapper-c.pl
-#perl fieldmapper-c.pl $(FM_HEADER) $(FM_SOURCE)
-#$(CC) -c $(CC_OPTS) fieldmapper.c -o fieldmapper.o
-#$(CC) -shared -W1 fieldmapper.o -o $(LIBDIR)/libopensrf_fm.so
-#cp $(FM_HEADER) $(HEADER_DIR)/
+clean:
+ /bin/rm -f *.o