Merging changes from branches/new-json2
[OpenSRF.git] / src / libopensrf / Makefile
1 # ------------------------------------------------------------------
2 # To build the standalone JSON lib libosrf_json.so:
3 #       $ make libosrf_json.so
4 # To build the standalone JSON lib libosrf_json.so with XML utils 
5 #       support, use something like the following:
6 #       $ CFLAGS="-DOSRF_JSON_ENABLE_XML_UTILS -I/usr/include/libxml2" LDLIBS=-lxml2 make libosrf_json.so
7 #
8 # The compiler flag -DOSRF_JSON_ALLOW_COMMENTS tells the parser to 
9 # allow legacy JSON comments like /* comment */
10 # ------------------------------------------------------------------
11
12 CFLAGS  +=  -DASSUME_STATELESS  -DOSRF_STRICT_PARAMS -rdynamic -fno-strict-aliasing -I../../include -fPIC -Wall -DOSRF_JSON_ENABLE_XML_UTILS
13 LDLIBS  += -lxml2 -ldl -lmemcache 
14 export OSRF_INC = ../../include/opensrf/
15
16 TARGETS =       osrf_message.o \
17                         osrf_app_session.o \
18                         osrf_stack.o \
19                         osrf_system.o \
20                         osrf_settings.o \
21                         osrf_prefork.o \
22                         osrfConfig.o \
23                         osrf_application.o \
24                         osrf_cache.o \
25                         osrf_transgroup.o \
26                         osrf_list.o \
27                         osrf_hash.o \
28                         xml_utils.o \
29                         transport_message.o\
30                         transport_session.o\
31                         transport_client.o\
32                         md5.o\
33                         log.o\
34                         utils.o\
35                         socket_bundle.o\
36                         sha.o\
37                         string_array.o
38
39 JSON_TARGETS =  osrf_json_object.o\
40                                 osrf_json_parser.o \
41                                 osrf_json_tools.o \
42                                 osrf_legacy_json.o \
43                                 osrf_json_xml.o
44
45 # use these when building the standalone JSON module
46 JSON_DEPS = osrf_list.o\
47                         osrf_hash.o\
48                         utils.o\
49                         log.o\
50                         md5.o\
51                         string_array.o
52
53
54 all: opensrf
55
56 # Build the OpenSRF C binary
57 opensrf:        opensrf.o libopensrf.so
58         @echo $@
59         $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -lopensrf opensrf.o -o $@
60
61
62 # Build the OpenSRF library
63 libopensrf.so:  $(TARGETS) json
64         if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then\
65                 $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) -o $(TMPDIR)/libopensrf.so;\
66         else\
67                 $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) $(JSON_TARGETS) -o $(TMPDIR)/libopensrf.so;\
68         fi; 
69
70
71 json:   $(JSON_TARGETS) $(JSON_DEPS)
72         if [ ! -z "$(OSRF_LEGACY_JSON)" ]; then \
73                 $(CC) -shared -W1  $(CFLAGS) \
74                         $(LDFLAGS) $(JSON_TARGETS) $(JSON_DEPS) -o $(TMPDIR)/libobjson.so;\
75         fi;
76
77 libosrf_json.so:        $(JSON_TARGETS) $(JSON_DEPS)
78         $(CC) -shared -W1 $(CFLAGS) \
79                 $(LDFLAGS) $(LDLIBS) $(JSON_TARGETS) $(JSON_DEPS) -o $@
80
81
82 osrf_json_test: osrf_json_test.o $(JSON_TARGETS) $(JSON_DEPS)
83
84
85 opensrf.o:      opensrf.c
86 transport_message.o:    transport_message.c $(OSRF_INC)/transport_message.h     
87 transport_session.o:    transport_session.c $(OSRF_INC)/transport_session.h     
88 transport_client.o:     transport_client.c $(OSRF_INC)/transport_client.h       
89 osrf_message.o: osrf_message.c $(OSRF_INC)/osrf_message.h
90 osrf_app_session.o:     osrf_app_session.c $(OSRF_INC)/osrf_app_session.h
91 osrf_stack.o:   osrf_stack.c $(OSRF_INC)/osrf_stack.h
92 osrf_system.o:  osrf_system.c $(OSRF_INC)/osrf_system.h
93 osrf_settings.o:        osrf_settings.c $(OSRF_INC)/osrf_settings.h
94 osrf_prefork.o: osrf_prefork.c $(OSRF_INC)/osrf_prefork.h
95 osrfConfig.o:   osrfConfig.c $(OSRF_INC)/osrfConfig.h xml_utils.o
96 osrf_application.o: osrf_application.c $(OSRF_INC)/osrf_application.h
97 osrf_cache.o:   osrf_cache.c $(OSRF_INC)/osrf_cache.h
98 osrf_list.o:    osrf_list.c $(OSRF_INC)/osrf_list.h
99 osrf_hash.o:    osrf_hash.c $(OSRF_INC)/osrf_hash.h
100 md5.o:  md5.c $(OSRF_INC)/md5.h
101 log.o:  log.c $(OSRF_INC)/log.h 
102 utils.o:        utils.c $(OSRF_INC)/utils.h
103 socket_bundle.o:        socket_bundle.c $(OSRF_INC)/socket_bundle.h
104 sha.o:  sha.c $(OSRF_INC)/sha.h
105 string_array.o: string_array.c $(OSRF_INC)/string_array.h
106 osrf_json_object.o:     osrf_json_object.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
107 osrf_json_parser.o:     osrf_json_parser.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
108 osrf_json_tools.o:      osrf_json_tools.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
109 osrf_legacy_json.o:     osrf_legacy_json.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_utils.h
110 osrf_json_xml.o:        osrf_json_xml.c $(OSRF_INC)/osrf_json.h $(OSRF_INC)/osrf_json_xml.h
111 osrf_json_test.o:       osrf_json_test.c
112
113
114 clean:
115         /bin/rm -f *.o *.so opensrf osrf_json_test
116
117
118
119