From fb8d093502cc62e6ffcac3350bcf3656fc54ce2d Mon Sep 17 00:00:00 2001
From: Sven Robertz <sven@cs.lth.se>
Date: Wed, 14 Dec 2011 16:04:10 +0100
Subject: [PATCH] added compilation of dependencies to the compile scripts

---
 examples/simple/README                  | 5 +++--
 examples/simple/compile.sh              | 1 +
 examples/simple/datagram/thr_compile.sh | 4 +++-
 examples/simple/datagram/udp_compile.sh | 8 +++++---
 lib/c/Makefile                          | 2 +-
 5 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/examples/simple/README b/examples/simple/README
index 0b63547..13234b3 100644
--- a/examples/simple/README
+++ b/examples/simple/README
@@ -1,5 +1,6 @@
-NB! Before trying to build and run this example, make sure you have built the LabComm compiler
-by running "ant jar" in the main directory (../../ seen from here).
+NB! Before trying to build and run examples, make sure you have built the LabComm compiler
+by running "ant jar" in the main directory (../../ seen from here) and compiled the labcomm
+descriptions needed. The compile.sh script does this.
 
 This is a very simple example with one labcomm file (simple.lc) defining two samples.
 Example source code: Encoders and decoders written in Java and C.
diff --git a/examples/simple/compile.sh b/examples/simple/compile.sh
index 6a25a2a..dc88832 100644
--- a/examples/simple/compile.sh
+++ b/examples/simple/compile.sh
@@ -1,4 +1,5 @@
 (cd ../../lib/c; make)
+(cd ../../ ; ant jar)
 
 java -jar ../../labComm.jar --java=gen --c=gen/simple.c --h=gen/simple.h  simple.lc 
 
diff --git a/examples/simple/datagram/thr_compile.sh b/examples/simple/datagram/thr_compile.sh
index fc17ae6..752bfe4 100644
--- a/examples/simple/datagram/thr_compile.sh
+++ b/examples/simple/datagram/thr_compile.sh
@@ -1,3 +1,5 @@
-(cd ../../../lib/c; make)
+#(cd ../../../lib/c; make)
+(cd ..; sh compile.sh)
+
 gcc -o thr_example -L ../../../lib/c -I . -I .. -I ../../../lib/c thr_example.c ../gen/simple.c  -llabcomm
 #gcc -o thr_example -L ../../../lib/c -I . -I .. -I ../../../lib/c thr_example.c ../gen/simple.c ../../../lib/c/labcomm_thr_reader_writer.c ../../../lib/c/ThrottleDrv/*.c -llabcomm
diff --git a/examples/simple/datagram/udp_compile.sh b/examples/simple/datagram/udp_compile.sh
index e5a2017..ba5e771 100644
--- a/examples/simple/datagram/udp_compile.sh
+++ b/examples/simple/datagram/udp_compile.sh
@@ -1,5 +1,7 @@
-(cd ../../../lib/c; make)
+#(cd ../../../lib/c; make)
 
-gcc -g -o udp_encoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_encoder.c ../gen/simple.c ../../../lib/c/labcomm_udp_reader_writer.c udp_hack.c -llabcomm
+(cd ..; sh compile.sh)
 
-gcc -g -o udp_decoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_decoder.c ../gen/simple.c ../../../lib/c/labcomm_udp_reader_writer.c udp_hack.c -llabcomm
+gcc -g -o udp_encoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_encoder.c ../gen/simple.c -llabcomm
+
+gcc -g -o udp_decoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_decoder.c ../gen/simple.c -llabcomm
diff --git a/lib/c/Makefile b/lib/c/Makefile
index ad619b3..90b7bc6 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,7 +1,7 @@
 CC = gcc
 CFLAGS = -g
 
-liblabcomm.a : labcomm.o labcomm_fd_reader_writer.o labcomm_udp_reader_writer.o labcomm_thr_reader_writer.o ethaddr.o ThrottleDrv/ethernet_drv.o ThrottleDrv/throttle_drv.o
+liblabcomm.a : labcomm.o labcomm_fd_reader_writer.o labcomm_udp_reader_writer.o udp_hack.o labcomm_thr_reader_writer.o ethaddr.o ThrottleDrv/ethernet_drv.o ThrottleDrv/throttle_drv.o
 #	ar -r liblabcomm.a labcomm.o labcomm_fd_reader_writer.o ethaddr.o
 	ar -r liblabcomm.a $^
 
-- 
GitLab