Kbuild: fix out-of-tree builds

This commit is contained in:
Thomas Schoebel-Theuer 2015-10-28 17:11:46 +01:00
parent 867d0f1524
commit 5dd9f4b7b2
1 changed files with 28 additions and 25 deletions

View File

@ -2,6 +2,34 @@
# Makefile for MARS
#
# remove_this
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.
#
CONFIG_MARS_BIGMODULE := m
CONFIG_MARS_NET_COMPAT := y
obj-$(CONFIG_MARS_BIGMODULE) += mars.o
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
KBUILD_CFLAGS += -fdelete-null-pointer-checks
@ -101,28 +129,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.
#
CONFIG_MARS_BIGMODULE := m
obj-$(CONFIG_MARS_BIGMODULE) += mars.o
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