################################################################################
# initialization
################################################################################

# set some defaults if this is not being called from the main makefile
ifndef CALLED_FROM_MAIN

	# aliases
	CP     := cp -rv
	MV     := mv -v
	RM     := rm -rfv

	# color definitions
	blue := $(shell tput setaf 6)
	sgr0 := $(shell tput sgr0)

endif


################################################################################
# compilation parameters
################################################################################

# define output file
OUT := slbmtest.py
OUTDIR := ../bin

# list of objects to compile
OBJS = src/slbmtest.py


################################################################################
# recipes
################################################################################

# recipe to make everything
all: initialize slbmtest finalize

# command that tells us which recipes don't build source files
.PHONY: all initialize msg_intro slbmtest finalize clean cleanall


# initialize compilation script
initialize: msg_intro

# print intro message
msg_intro:
	@echo "$(blue)------------------------------------------------------------$(sgr0)"
	@echo "$(blue)Making RSTT Python test...$(sgr0)"
	@echo "$(blue)------------------------------------------------------------$(sgr0)"


# build library after building each prerequisite in $(OBJS)
slbmtest: initialize $(OUT)
$(OUT): $(OBJS)
	@printf "$(blue)(Copying slbmtest.py) $(sgr0)"
	$(CP) $^ $(OUT)


# move files and clean up
finalize:
	@printf "$(blue)(Moving files) $(sgr0)"
	$(MV) $(OUT) $(OUTDIR)

clean:
	@printf "$(blue)(Clean *.py) $(sgr0)"
	$(RM) *.py

cleanall: clean
	@printf "$(blue)(Clean bin) $(sgr0)"
	$(RM) $(OUTDIR)/$(OUT)
