mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
kbuild: asm symlink support for arch/$ARCH/include
Adjust the asm symlink support so we do not create the symlink unless really needed. We check the precense of include/asm-$ARCH by checking for the system.h file. We may end up with a stale directory so it is not enough to check if the directory is present. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
a53ce098a7
commit
2e57d05116
2 changed files with 29 additions and 16 deletions
3
Kbuild
3
Kbuild
|
@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
|
||||||
# 2) Generate asm-offsets.h
|
# 2) Generate asm-offsets.h
|
||||||
#
|
#
|
||||||
|
|
||||||
offsets-file := include/asm-$(SRCARCH)/asm-offsets.h
|
offsets-file := include/asm/asm-offsets.h
|
||||||
|
|
||||||
always += $(offsets-file)
|
always += $(offsets-file)
|
||||||
targets += $(offsets-file)
|
targets += $(offsets-file)
|
||||||
|
@ -81,7 +81,6 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
|
||||||
$(call if_changed_dep,cc_s_c)
|
$(call if_changed_dep,cc_s_c)
|
||||||
|
|
||||||
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
|
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
|
||||||
$(Q)mkdir -p $(dir $@)
|
|
||||||
$(call cmd,offsets)
|
$(call cmd,offsets)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
42
Makefile
42
Makefile
|
@ -925,7 +925,9 @@ ifneq ($(KBUILD_SRC),)
|
||||||
/bin/false; \
|
/bin/false; \
|
||||||
fi;
|
fi;
|
||||||
$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
|
$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
|
||||||
$(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm
|
$(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
|
||||||
|
ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
|
||||||
|
fi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# prepare2 creates a makefile if using a separate output directory
|
# prepare2 creates a makefile if using a separate output directory
|
||||||
|
@ -951,22 +953,34 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
|
||||||
|
|
||||||
# The asm symlink changes when $(ARCH) changes.
|
# The asm symlink changes when $(ARCH) changes.
|
||||||
# Detect this and ask user to run make mrproper
|
# Detect this and ask user to run make mrproper
|
||||||
|
define check-symlink
|
||||||
include/asm: FORCE
|
set -e; \
|
||||||
$(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
|
if [ -L include/asm ]; then \
|
||||||
if [ -L include/asm ]; then \
|
asmlink=`readlink include/asm | cut -d '-' -f 2`; \
|
||||||
if [ "$$asmlink" != "$(SRCARCH)" ]; then \
|
if [ "$$asmlink" != "$(SRCARCH)" ]; then \
|
||||||
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
|
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
|
||||||
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
|
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
else \
|
|
||||||
echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
|
|
||||||
if [ ! -d include ]; then \
|
|
||||||
mkdir -p include; \
|
|
||||||
fi; \
|
|
||||||
ln -fsn asm-$(SRCARCH) $@; \
|
|
||||||
fi
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
# We create the target directory of the symlink if it does
|
||||||
|
# not exist so the test in chack-symlink works and we have a
|
||||||
|
# directory for generated filesas used by some architectures.
|
||||||
|
define create-symlink
|
||||||
|
if [ ! -L include/asm ]; then \
|
||||||
|
echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
|
||||||
|
if [ ! -d include/asm-$(SRCARCH) ]; then \
|
||||||
|
mkdir -p include/asm-$(SRCARCH); \
|
||||||
|
fi; \
|
||||||
|
ln -fsn asm-$(SRCARCH) $@; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
include/asm: FORCE
|
||||||
|
$(Q)$(check-symlink)
|
||||||
|
$(Q)$(create-symlink)
|
||||||
|
|
||||||
# Generate some files
|
# Generate some files
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue