From fb034d83739f37b8e182ba6f10012a87f2624181 Mon Sep 17 00:00:00 2001 From: erickson Date: Sun, 19 Jun 2005 16:15:10 +0000 Subject: [PATCH] slimmed down makefiles which get most of their vars from the higher up src makefile git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@348 9efc2488-bf62-4759-914b-345cdb29e865 --- src/gateway/Makefile | 26 ++++++------------ src/libjson/Makefile | 27 ++++++++++--------- src/libstack/Makefile | 38 ++++++++++---------------- src/libtransport/Makefile | 38 +++++++++++++------------- src/objson/Makefile | 32 +++++++++++----------- src/router/Makefile | 17 ++++++------ src/srfsh/Makefile | 20 +++++--------- src/utils/Makefile | 68 +++++++++++++++++++++++++++++++++-------------- 8 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/gateway/Makefile b/src/gateway/Makefile index 775aa2e..b688938 100644 --- a/src/gateway/Makefile +++ b/src/gateway/Makefile @@ -1,25 +1,15 @@ -CC = gcc -LIB_DIR = ../../lib +CC_OPTS += -I /pines/apps/apache2/include -DASSUME_STATELESS +LD_OPTS += -lc_utils -lobjson -lxml2 -lopensrf_transport -lopensrf_stack -ljson -CC_OPTS = -fPIC -Wall -O2 -I /usr/include/libxml2 \ - -I /usr/include/libxml2/libxml -I ../../include \ - -I /pines/apps/apache2/include +all: libmod_ils_gateway.so -EXE_LD_OPTS = -L $(LIB_DIR) -lxml2 -lopensrf_transport -lopensrf_stack -ljson -lmd5 +install: + cp $(TMPDIR)/libmod_ils_gateway.so $(LIBDIR)/libmod_ils_gateway.so + $(APXS) -i -a -n ils_gateway $(LIBDIR)/libmod_ils_gateway.so -all: gateway - -install: gateway - @echo "As Root, Run: /pines/apps/apache2/bin/apxs -i -a -n ils_gateway libmod_ils_gateway.so"; - -gateway: lib mod_ils_gateway.c +libmod_ils_gateway.so: mod_ils_gateway.c $(CC) -c $(CC_OPTS) mod_ils_gateway.c - $(CC) $(EXE_LD_OPTS) -shared -W1 mod_ils_gateway.o -o libmod_ils_gateway.so - -lib: - make -C ../libstack - make -C ../libtransport - make -C ../utils + $(CC) $(LD_OPTS) -shared -W1 mod_ils_gateway.o -o $(TMPDIR)/libmod_ils_gateway.so clean: /bin/rm -f *.o *.so diff --git a/src/libjson/Makefile b/src/libjson/Makefile index 54fde13..3b53cae 100644 --- a/src/libjson/Makefile +++ b/src/libjson/Makefile @@ -1,9 +1,8 @@ # $Id$ CFLAGS += -g -O2 -Wall -std=gnu99 -D_GNU_SOURCE -D_REENTRANT -I ../../include -fPIC -LDFLAGS += -shared -W1 -LIB_DIR = ../../lib -LDLIBS += -L . -ljson -L $(LIB_DIR) + +DEST_INCLUDE = libjson LIB_OBJS = debug.o \ linkhash.o \ @@ -14,25 +13,29 @@ LIB_OBJS = debug.o \ TESTS = test1 test2 -all: tests lib oils_method +all: tests lib: $(LIB_OBJS) - gcc $(LDFLAGS) $(LIB_OBJS) -o $(LIB_DIR)/libjson.so + gcc -shared -W1 $(LIB_OBJS) -o $(TMPDIR)/libjson.so + mkdir -p $(TMPDIR)/$(DEST_INCLUDE)/ + cp *.h $(TMPDIR)/$(DEST_INCLUDE)/ + +install: + mkdir -p $(INCLUDE)/$(DEST_INCLUDE)/ + cp $(TMPDIR)/$(DEST_INCLUDE)/*.h $(INCLUDE)/$(DEST_INCLUDE)/ + cp $(TMPDIR)/libjson.so $(LIBDIR)/libjson.so + tests: $(TESTS) test1: test1.o lib - gcc $(LDLIBS) test1.o -o test1 + gcc -ljson $(LD_OPTS) $(LDLIBS) test1.o -o test1 test2: test2.o lib - gcc $(LDLIBS) test2.o -o test2 -oils_method: oils_method.o lib - gcc $(LDLIBS) oils_method.o -o oils_method + gcc -ljson $(LD_OPTS) $(LDLIBS) test2.o -o test2 -oils_method.o: oils_method.c - gcc -c $(CFLAGS) oils_method.c -o oils_method.o clean: - rm -f *.o *~ $(TESTS) $(LIB_DIR)/libjson.so oils_method + rm -f *.o *~ $(TESTS) cex.o: cex.c debug.o: debug.c diff --git a/src/libstack/Makefile b/src/libstack/Makefile index c3dd937..ec9fcd6 100644 --- a/src/libstack/Makefile +++ b/src/libstack/Makefile @@ -1,30 +1,20 @@ -LIB_DIR = ../../lib -CC_OPTS = -Wall -O2 -I /usr/include/libxml2 -I /usr/include/libxml2/libxml -I ../../include -fPIC -DASSUME_STATELESS -LIB_SOURCES = osrf_message.c osrf_app_session.c osrf_stack.c osrf_system.c string_array.c -LIB_TARGETS = osrf_message.o osrf_app_session.o osrf_stack.o osrf_system.o string_array.o -EXE_LD_OPTS = -L $(LIB_DIR) -lxml2 -lopensrf_transport -lopensrf_stack -lobjson -ljson -CC = gcc +CC_OPTS += -DASSUME_STATELESS +EXE_LD_OPTS += -lxml2 -lopensrf_transport -lopensrf_stack -lobjson -ljson -lc_utils -all: lib -#client sys_client - -sys_client: sys_client.c lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o sys_client.c -o sys_client +SOURCES = osrf_message.c osrf_app_session.c osrf_stack.c osrf_system.c +TARGETS = osrf_message.o osrf_app_session.o osrf_stack.o osrf_system.o +HEADERS = osrf_message.h osrf_app_session.h osrf_stack.h osrf_system.h -#client: client.c lib -# $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o client.c -o client - -# ---------------------------------------------------------------- - -lib: libjson libopensrf_transport - $(CC) -c $(CC_OPTS) $(LIB_SOURCES) - $(CC) -shared -W1 $(LIB_TARGETS) -o $(LIB_DIR)/libopensrf_stack.so +all: lib -libjson: - make -C ../libjson +lib: $(SOURCES) $(HEADERS) + $(CC) -c $(CC_OPTS) $(SOURCES) + $(CC) -shared -W1 $(TARGETS) -o $(TMPDIR)/libopensrf_stack.so + cp $(HEADERS) $(TMPDIR)/ -libopensrf_transport: - make -C ../libtransport +install: + cp $(HEADERS) $(INCLUDEDIR)/$(OPENSRF) + cp $(TMPDIR)/libopensrf_stack.so $(LIBDIR)/ clean: - /bin/rm -f *.o sys_client client $(LIB_DIR)/libopensrf_stack.so + /bin/rm -f *.o diff --git a/src/libtransport/Makefile b/src/libtransport/Makefile index b2623b1..a2fb8df 100644 --- a/src/libtransport/Makefile +++ b/src/libtransport/Makefile @@ -1,30 +1,28 @@ # set this shell variable prior to calling make to run with malloc_check enabled #MALLOC_CHECK_=1 # XXX debug only -CC = gcc -LIB_DIR=../../lib -UTIL_DIR = ../utils -CC_OPTS = -fPIC -Wall -O2 -I /usr/include/libxml2 -I /usr/include/libxml2/libxml -I ../../include #-I /home/erickson/cc/libxml2-2.6.16 -EXE_LD_OPTS = -L $(LIB_DIR) -lxml2 -lopensrf_transport -LIB_SOURCES = $(UTIL_DIR)/utils.c generic_utils.c transport_socket.c transport_session.c transport_message.c transport_client.c $(UTIL_DIR)/sha.c +LD_OPTS += -lxml2 -lopensrf_transport -lc_utils -TARGETS=utils.o generic_utils.o transport_socket.o transport_message.o transport_session.o transport_client.o sha.o +SOURCES = generic_utils.c transport_socket.c transport_session.c transport_message.c transport_client.c +TARGETS = generic_utils.o transport_socket.o transport_message.o transport_session.o transport_client.o +HEADERS = generic_utils.h transport_socket.h transport_message.h transport_session.h transport_client.h -all: basic_client component - -component: lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) component.c -o $@ - -basic_client: lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) basic_client.c -o $@ +all: lib + +lib: $(SOURCES) $(HEADERS) + $(CC) -c $(CC_OPTS) $(SOURCES) + $(CC) -shared -W1 $(LD_OPTS) $(TARGETS) -o $(TMPDIR)/libopensrf_transport.so + cp $(HEADERS) $(TMPDIR) -# --- Libs ----------------------------------------------- - -lib: - $(CC) -c $(CC_OPTS) $(LIB_SOURCES) - $(CC) -shared -W1 $(LD_OPTS) $(TARGETS) -o $(LIB_DIR)/libopensrf_transport.so +install: + @echo "Installing libopensrf_transport..." + cp $(TMPDIR)/libopensrf_transport.so $(LIBDIR)/ + cp $(HEADERS) $(INCLUDEDIR)/$(OPENSRF) +# for h in $(TMPDIR)/$(HEADERS); do +# mv $$h $(INCLUDEDIR)/$(OPENSRF); +# done clean: - /bin/rm -f *.o $(LIB_DIR)/libopensrf_transport.so basic_client component + /bin/rm -f *.o basic_client component diff --git a/src/objson/Makefile b/src/objson/Makefile index 3ab17a7..2c65709 100644 --- a/src/objson/Makefile +++ b/src/objson/Makefile @@ -1,30 +1,30 @@ -CC = gcc -HEADER_DIR = ../../include -CFLAGS = -g -O2 -Wall -fPIC -I $(HEADER_DIR) #-D_REENTRANT -LDFLAGS = -shared -W1 -LIB_DIR = ../../lib -LDLIBS = -L . -lobjson -L $(LIB_DIR) OBJS = object.o json_parser.o utils.o UTIL_DIR = ../utils +DEST_INCLUDE = objson all: test - -test: lib objson_test.c - $(CC) $(CFLAGS) $(LDLIBS) objson_test.c -o $@ + +test: lib + $(CC) $(CC_OPTS) $(LD_OPTS) -lobjson objson_test.c -o $@ + +install: + mkdir -p $(INCLUDEDIR)/$(DEST_INCLUDE) + cp $(TMPDIR)/$(DEST_INCLUDE)/*.h $(INCLUDEDIR)/objson/ + cp $(TMPDIR)/libobjson.so $(LIBDIR)/libobjson.so lib: $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(LIB_DIR)/libobjson.so - if [ ! -d $(HEADER_DIR)/objson/ ];then mkdir $(HEADER_DIR)/objson; fi; - cp *.h $(HEADER_DIR)/objson/ + $(CC) -shared -W1 $(OBJS) -o $(TMPDIR)/libobjson.so + mkdir -p $(TMPDIR)/$(DEST_INCLUDE)/ + cp *.h $(TMPDIR)/$(DEST_INCLUDE)/ object.o: object.h object.c - $(CC) -c $(CFLAGS) object.c -o $@ + $(CC) -c $(CC_OPTS) object.c -o $@ json_parser.o: json_parser.h json_parser.c - $(CC) -c $(CFLAGS) json_parser.c -o $@ + $(CC) -c $(CC_OPTS) json_parser.c -o $@ -utils.o: $(HEADER_DIR)/utils.h $(UTIL_DIR)/utils.c - $(CC) -c $(CFLAGS) $(UTIL_DIR)/utils.c -o $@ +utils.o: $(UTIL_DIR)/utils.h $(UTIL_DIR)/utils.c + $(CC) -c $(CC_OPTS) $(UTIL_DIR)/utils.c -o $@ clean: /bin/rm -f *.o test diff --git a/src/router/Makefile b/src/router/Makefile index 9246800..e67c1e7 100644 --- a/src/router/Makefile +++ b/src/router/Makefile @@ -1,19 +1,18 @@ # set this shell variable prior to calling make to run with malloc_check enabled #MALLOC_CHECK_=1 # XXX debug only -CC = gcc -CC_OPTS = -Wall -O2 -I /usr/include/libxml2 -I /usr/include/libxml2/libxml -I ../../include -LD_OPTS = -L ../../lib -lxml2 -lopensrf_stack -ljson -lobjson -LP=../libtransport -UTIL_DIR = ../utils -LIB_SOURCES = $(UTIL_DIR)/utils.c $(LP)/generic_utils.c $(LP)/transport_socket.c $(LP)/transport_session.c $(LP)/transport_message.c $(LP)/transport_client.c $(UTIL_DIR)/sha.c +LD_OPTS += -lc_utils -lxml2 -lopensrf_stack -ljson -lobjson +LP = ../libtransport +LIB_SOURCES = $(LP)/generic_utils.c $(LP)/transport_socket.c \ + $(LP)/transport_session.c $(LP)/transport_message.c $(LP)/transport_client.c all: router -install: router - cp router ../../bin + +install: + cp router $(BINDIR) router: router.c $(LIB_SOURCES) $(CC) $(LD_OPTS) -D_ROUTER $(CC_OPTS) $(LIB_SOURCES) router.c -o $@ clean: - /bin/rm -f router router_query + /bin/rm -f *.o router diff --git a/src/srfsh/Makefile b/src/srfsh/Makefile index d7a3799..3151a62 100644 --- a/src/srfsh/Makefile +++ b/src/srfsh/Makefile @@ -1,20 +1,12 @@ -CC = gcc -LIB_DIR = ../../lib -CC_OPTS = -fPIC -Wall -O2 -I /usr/include/libxml2 -I /usr/include/libxml2/libxml -I ../../include -EXE_LD_OPTS = -L $(LIB_DIR) -lreadline -lxml2 -lopensrf_transport -lopensrf_stack -ljson -lncurses -lmd5 -lobjson +LD_OPTS += -lobjson -lreadline -lxml2 -lopensrf_transport -lopensrf_stack -ljson -lncurses -lc_utils all: srfsh -install: srfsh - cp srfsh ../../bin +install: + cp srfsh $(BINDIR) -srfsh: lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) srfsh.c -o $@ - -lib: - make -C ../libstack - make -C ../libtransport - make -C ../utils +srfsh: srfsh.c srfsh.h + $(CC) $(CC_OPTS) $(LD_OPTS) srfsh.c -o $@ clean: - /bin/rm -f srfsh + /bin/rm -f *.o srfsh diff --git a/src/utils/Makefile b/src/utils/Makefile index 658f068..2d7e444 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -1,26 +1,54 @@ -CC = gcc -LIB_DIR = ../../lib -CC_OPTS = -fPIC -Wall -O2 -I ../../include -EXE_LD_OPTS = -L $(LIB_DIR) -INCLUDE = ../../include -FM_HEADER = fieldmapper.h -FM_SOURCE = fieldmapper.c -HEADER_DIR = $(INCLUDE)/opensrf +LD_OPTS += -lc_utils -all: util #fieldmapper +#FM_HEADER = fieldmapper.h +#FM_SOURCE = fieldmapper.c +#HEADER_DIR = $(INCLUDE)/opensrf -util: md5 -md5: md5.c - $(CC) -c $(CC_OPTS) md5.c -o md5.o - $(CC) -shared -W1 md5.o -o $(LIB_DIR)/libmd5.so -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 $(LIB_DIR)/libopensrf_fm.so - cp $(FM_HEADER) $(HEADER_DIR)/ +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 + +install: + cp $(UTIL_HEADERS) $(INCLUDEDIR)/ + cp $(TMPDIR)/libc_utils.so $(LIBDIR)/ + +util: $(UTIL_OBJECTS) + $(CC) -shared -W1 $(UTIL_OBJECTS) -o $(TMPDIR)/libc_utils.so + cp $(UTIL_HEADERS) $(TMPDIR)/ + +logging.o: logging.c logging.h + $(CC) -c $(CC_OPTS) logging.c -o $@ + +utils.o: utils.c utils.h + $(CC) -c $(CC_OPTS) utils.c -o $@ + +socket_bundle.o: socket_bundle.c socket_bundle.h + $(CC) -c $(CC_OPTS) socket_bundle.c -o $@ + +md5.o: md5.c md5.h + $(CC) -c $(CC_OPTS) md5.c -o $@ + +sha.o: sha.c sha.h + $(CC) -c $(CC_OPTS) sha.c -o $@ + +string_array.o: string_array.c string_array.h + $(CC) -c $(CC_OPTS) string_array.c -o $@ clean: - /bin/rm -f md5.o - /bin/rm -f $(FM_SOURCE) $(FM_HEADER) + /bin/rm -f *.o socket_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)/ + + -- 2.11.0