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

SRCS := $(shell find -name "*.java")
IDLS := $(IncludeDir)/FittingService/FitterInterface.idl
IDLFLAGS := $(notdir $(IDLS:.idl=.javaidl))
JARS := FittingService.jar
JAVAFLAGS += -d classes
JARMANIFEST := 

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

all: c++ java
distclean: clean
	-rm -r -f *.javaidl FitterI classes 
clean:
	-rm -f built -r classes *.jar
install: $(ShareLibDir)/$(JARS)
compile: classes $(JARS) install
java: idl
	$(MAKE) compile
idl: $(IDLFLAGS)
c++:

#Real targets
classes:
	$(MKDIR)

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

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

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

FitterInterface.javaidl: $(IncludeDir)/FittingService/FitterInterface.idl
	$(JAVAIDLCMD) && touch $@
