Makefile 2.7 KB

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