Makefile: make java targets more standard

separate the 'regular' make targets from the eclipse-workspace
target
diff --git a/Makefile b/Makefile
index 7b241c3..8e632a2 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,8 @@
                                  \! \( -name '*.cache' -o -name '.*' \))
 INPUT_FILES = $(wildcard openflow_input/*)
 TEST_DATA = $(shell find test_data -name '*.data')
-OPENFLOWJ_WORKSPACE = openflowj-loxi
+OPENFLOWJ_OUTPUT_DIR = ${LOXI_OUTPUT_DIR}/openflowj
+OPENFLOWJ_ECLIPSE_WORKSPACE = openflowj-loxi
 
 all: c python java
 
@@ -69,20 +70,35 @@
 	@echo "HTML documentation output to ${LOXI_OUTPUT_DIR}/pyloxi-doc"
 
 java: .loxi_ts.java
-	mkdir -p ${OPENFLOWJ_WORKSPACE}
-	ln -sf ../java_gen/pre-written/pom.xml ${OPENFLOWJ_WORKSPACE}/pom.xml
-	ln -sf ../java_gen/pre-written/LICENSE.txt ${OPENFLOWJ_WORKSPACE}/LICENSE.txt
-	ln -sf ../java_gen/pre-written/src ${OPENFLOWJ_WORKSPACE}
-	rsync --checksum --delete -rv ${LOXI_OUTPUT_DIR}/openflowj/src/ ${OPENFLOWJ_WORKSPACE}/gen-src
+	@rsync -rt java_gen/pre-written/ ${LOXI_OUTPUT_DIR}/openflowj/
+	@if [ -e ${OPENFLOWJ_ECLIPSE_WORKSPACE} ]; then \
+		rsync --checksum --delete -rv ${LOXI_OUTPUT_DIR}/openflowj/gen-src/ ${OPENFLOWJ_ECLIPSE_WORKSPACE}/gen-src; \
+	fi
 
 .loxi_ts.java: ${LOXI_PY_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES} ${TEST_DATA}
 	./loxigen.py --install-dir=${LOXI_OUTPUT_DIR} --lang=java
 	touch $@
 
-java-eclipse: java
-	cd ${OPENFLOWJ_WORKSPACE} && mvn eclipse:eclipse
+eclipse-workspace:
+	mkdir -p ${OPENFLOWJ_ECLIPSE_WORKSPACE}
+	ln -sf ../java_gen/pre-written/pom.xml ${OPENFLOWJ_ECLIPSE_WORKSPACE}/pom.xml
+	ln -sf ../java_gen/pre-written/LICENSE.txt ${OPENFLOWJ_ECLIPSE_WORKSPACE}/LICENSE.txt
+	ln -sf ../java_gen/pre-written/src ${OPENFLOWJ_ECLIPSE_WORKSPACE}
+	cd ${OPENFLOWJ_ECLIPSE_WORKSPACE} && mvn eclipse:eclipse
 	# Unfortunately, mvn eclipse:eclipse resolves the symlink, which doesn't work with eclipse
-	cd ${OPENFLOWJ_WORKSPACE} && perl -pi -e 's{<classpathentry kind="src" path="[^"]*/java_gen/pre-written/src/}{<classpathentry kind="src" path="src/}' .classpath
+	cd ${OPENFLOWJ_ECLIPSE_WORKSPACE} && perl -pi -e 's{<classpathentry kind="src" path="[^"]*/java_gen/pre-written/src/}{<classpathentry kind="src" path="src/}' .classpath
+
+check-java: java
+	cd ${OPENFLOWJ_OUTPUT_DIR} && mvn compile test-compile test
+
+package-java: java
+	cd ${OPENFLOWJ_OUTPUT_DIR} && mvn package
+
+deploy-java: java
+	cd ${OPENFLOWJ_OUTPUT_DIR} && mvn deploy
+
+install-java: java
+	cd ${OPENFLOWJ_OUTPUT_DIR} && mvn install
 
 wireshark: .loxi_ts.wireshark
 
@@ -119,18 +135,6 @@
 	make -C ${LOXI_OUTPUT_DIR}/locitest
 	${LOXI_OUTPUT_DIR}/locitest/locitest
 
-check-java: java
-	cd ${OPENFLOWJ_WORKSPACE} && mvn compile test-compile test
-
-package-java: java
-	cd ${OPENFLOWJ_WORKSPACE} && mvn package
-
-deploy-java: java
-	cd ${OPENFLOWJ_WORKSPACE} && mvn deploy
-
-install-java: java
-	cd ${OPENFLOWJ_WORKSPACE} && mvn install
-
 pylint:
 	pylint -E ${LOXI_PY_FILES}
 
diff --git a/java_gen/codegen.py b/java_gen/codegen.py
index c01ba68..9a10bdf 100644
--- a/java_gen/codegen.py
+++ b/java_gen/codegen.py
@@ -73,7 +73,7 @@
 
     def render_class(self, clazz, template, src_dir=None, **context):
         if not src_dir:
-            src_dir = "src/main/java/"
+            src_dir = "gen-src/main/java/"
 
         context['class_name'] = clazz.name
         context['package'] = clazz.package
@@ -147,7 +147,7 @@
                 unit_test = unit_tests.get_test_unit(i)
                 if unit_test.has_test_data:
                     self.render_class(clazz=unit_test,
-                            template='unit_test.java', src_dir="src/test/java",
+                            template='unit_test.java', src_dir="gen-src/test/java",
                             version=unit_test.java_class.version,
                             test=unit_test, msg=unit_test.java_class,
                             test_data=unit_test.test_data)
diff --git a/java_gen/test.sh b/java_gen/test.sh
deleted file mode 100755
index 7b71ffd..0000000
--- a/java_gen/test.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-rm -rf target_code/
-cd ..
-./loxigen.py -ljava #&& ( cd target_code/Modules/openflowj/ && ant  )