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)) ...@@ -12,17 +12,12 @@ EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook)) PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
C-procfs-example = procfs_example.sgml C-procfs-example = procfs_example.sgml
$(TOPDIR)/scripts/docgen: FORCE $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
chmod 755 $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc: doc-progs ;
$(TOPDIR)/scripts/gen-all-syms: FORCE .PHONY: doc-progs
chmod 755 $(TOPDIR)/scripts/gen-all-syms doc-progs:
@$(MAKE) -C $(TOPDIR)/scripts doc-progs
$(TOPDIR)/scripts/kernel-doc: FORCE
chmod 755 $(TOPDIR)/scripts/kernel-doc
$(TOPDIR)/scripts/docproc: FORCE
$(MAKE) -C $(TOPDIR)/scripts docproc
$(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \ $(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc $(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc
......
...@@ -263,6 +263,11 @@ include/linux/version.h: ./Makefile ...@@ -263,6 +263,11 @@ include/linux/version.h: ./Makefile
@echo Generating $@ @echo Generating $@
@. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL) @. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL)
# helpers built in scripts/
scripts/mkdep scripts/split-include : FORCE
@$(MAKE) -C scripts
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Generate dependencies # Generate dependencies
...@@ -361,15 +366,6 @@ endif # CONFIG_MODULES ...@@ -361,15 +366,6 @@ endif # CONFIG_MODULES
include Rules.make 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 # 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 HEADER=header.tk
TAIL=tail.tk TAIL=tail.tk
# Previous versions always remade kconfig.tk because they always depended # Previous versions always remade kconfig.tk because they always depended
# on soundscript. This runs fairly fast, and I can't find all the # 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. # Config.in files to depend on anyways. So I'll force it to remake.
kconfig.tk: FORCE kconfig.tk: $(TOPDIR)/arch/$(ARCH)/config.in tkparse $(HEADER) $(TAIL) FORCE
@echo Generating $@
kconfig.tk: ${TOPDIR}/Makefile ${TOPDIR}/arch/${ARCH}/config.in \ @( \
tkparse ${HEADER} ${TAIL} if [ -f /usr/local/bin/wish ]; then \
@if [ -f /usr/local/bin/wish ]; then \ echo '#!'"/usr/local/bin/wish -f"; \
echo '#!'"/usr/local/bin/wish -f" > kconfig.tk; \ else \
else \ echo '#!'"/usr/bin/wish -f"; \
echo '#!'"/usr/bin/wish -f" > kconfig.tk; \ fi; \
fi cat $(HEADER); \
cat ${HEADER} >> ./kconfig.tk ./tkparse < $<; \
./tkparse < ../arch/${ARCH}/config.in >> kconfig.tk echo "set defaults \"arch/${ARCH}/defconfig\""; \
echo "set defaults \"arch/${ARCH}/defconfig\"" >> kconfig.tk echo "set ARCH \"${ARCH}\""; \
echo "set ARCH \"${ARCH}\"" >> kconfig.tk cat $(TAIL) \
cat ${TAIL} >> kconfig.tk ) > $@
chmod 755 kconfig.tk chmod 755 $@
tkparse: tkparse.o tkcond.o tkgen.o tkparse: tkparse.o tkcond.o tkgen.o
${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o $(HOSTCC) -o $@ $^
tkparse.o: tkparse.c tkparse.h
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: doc-progs: docproc docgen gen-all-syms kernel-doc
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
docproc.o: docproc.c docproc: docproc.c
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c) $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
docproc: docproc.o docgen gen-all-syms kernel-doc: FORCE
${HOSTCC} -o docproc docproc.o chmod 755 $@
clean:
rm -f *~ kconfig.tk *.o tkparse mkdep split-include docproc
include $(TOPDIR)/Rules.make 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