#
#  Makefile for the CTX HV utility 
#

include Makefile.general

PROGRAMS = hvcontrol remotecontrol 

SUBDIRS = src


all: $(PROGRAMS) 


OBJECTS   = $(SUBDIRS:=/*.o)

INCDIRS   = -I. $(SUBDIRS:%=-I%)

MRPROPERS = $(SUBDIRS:=.mrproper)

CLEANERS  = $(SUBDIRS:=.cleaner)

LIBRARIES = $(SUBDIRS:=.all)


$(PROGRAMS) : % : %.o $(LIBRARIES)
	$(G++) $(CFLAGS) -o $@ $@.o  $(OBJECTS) $(LIBS) 

include Makefile.rules

$(LIBRARIES):
	@echo " Calling make in $(@:.all=)"
	@(cd $(@:.all=); $(MAKE) -f Makefile all)

$(MRPROPERS):
	@echo " Doing Mr.Proper in $(@:.mrproper=)"
	@(cd $(@:.mrproper=); $(MAKE) -f Makefile mrproper)

$(CLEANERS):
	@echo " Doing clean in $(@:.cleaner=)"
	@(cd $(@:.cleaner=); $(MAKE) -f Makefile clean)

mrproper: $(MRPROPERS) rmobj rmbak rmdep
	@rm -f $(PROGRAMS)
	@echo " Done."

clean: $(CLEANERS) rmobj
	@echo " Done."

