diff --git a/kernel/Kbuild b/kernel/Kbuild index 270b9c54..44b7c19d 100644 --- a/kernel/Kbuild +++ b/kernel/Kbuild @@ -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