#
# This is a simple makefile to assist with quickly building the Exercises of MP2.
#
# To build and execute a particular exercise:
# - For a single exercise, type 'make runA' to run exercise A.
# - For all exercises, 'make'.
#
#
HADOOP_CLASSPATH := ${JAVA_HOME}/lib/tools.jar
export HADOOP_CLASSPATH
HDFS=user/lada38/lab3
OBJDIR=build
JAR := MapReducePSO.jar
TARGETS := $(addprefix run, 1 2)
.PHONY: final $(TARGETS) clean
final: $(TARGETS)
run1: $(OBJDIR)/WHV1.class
jar -cvf $(JAR) -C $(OBJDIR)/ ./
hdfs dfs -rm -r -skipTrash -f /$(HDFS)/Aout/
hadoop jar $(JAR) WHV1 -D percentage=.2 /user/adampap/WHVsmall /$(HDFS)/Aout
@echo "Run the following command to read the output file:"
@echo "hdfs dfs -cat /$(HDFS)/Aout/part*"
run2: $(OBJDIR)/WHV2.class
jar -cvf $(JAR) -C $(OBJDIR)/ ./
hdfs dfs -rm -r -skipTrash -f /$(HDFS)/Bout/
hadoop jar $(JAR) WHV2 -D N=10 /user/adampap/WHVsmall /$(HDFS)/Bout
@echo "Run the following command to read the output file:"
@echo "hdfs dfs -cat /$(HDFS)/Bout/part*"
$(OBJDIR)/%.class: %.java | $(OBJDIR)
hadoop com.sun.tools.javac.Main $< -d $(OBJDIR)
$(OBJDIR):
mkdir $@
.PHONY: clean
clean:
rm -f $(OBJDIR)/* $(JAR)
hdfs dfs -rm -r -skipTrash -f /$(HDFS)/*-output/