Kbuild: fix external 1&1 build process

This commit is contained in:
Thomas Schoebel-Theuer 2016-03-03 12:42:41 +01:00
parent 669d73e602
commit 04b2f2120e
1 changed files with 29 additions and 25 deletions

View File

@ -4,6 +4,35 @@
KBUILD_CFLAGS += -fdelete-null-pointer-checks
# remove_this
# The following is 1&1 specific. Don't use anywhere else.
ifneq ($(KBUILD_EXTMOD),)
CONFIG_MARS := m
# mars_config.h is generated by a simple Kconfig parser (gen_config.pl)
# at build time.
# It does not respect any Kconfig dependencies.
# Therefore, it is unsafe. Use at your own risk!
# It is ONLY used for out-of-tree builds.
#
extra-y += mars_config.h
GEN_CONFIG_SCRIPT := $(src)/../scripts/gen_config.pl
$(obj)/mars_config.h: $(obj)/buildtag.h
$(obj)/mars_config.h: $(src)/Kconfig $(GEN_CONFIG_SCRIPT)
$(Q)$(kecho) "MARS: using compiler $($(CC) --version | head -1)"
$(CC) -v
$(Q)$(kecho) "MARS: Generating $@"
$(Q)set -e; \
if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \
$(kecho) "MARS: cannot execute script $(GEN_CONFIG_SCRIPT)"; \
/bin/false; \
fi; \
cat $< | $(GEN_CONFIG_SCRIPT) > $@;
cat $@;
endif
# end_remove_this
obj-$(CONFIG_MARS) += mars.o
mars-objs := \
lamport.o \
brick_say.o \
@ -29,8 +58,6 @@ mars-objs := \
sy_old/mars_proc.o \
sy_old/mars_main.o
obj-$(CONFIG_MARS) += mars.o
ifdef CONFIG_DEBUG_KERNEL
KBUILD_CFLAGS += -fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once
@ -76,26 +103,3 @@ $(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(ob
/bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\
/bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\""
cat $@;
ifndef CONFIG_MARS
# mars_config.h is generated by a simple Kconfig parser (gen_config.pl)
# at build time.
# It does not respect any Kconfig dependencies.
# Therefore, it is unsafe. Use at your own risk!
# It is ONLY used for out-of-tree builds.
#
extra-y += mars_config.h
GEN_CONFIG_SCRIPT := $(src)/../scripts/gen_config.pl
$(obj)/mars_config.h: $(obj)/buildtag.h
$(obj)/mars_config.h: $(src)/Kconfig $(GEN_CONFIG_SCRIPT)
$(Q)$(kecho) "MARS: using compiler $($(CC) --version | head -1)"
$(CC) -v
$(Q)$(kecho) "MARS: Generating $@"
$(Q)set -e; \
if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \
$(kecho) "MARS: cannot execute script $(GEN_CONFIG_SCRIPT)"; \
/bin/false; \
fi; \
cat $< | $(GEN_CONFIG_SCRIPT) > $@;
cat $@;
endif