# makedist Makefile
# Copyright (c) 2003-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2004 by Davide Madrisan <davide.madrisan@gmail.com>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

include /var/makedist/.defs.inc
include ./VERSION

# FIXME: obsolete, check and remove next time
initrd_dir  = $(LOCALSTATEDIR)/initrd

ALL_TARGETS = $(shell ls $(TARGETSDIR))

DEBUG := 0

help:
	@echo;\
	echo "makedist Makefile help, version $(makedist_version) " \
              | sed -e :l -e 's/^.\{1,71\}$$/&_/;t l';\
	echo ;\
	echo " make <target>      create distribution for <target>";\
	echo " make clean         remove the intermediate files except ISO, RPM";\
	echo " make help          display this help";\
	echo;\
	echo " You can also set the above variables:";\
	echo " - \`DEBUG': if set to 1 enables debugging features (target dependent)";\
	echo " - \`PLATFORM: specify the target platform (eg. free,desktop,server)";\
	echo;\
	echo " e.g. make openmamba PLATFORM=flash-1GB";\
	echo;\
	echo;\
	echo "WARNING: this Makefile shouldn't be called directly by the user.";\
	echo "         Please use the makedist instead; type \`makedist\` for help.";\
	echo

$(ALL_TARGETS): clean
	./makedist.sh -t $@ $(initrd_dir) $(DEBUG)

clean:
	@rm -fr $(initrd_dir)/modules/* $(initrd_dir)/install/* || true
