#
# Common make for acpica tools and utilities
#

#
# Main rule will only generate versions that are appropriate for the running
# OS, either 64-bit or 32-bit.
#
all:	$(PROGS)
$(PROGS): FORCE
	@cd $(BUILD_DIRECTORY_PATH)/$@; \
	mkdir -p obj; \
	$(MAKE) || exit "$$?"; \
	echo "$(TARGET) version of $@:"; \
	ls -al ../bin/$@.efi; \
	echo "";

#
# Simple clean removes all .obj files, but leaves the executables
# in the local bin directory
#
clean:	FORCE
	@for toolname in $(PROGS); do \
		(cd $(BUILD_DIRECTORY_PATH)/$$toolname; \
		if [ -d "obj" ] ; then \
			echo "Removing $$toolname:"; \
			pwd; \
			$(MAKE) clean; \
			rmdir obj; \
			echo ""; \
		fi; \
		); \
	done;

#
# Very clean removes all executables and the local bin directory
#
veryclean:	FORCE
	@for toolname in $(PROGS); do \
		(cd $(BUILD_DIRECTORY_PATH)/$$toolname; \
		if [ -d "obj" ] ; then \
			echo "Removing $$toolname:"; \
			pwd; \
			$(MAKE) clean; \
			rmdir obj; \
			echo ""; \
		fi; \
		); \
		if [ -e "$(BUILD_DIRECTORY_PATH)/bin/$$toolname" ] ; then \
			rm $(BUILD_DIRECTORY_PATH)/bin/$$toolname; \
		fi; \
	done; \
	if [ -d "bin" ] ; then \
		rmdir bin; \
	fi;

machine:	FORCE
	@echo "Target architecture: $(TARGET)";
	@echo "Host architecture: $(ACPI_HOST)";

FORCE:
