Commits

Anonymous committed 75f5a24

Added the grand seedserve integration library.

Comments (0)

Files changed (2)

rand-seed-serve/libseedserve/Makefile

 NAME = seedserve
-LIBNAME = lib$(NAME).la
+LIBNAME = lib$(NAME).so
 EXENAME = $(NAME)-run
-EXE_DEPS = $(NAME).o main-run.o
-OBJECTS = $(EXE_DEPS)
+EXE_DEPS = $(LIBNAME) main-run.o
+OBJECTS = main-run.o $(NAME).o grand.o
 
-CFLAGS = -Wall -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -g
+GRAND_LIBNAME = libgrand_$(NAME).so
 
-TARGETS = $(EXENAME) $(LIBNAME)
+CFLAGS = -Wall -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -g `pkg-config glib-2.0 --cflags`
+
+TARGETS = $(EXENAME) $(LIBNAME) $(GRAND_LIBNAME) 
 
 all: $(TARGETS)
 
 	gcc -c $(CFLAGS) -o $@ $<
 
 $(EXENAME): $(EXE_DEPS)
-	gcc -o $@ $(EXE_DEPS)
+	gcc -L./.libs -o $@ main-run.o -l$(NAME)
 	
 $(LIBNAME): $(NAME).o
-	libtool --mode=link gcc $(CFLAGS) -o $@ -rpath /usr/lib -version-info 0:0:0 $<
-	
+	libtool --mode=link gcc -shared $(CFLAGS) -o $@ -version-info 0:0:0 $<
+
+$(GRAND_LIBNAME): grand.o $(LIBNAME) 
+	libtool --mode=link gcc -shared $(CFLAGS) -o $@ -version-info 0:0:0 $< -l$(NAME)
+
 TEST_VERBOSE = 0
 
 test: $(TARGETS)

rand-seed-serve/libseedserve/grand.c

+#include "seedserve.h"
+#include <glib.h>
+
+GRand* 
+g_rand_new (void)
+{
+  return g_rand_new_with_seed(seedserve_get_seed());
+}
+