Commit 04a8c2f5 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Build targets locally

Targets should always be built from the Makefile local to the subdir
they are in. So build scripts/* from scripts/Makefile.

Clean up scripts/Makefile as we go.
parent 999281bc
......@@ -12,17 +12,12 @@ EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
C-procfs-example = procfs_example.sgml
$(TOPDIR)/scripts/docgen: FORCE
chmod 755 $(TOPDIR)/scripts/docgen
$(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc: doc-progs ;
$(TOPDIR)/scripts/gen-all-syms: FORCE
chmod 755 $(TOPDIR)/scripts/gen-all-syms
$(TOPDIR)/scripts/kernel-doc: FORCE
chmod 755 $(TOPDIR)/scripts/kernel-doc
$(TOPDIR)/scripts/docproc: FORCE
$(MAKE) -C $(TOPDIR)/scripts docproc
.PHONY: doc-progs
doc-progs:
@$(MAKE) -C $(TOPDIR)/scripts doc-progs
$(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc
......
......@@ -263,6 +263,11 @@ include/linux/version.h: ./Makefile
@echo Generating $@
@. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL)
# helpers built in scripts/
scripts/mkdep scripts/split-include : FORCE
@$(MAKE) -C scripts
# ---------------------------------------------------------------------------
# Generate dependencies
......@@ -361,15 +366,6 @@ endif # CONFIG_MODULES
include Rules.make
# Build helpers in scripts/
# FIXME: do that in scripts/Makefile?
scripts/mkdep: scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/split-include: scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
# Cleaning up
# ---------------------------------------------------------------------------
......
# always needed
# ---------------------------------------------------------------------------
all: mkdep split-include
mkdep: mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
split-include: split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
# xconfig
# ---------------------------------------------------------------------------
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: FORCE
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
kconfig.tk: $(TOPDIR)/arch/$(ARCH)/config.in tkparse $(HEADER) $(TAIL) FORCE
@echo Generating $@
@( \
if [ -f /usr/local/bin/wish ]; then \
echo '#!'"/usr/local/bin/wish -f"; \
else \
echo '#!'"/usr/bin/wish -f"; \
fi; \
cat $(HEADER); \
./tkparse < $<; \
echo "set defaults \"arch/${ARCH}/defconfig\""; \
echo "set ARCH \"${ARCH}\""; \
cat $(TAIL) \
) > $@
chmod 755 $@
tkparse: tkparse.o tkcond.o tkgen.o
${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o
tkparse.o: tkparse.c tkparse.h
$(HOSTCC) -o $@ $^
tkcond.o: tkcond.c tkparse.h
tkparse.o tkcond.o tkgen.o: %.o: %.c
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
tkgen.o: tkgen.c tkparse.h
# DocBook stuff
# ---------------------------------------------------------------------------
tkparse.o tkcond.o tkgen.o:
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
doc-progs: docproc docgen gen-all-syms kernel-doc
docproc.o: docproc.c
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
docproc: docproc.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
docproc: docproc.o
${HOSTCC} -o docproc docproc.o
docgen gen-all-syms kernel-doc: FORCE
chmod 755 $@
clean:
rm -f *~ kconfig.tk *.o tkparse mkdep split-include docproc
include $(TOPDIR)/Rules.make
# we don't have automatic deps for host programs
tkparse.o tkcond.o tkgen.o: tkparse.h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment