From b110bc1052585df1b8b67c784e0b53104a73dafc Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 25 Aug 2015 05:26:34 +0200
Subject: [PATCH] Further changes/fixes to the build system / file system
 paths.

---
 all.do                                      |  2 +-
 build/build_template => libplomrogue.so.do  | 11 ++++-------
 roguelike-client.do                         | 13 +++++++++----
 libplomrogue.c => src/server/libplomrogue.c |  0
 test_server.sh                              |  2 +-
 5 files changed, 15 insertions(+), 13 deletions(-)
 rename build/build_template => libplomrogue.so.do (56%)
 rename libplomrogue.c => src/server/libplomrogue.c (100%)

diff --git a/all.do b/all.do
index 337d4c2..a2340d3 100644
--- a/all.do
+++ b/all.do
@@ -4,5 +4,5 @@
 # or any later version. For details on its copyright, license, and warranties,
 # see the file NOTICE in the root directory of the PlomRogue source package.
 
-redo-ifchange roguelike-server 
+redo-ifchange libplomrogue.so 
 redo-ifchange roguelike-client
diff --git a/build/build_template b/libplomrogue.so.do
similarity index 56%
rename from build/build_template
rename to libplomrogue.so.do
index 2f50556..26ca117 100644
--- a/build/build_template
+++ b/libplomrogue.so.do
@@ -1,13 +1,10 @@
+# redo build file to build the library "libplomrogue.so"
+
 # This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
 # or any later version. For details on its copyright, license, and warranties,
 # see the file NOTICE in the root directory of the PlomRogue source package.
 
 redo-ifchange build/compiler_flags
 . ./build/compiler_flags
-mkdir -p build/$TARGET
-mkdir -p build/common
-for file in src/${TARGET}/*.c src/common/*.c; do
-  file=build/${file#src/}
-  redo-ifchange ${file%.*}.o
-done
-gcc $CFLAGS -o $3 -g build/${TARGET}/*.o build/common/*.o $LIBRARY_LINKS
+redo-ifchange src/server/libplomrogue.c
+gcc -shared -fPIC $CFLAGS -o $3 src/server/libplomrogue.c -lm
diff --git a/roguelike-client.do b/roguelike-client.do
index 761fdfa..af1234b 100644
--- a/roguelike-client.do
+++ b/roguelike-client.do
@@ -4,7 +4,12 @@
 # or any later version. For details on its copyright, license, and warranties,
 # see the file NOTICE in the root directory of the PlomRogue source package.
 
-redo-ifchange build/build_template
-TARGET=client
-LIBRARY_LINKS=-lncurses
-. ./build/build_template
+redo-ifchange build/compiler_flags
+. ./build/compiler_flags
+mkdir -p build/client
+mkdir -p build/common
+for file in src/client/*.c src/common/*.c; do
+  file=build/${file#src/}
+  redo-ifchange ${file%.*}.o
+done
+gcc $CFLAGS -o $3 -g build/client/*.o build/common/*.o -lncurses
diff --git a/libplomrogue.c b/src/server/libplomrogue.c
similarity index 100%
rename from libplomrogue.c
rename to src/server/libplomrogue.c
diff --git a/test_server.sh b/test_server.sh
index d2cefbc..16f52fa 100755
--- a/test_server.sh
+++ b/test_server.sh
@@ -4,7 +4,7 @@
 echo "Copying tested server script to ./tested_server.py."
 cp ./roguelike-server ./testing/tested_server.py
 echo "Copying tested C library source to ./tested_server_lib.c."
-cp ./libplomrogue.c ./testing/tested_server_lib.c
+cp ./src/server/libplomrogue.c ./testing/tested_server_lib.c
 
 cp ./testing/start _test
 echo "Starting server on save file '_test' copied from ./testing/start."
-- 
2.30.2