changeset 371:5eb5034b0577

Proper dependency information for audioDB.cpp: * invert #ifdef BINARY logic (use LIBRARY instead); * have two separate object files; * explicit makefile rule for audioDB_library.o; * don't make tags in the "all" target
author mas01cr
date Thu, 13 Nov 2008 12:54:15 +0000
parents 2d5c3f8e8c22
children 52406e53f133
files Makefile audioDB.cpp
diffstat 2 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Nov 12 15:40:40 2008 +0000
+++ b/Makefile	Thu Nov 13 12:54:15 2008 +0000
@@ -19,8 +19,8 @@
 endif
 endif
 
-LIBOBJS=insert.o create.o common.o dump.o query.o sample.o index.o lshlib.o
-OBJS=$(LIBOBJS) soap.o
+LIBOBJS=insert.o create.o common.o dump.o query.o sample.o index.o lshlib.o cmdline.o
+OBJS=$(LIBOBJS) soap.o audioDB.o
 
 
 EXECUTABLE=audioDB
@@ -29,7 +29,7 @@
 
 .PHONY: all clean test
 
-all: $(OBJS) $(LIBRARY) $(EXECUTABLE) tags 
+all: $(LIBRARY) $(EXECUTABLE)
 
 $(EXECUTABLE).1: $(EXECUTABLE)
 	$(HELP2MAN) ./$(EXECUTABLE) > $(EXECUTABLE).1
@@ -49,15 +49,15 @@
 cmdline.o: cmdline.c cmdline.h
 	gcc -c $(CFLAGS) $<
 
+audioDB_library.o: audioDB.cpp
+	g++ -c -o $@ $(CFLAGS) $(GSOAP_INCLUDE) -Wall -DLIBRARY $< 
 
-$(EXECUTABLE): cmdline.o $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
-	g++ -c $(CFLAGS) $(GSOAP_INCLUDE) -Wall audioDB.cpp -DBINARY
-	g++ -o $(EXECUTABLE) $(CFLAGS) audioDB.o $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
+$(EXECUTABLE): $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
+	g++ -o $(EXECUTABLE) $(CFLAGS) $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
 
 
-$(LIBRARY): cmdline.o $(LIBOBJS)
-	g++ -c $(CFLAGS) -Wall audioDB.cpp
-	g++ -shared -o $(LIBRARY) $(CFLAGS) $(LIBGSL) audioDB.o $^ 
+$(LIBRARY): $(LIBOBJS) audioDB_library.o
+	g++ -shared -o $(LIBRARY) $(CFLAGS) $(LIBGSL) $^ 
 
 tags:
 	ctags *.cpp *.h
@@ -72,7 +72,7 @@
 	-rm xthresh
 	-sh -c "cd tests && sh ./clean.sh"
 	-sh -c "cd libtests && sh ./clean.sh"
-	-rm $(LIBRARY)
+	-rm $(LIBRARY) audioDB_library.o
 	-rm tags
 
 dist_clean:
--- a/audioDB.cpp	Wed Nov 12 15:40:40 2008 +0000
+++ b/audioDB.cpp	Thu Nov 13 12:54:15 2008 +0000
@@ -41,11 +41,11 @@
     prefix_name((char** const)&dbName, adb_root);
 
   if(O2_ACTION(COM_SERVER))
-    #ifdef BINARY
+#ifdef LIBRARY
+    ;
+#else
     startServer();
-    #else
-    ;
-    #endif
+#endif
 
   else  if(O2_ACTION(COM_CREATE))
     create(dbName);
@@ -58,7 +58,9 @@
 
   else if(O2_ACTION(COM_QUERY))
     if(isClient){
-    #ifdef BINARY
+#ifdef LIBRARY
+      ;
+#else
       if(query_from_key){
 	VERB_LOG(1, "Calling web services query %s on database %s, query=%s\n", radius>0?"(Radius)":"(NN)", dbName, (key&&strlen(key))?key:inFile);
 	ws_query_by_key(dbName, key, inFile, (char*)hostport);	
@@ -67,20 +69,18 @@
 	VERB_LOG(1, "Calling web services query on database %s, query=%s\n", dbName, (key&&strlen(key))?key:inFile);
 	ws_query(dbName, inFile, (char*)hostport);
       }
-    #else
-    ;
-    #endif
+#endif
     }
     else
       query(dbName, inFile);
 
   else if(O2_ACTION(COM_STATUS))
     if(isClient)
-    #ifdef BINARY
+#ifdef LIBRARY
+      ;
+#else
       ws_status(dbName,(char*)hostport);
-    #else
-    ;
-    #endif
+#endif
     else
       status(dbName);
 
@@ -98,11 +98,11 @@
 
   else if(O2_ACTION(COM_LISZT))
     if(isClient)
-    #ifdef BINARY
+#ifdef LIBRARY
+      ;
+#else 
       ws_liszt(dbName, (char*) hostport);
-    #else
-    ;
-    #endif
+#endif
     else
       liszt(dbName, lisztOffset, lisztLength);