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

HDRS = $(wildcard sctddc/*.hxx)

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

all: install_headers install_hacks config c++

distclean clean install:
	$(MAKE) -C src $@

# Install needs to install c++ libraries and configuration files
install: install_headers install_hacks config c++

install_headers: $(IncludeDir)/sctddc $(addprefix $(IncludeDir)/,$(HDRS))

install_hacks:
	$(MAKE) -C share $(MAKECMDGOALS)

c++: install_headers
	$(MAKE) -C src $(MAKECMDGOALS)

# Do the config stuff in the run directory (they shouldn't be in run when copied to installed)
config:
	$(MAKE) -C run $(MAKECMDGOALS)

test:
	$(MAKE) -C test $(MAKECMDGOALS)

$(IncludeDir)/sctddc/ :
	$(MKDIR)

$(IncludeDir)/sctddc/%.hxx : sctddc/%.hxx
	$(CPCMD)
