made changes necessary to build a static version
authorBenjamin Mako Hill <mako@atdot.cc>
Mon, 2 May 2011 23:55:37 +0000 (19:55 -0400)
committerBenjamin Mako Hill <mako@atdot.cc>
Mon, 2 May 2011 23:55:37 +0000 (19:55 -0400)
Working with Bernie Innocenti, I completely overhauled the Makefile with
the goal of having it be able to build static versions of the library
which I need to run it on my cluster. In general, this has simplified
the Makefile. I had to make one small change to the disorder file in the
process.

Makefile
disorder.h

index 12459edfc806e0a20ed8d487256272c94d2e430a..cc0e56f806924b23304046c2361bfdce5c541001 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,21 @@
-CXX = g++
-CFLAGS = -O3
-OBJECTS = disorder.o md5.o
+CXXFLAGS = -O3 
+CFLAGS = $(CXXFLAGS)
+OBJECTS = wikiq.o md5.o disorder.o 
 
 all: wikiq
 
 
 all: wikiq
 
-wikiq: wikiq.cpp $(OBJECTS)
-       $(CXX) $(CFLAGS) -lpcrecpp -lexpat wikiq.cpp $(OBJECTS) -o wikiq
+wikiq: $(OBJECTS)
+       $(CXX) $(CXXFLAGS) $(OBJECTS) -lpcrecpp -lpcre -lexpat -o wikiq
 
 
-disorder.o: disorder.c disorder.h
-       $(CXX) $(CFLAGS) -c disorder.c
-
-md5.o: md5.c md5.h
-       $(CXX) $(CFLAGS) -c md5.c -lm
+disorder.o: disorder.h
+md5.o: md5.h
 
 clean:
        rm -f wikiq $(OBJECTS)
 
 
 clean:
        rm -f wikiq $(OBJECTS)
 
+static: $(OBJECTS)
+       $(CXX) $(CXXFLAGS) $(OBJECTS) -static -lpcrecpp -lpcre -lexpat -o wikiq
+
 gprof:
        $(MAKE) CFLAGS=-pg wikiq
 
 gprof:
        $(MAKE) CFLAGS=-pg wikiq
 
index 345877445ed918840d6c521b0e481dab9746e3f3..91ec47d9371c9a7c0d194835b803601a3bb8042e 100644 (file)
 #ifndef __DISORDER_H_
 #define __DISORDER_H_
 
 #ifndef __DISORDER_H_
 #define __DISORDER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Max number of bytes (i.e., tokens) */
 #define LIBDO_MAX_BYTES      256
 
 /** Max number of bytes (i.e., tokens) */
 #define LIBDO_MAX_BYTES      256
 
@@ -59,4 +63,8 @@ float    get_max_entropy(void);
 /** Returns the ratio of entropy to maxentropy */
 float    get_entropy_ratio(void);
 
 /** Returns the ratio of entropy to maxentropy */
 float    get_entropy_ratio(void);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif
 #endif

Benjamin Mako Hill || Want to submit a patch?