-HEADER=header.tk
-TAIL=tail.tk
-
-# Previous versions always remade kconfig.tk because they always depended
-# on soundscript. This runs fairly fast, and I can't find all the
-# Config.in files to depend on anyways. So I'll force it to remake.
-
-kconfig.tk: dummy
-
-kconfig.tk: ${TOPDIR}/Makefile ${TOPDIR}/arch/${ARCH}/config.in \
- tkparse ${HEADER} ${TAIL}
- @if [ -f /usr/local/bin/wish ]; then \
- echo '#!'"/usr/local/bin/wish -f" > kconfig.tk; \
- else \
- echo '#!'"/usr/bin/wish -f" > kconfig.tk; \
- fi
- cat ${HEADER} >> ./kconfig.tk
- ./tkparse < ../arch/${ARCH}/config.in >> kconfig.tk
- echo "set defaults \"arch/${ARCH}/defconfig\"" >> kconfig.tk
- echo "set ARCH \"${ARCH}\"" >> kconfig.tk
- cat ${TAIL} >> kconfig.tk
- chmod 755 kconfig.tk
-
-tkparse: tkparse.o tkcond.o tkgen.o
- ${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o
-
-tkparse.o: tkparse.c tkparse.h
-
-tkcond.o: tkcond.c tkparse.h
-
-tkgen.o: tkgen.c tkparse.h
-
-tkparse.o tkcond.o tkgen.o:
- $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
-
-docproc.o: docproc.c
- $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
-
-docproc: docproc.o
- ${HOSTCC} -o docproc docproc.o
-
-clean:
- rm -f *~ kconfig.tk *.o tkparse mkdep split-include docproc
-
-include $(TOPDIR)/Rules.make
+###
+# scripts contains sources for various helper programs used throughout
+# the kernel for the build process.
+# ---------------------------------------------------------------------------
+# kallsyms: Find all symbols in vmlinux
+# pnmttologo: Convert pnm files to logo files
+# conmakehash: Create chartable
+# conmakehash: Create arrays for initializing the kernel console tables
+# docproc: Used in Documentation/DocBook
+
+HOST_EXTRACFLAGS += -I$(srctree)/tools/include
+
+hostprogs-$(CONFIG_KALLSYMS) += kallsyms
+hostprogs-$(CONFIG_LOGO) += pnmtologo
+hostprogs-$(CONFIG_VT) += conmakehash
+hostprogs-$(CONFIG_IKCONFIG) += bin2c
+hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
+
+always := $(hostprogs-y) $(hostprogs-m)
+
+# The following hostprogs-y programs are only build on demand
+hostprogs-y += unifdef docproc
+
+# These targets are used internally to avoid "is up to date" messages
+PHONY += build_unifdef
+build_unifdef: scripts/unifdef FORCE
+ @:
+build_docproc: scripts/docproc FORCE
+ @:
+
+subdir-$(CONFIG_MODVERSIONS) += genksyms
+subdir-y += mod
+subdir-$(CONFIG_SECURITY_SELINUX) += selinux
+subdir-$(CONFIG_DTC) += dtc
+
+# Let clean descend into subdirs
+subdir- += basic kconfig package selinux