#Variables
include $(SCT_DAQ_ROOT)/build/Makefile.include
#Commands
include $(SCT_DAQ_ROOT)/build/Makefile.commands

SRCS := $(shell find -name "*.java")
BINS := testgui
JARS := TestGUI.jar
SCRIPTS := $(addprefix $(ScriptDir)/../,$(wildcard scripts/*.*))
JAVAFLAGS += -d classes
JARMANIFEST := MANIFEST.MF

#Phony Targets
.PHONY: all c++ java install clean distclean

all: c++ java
distclean: clean
	-rm -r -f *.javaidl classes

clean:
	-rm -f built -r classes *.jar

install: $(ShareLibDir)/$(JARS) $(ShareBinDir)/$(BINS) $(SCRIPTS)
java: classes $(JARS) install
c++:

#Real targets
classes:
	$(MKDIR)

$(JARS): built $(JARMANIFEST)
	$(JARCMD) -C classes .

built: $(SRCS)
	$(JAVACMD) && touch $@

$(ShareBinDir)/$(BINS): $(BINS)
	$(CPCMD)

$(ShareLibDir)/$(JARS): $(JARS)
	$(CPCMD)

$(ScriptDir)/%: scripts/%
	$(CPCMD)

