SUBDIRS =
DIST_SUBDIRS = _nfdos/kernel/neurotron

bin_SCRIPTS = nfdos
CLEANFILES = $(bin_SCRIPTS)
EXTRA_DIST = nfdos.in

nfdos_PYTHON = bootstrap.py __init__.py

nfdosdir = $(pythondir)/_nfdos

do_substitution = sed -e 's,[@]pythondir[@],$(pythondir),g' \
		-e 's,[@]PACKAGE[@],$(PACKAGE),g' \
		-e 's,[@]VERSION[@],$(VERSION),g'

.PHONY: neurotron

all: neurotron

nfdos: nfdos.in Makefile
	sudo apt-get install -y gir1.2-vte-2.91 python3-gi gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \
	python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \
	patch libstdc++6 rsync git meson ninja-build libncurses-dev libtinfo-dev grub-pc-bin grub-common xorriso mtools zlib1g-dev
	sudo apt autoremove -y
	$(do_substitution) < $(srcdir)/nfdos.in > nfdos
	chmod +x nfdos

# ===========================
#  Build manual do Neurotron
# ===========================

neurotron:
	@echo "🚀 Construindo Neurotron (kernel digital)..."
	cd _nfdos/kernel/neurotron && autoreconf -fi
	cd _nfdos/kernel/neurotron && ./configure --prefix=/usr
	$(MAKE) -C _nfdos/kernel/neurotron
	@echo "✅ Neurotron construído com sucesso!"

