summaryrefslogtreecommitdiff
path: root/extra/config/Makefile
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-08-17 19:17:00 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-08-17 19:17:00 +0200
commit49d8a0e9c6e32701c7eca91a1204237d3a334e38 (patch)
tree500e0c09a66970494dffbfe3a36f958762d22f99 /extra/config/Makefile
parent7f779e7937cca133ea5f2d18c154c6564516fd9f (diff)
support building out-of-tree
Handle O= Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'extra/config/Makefile')
-rw-r--r--extra/config/Makefile87
1 files changed, 64 insertions, 23 deletions
diff --git a/extra/config/Makefile b/extra/config/Makefile
index 836f1f9f1..7d8a1e4ad 100644
--- a/extra/config/Makefile
+++ b/extra/config/Makefile
@@ -1,45 +1,86 @@
-obj := .
-src := .
-top_srcdir=../../
-top_builddir=../../
-srctree := .
-include $(top_builddir)Rules.mak
+top_srcdir ?= ../../
-include Makefile.kconfig
+include $(top_srcdir)Rules.mak
+include $(top_srcdir)Makerules
+
+# ugh
+top_srcdir:=$(shell cd $(top_srcdir) && pwd)/
+ifdef O
+top_builddir ?= ../../
+else
+top_builddir = ../../
+endif
+srctree := $(top_srcdir)
+src := extra/config
+obj := $(top_builddir)$(src)
+
+generated := $(patsubst %_shipped,%,$(wildcard *_shipped))
+generated := $(addprefix $(obj)/,$(generated:.c=.o))
+
+include $(top_srcdir)extra/config/Makefile.kconfig
+PHONY += $(always)
+chk-lxdialog := $(top_srcdir)$(src)/lxdialog/check-lxdialog.sh
+check-lxdialog := cd $(obj) && $(chk-lxdialog)
+HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ccflags')
+HOST_LOADLIBES = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ldflags $(HOSTCC)')
+HOST_EXTRACFLAGS += -DLOCALE
+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) -c '$(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)')
+
+# do not create temporary object in the readonly srctree
+$(obj)/dochecklxdialog:
+ $(Q)cd $(obj) && $(CONFIG_SHELL) $(chk-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
+HOSTCFLAGS_lex.zconf.o := -I$(top_srcdir)$(src)
+HOSTCFLAGS_zconf.tab.o := -I$(top_srcdir)$(src)
+conf-objs := $(addprefix $(obj)/,$(conf-objs))
+mconf-objs := $(addprefix $(obj)/,$(mconf-objs))
+kxgettext-objs := $(addprefix $(obj)/,$(kxgettext-objs))
ifeq ($(findstring mconf,$(MAKECMDGOALS)),mconf)
hostprogs-y += mconf
endif
--include .depend
-.depend: $(wildcard *.h *.c)
- $(Q)$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > .depend 2>/dev/null || :
+#BUILD_CFLAGS-config = -W -Wall -pedantic
+#BUILD_CFLAGS-lxdialog = -W -Wall -pedantic
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
-host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
+host-csingle:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
-$(host-csingle): %: %.c
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $@
+conf mconf kxgettext: %: $(obj)/%
+$(obj)/conf $(obj)/mconf $(obj)/kxgettext: BUILD_LDFLAGS=$(HOST_LOADLIBES)
+$(obj)/conf: $(conf-objs)
+ $(hcompile.u)
+$(obj)/mconf: $(mconf-objs)
+ $(hcompile.u)
+$(obj)/kxgettext: $(kxgettext-objs)
+ $(hcompile.u)
-$(host-cmulti): %: $(host-cobjs) $(host-cshlib)
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $($@-objs) $(HOST_LOADLIBES) -o $@
+$(host-csingle) $(host-cmulti) $(host-cobjs): BUILD_CFLAGS=$(HOST_EXTRACFLAGS) \
+ $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F))
-$(host-cobjs): %.o: %.c
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) -c $< -o $@
+host-cobjs.nogen := $(filter-out $(generated),$(host-cobjs))
+host-cobjs.generated := $(filter $(generated),$(host-cobjs))
-$(obj)/%:: $(src)/%_shipped
- $(Q)cat $< > $@
+$(host-cobjs.nogen): $(obj)/%.o: $(top_srcdir)$(src)/%.c
+ $(hcompile.o)
+$(host-cobjs.generated): $(obj)/%.o: $(obj)/%.c
+ $(hcompile.o)
+ifndef LKC_GENPARSER
+$(obj)/%:: $(top_srcdir)$(src)/%_shipped
+ @$(disp_gen)
+ $(Q)cat $< > $@
+endif
clean:
- $(Q)rm -f $(clean-files) conf
+ $(do_rm) $(clean-files) conf
distclean: clean
- $(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \
+ $(do_rm) $(lxdialog) $(conf-objs) $(mconf-objs) \
+ $(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
.depend
- $(Q)rm -r -f $(top_builddir)include/config
+ $(do_rm) -r $(top_builddir)include/config
FORCE:
-.PHONY: FORCE clean distclean
+.PHONY: FORCE clean distclean $(always)