Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. top_srcdir ?= ../../
  2. ifdef O
  3. top_builddir ?= ../../
  4. else
  5. top_builddir = ../../
  6. endif
  7. include $(top_srcdir)Rules.mak
  8. include $(top_srcdir)Makerules
  9. # ugh
  10. top_srcdir:=$(shell cd $(top_srcdir) && pwd)/
  11. src := extra/config
  12. obj := $(top_builddir)$(src)
  13. generated := $(patsubst %_shipped,%,$(wildcard *_shipped))
  14. generated := $(addprefix $(obj)/,$(generated:.c=.o))
  15. include $(top_srcdir)extra/config/Makefile.kconfig
  16. HOST_EXTRACFLAGS += -DCONFIG_='""'
  17. # do not create temporary object in the readonly srctree
  18. $(obj)/dochecklxdialog: CONFIG_SHELL:=cd $(obj) && $(CONFIG_SHELL)
  19. HOSTCFLAGS_zconf.lex.o := -I$(top_srcdir)$(src)
  20. HOSTCFLAGS_zconf.tab.o := -I$(top_srcdir)$(src)
  21. conf-objs := $(addprefix $(obj)/,$(conf-objs))
  22. mconf-objs := $(addprefix $(obj)/,$(mconf-objs))
  23. nconf-objs := $(addprefix $(obj)/,$(nconf-objs))
  24. kxgettext-objs := $(addprefix $(obj)/,$(kxgettext-objs))
  25. ifeq ($(findstring mconf,$(MAKECMDGOALS)),mconf)
  26. hostprogs-y += mconf
  27. endif
  28. ifeq ($(findstring nconf,$(MAKECMDGOALS)),nconf)
  29. hostprogs-y += nconf
  30. endif
  31. __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
  32. host-csingle:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
  33. host-cmulti := $(foreach m,$(__hostprogs),\
  34. $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
  35. host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
  36. conf mconf nconf kxgettext: %: $(obj)/%
  37. $(obj)/conf $(obj)/mconf $(obj)/nconf $(obj)/kxgettext: BUILD_LDFLAGS=$(HOSTLOADLIBES_$(@F))
  38. $(obj)/conf: $(conf-objs)
  39. $(hcompile.u)
  40. $(obj)/mconf: $(mconf-objs)
  41. $(hcompile.u)
  42. $(obj)/nconf: $(nconf-objs)
  43. $(hcompile.u)
  44. $(obj)/kxgettext: $(kxgettext-objs)
  45. $(hcompile.u)
  46. $(host-csingle) $(host-cmulti) $(host-cobjs): BUILD_CFLAGS+=$(HOST_EXTRACFLAGS) \
  47. $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F))
  48. host-cobjs.nogen := $(filter-out $(generated),$(host-cobjs))
  49. host-cobjs.generated := $(filter $(generated),$(host-cobjs))
  50. $(host-cobjs.nogen): $(obj)/%.o: $(top_srcdir)$(src)/%.c
  51. $(hcompile.o)
  52. $(host-cobjs.generated): $(obj)/%.o: $(obj)/%.c
  53. $(hcompile.o)
  54. # we use the pre-generated always
  55. $(obj)/%:: $(top_srcdir)$(src)/%_shipped
  56. @$(disp_gen)
  57. $(Q)cat $< > $@
  58. CLEAN_extra/config menuconfig_clean:
  59. $(do_rm) $(clean-files) $(lxdialog) conf $(wildcard *.o)
  60. distclean: CLEAN_extra/config
  61. $(Q)$(RM) -r $(lxdialog) $(conf-objs) $(mconf-objs) $(nconf-objs) \
  62. $(kxgettext-objs) \
  63. $(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
  64. .depend \
  65. $(top_builddir)include/config $(top_builddir)include/generated
  66. .PHONY: clean distclean $(PHONY)