kconfig: install compiled frontends

The kconfig frontends are currently instaleld as source files. This is
a remnant of the early times, when I wanted a single installation of
crosstool-NG to be shared across multiple machines, potentially of
different architectures.

This does not really make sense, and it's been a long time since it
was las tpossible in practice.

So, just build the kconfig frontends at make-time, and install them
as we do for all other crosstool-NG dependent files.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2012-01-14 18:22:06 +01:00
parent c8e39d6d29
commit cb7fcbe1ef
4 changed files with 184 additions and 192 deletions

View File

@ -39,29 +39,37 @@ all: Makefile build
# Configuration variables # Configuration variables
# Stuff found by ./configure # Stuff found by ./configure
DATE := @DATE@ export DATE := @DATE@
LOCAL := @enable_local@ export LOCAL := @enable_local@
PROG_SED := @program_transform_name@ export PROG_SED := @program_transform_name@
PACKAGE_TARNAME := @PACKAGE_TARNAME@ export PACKAGE_TARNAME := @PACKAGE_TARNAME@
VERSION := @PACKAGE_VERSION@ export VERSION := @PACKAGE_VERSION@
prefix := @prefix@ export prefix := @prefix@
exec_prefix := @exec_prefix@ export exec_prefix := @exec_prefix@
bindir := @bindir@ export bindir := @bindir@
libdir := @libdir@@sublibdir@ export libdir := @libdir@@sublibdir@
docdir := @docdir@@subdocdir@ export docdir := @docdir@@subdocdir@
datarootdir := @datarootdir@ export mandir := @mandir@
mandir := @mandir@ export datarootdir := @datarootdir@
install := @INSTALL@ export install := @INSTALL@
bash := @_BASH@ export bash := @_BASH@
grep := @EGREP@ export grep := @EGREP@
make := @MAKE@ export make := @MAKE@
sed := @SED@ export sed := @SED@
libtool := @LIBTOOL@ export libtool := @LIBTOOL@
libtoolize := @LIBTOOLIZE@ export libtoolize := @LIBTOOLIZE@
objcopy := @OBJCOPY@ export objcopy := @OBJCOPY@
objdump := @OBJDUMP@ export objdump := @OBJDUMP@
readelf := @READELF@ export readelf := @READELF@
patch := @PATCH@ export patch := @PATCH@
export CC := @CC@
export CPP := @CPP@
export CPPFLAGS := @CPPFLAGS@
export CFLAGS := @CFLAGS@
export LDFLAGS := @LDFLAGS@
export LIBS := @LIBS@
export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@
# config options to push down to kconfig # config options to push down to kconfig
KCONFIG:= @kconfig_options@ KCONFIG:= @kconfig_options@
@ -113,7 +121,7 @@ build install clean distclean mrproper uninstall:
else else
# There were no additional MAKEFLAGS to add, do the job # There were no additional MAKEFLAGS to add, do the job
TARGETS := bin lib doc man TARGETS := bin lib lib-kconfig doc man
build: $(patsubst %,build-%,$(TARGETS)) build: $(patsubst %,build-%,$(TARGETS))
@ -137,10 +145,17 @@ uninstall: real-uninstall
#-------------------------------------- #--------------------------------------
# Build rules # Build rules
build-bin: $(PROG_NAME) scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh build-bin: $(PROG_NAME) \
scripts/crosstool-NG.sh \
scripts/saveSample.sh \
scripts/showTuple.sh
@chmod 755 $^ @chmod 755 $^
build-lib: paths.mk config/configure.in build-lib: paths.mk \
config/configure.in
build-lib-kconfig:
@$(MAKE) -C kconfig
build-doc: build-doc:
@ -229,6 +244,9 @@ clean-lib:
@echo " RM 'config/configure.in'" @echo " RM 'config/configure.in'"
@rm -f config/configure.in @rm -f config/configure.in
clean-lib-kconfig:
@$(MAKE) -C kconfig clean
clean-doc: clean-doc:
clean-man: clean-man:
@ -263,9 +281,12 @@ install-bin: $(DESTDIR)$(bindir)
# installations of the same VERSION, thus the patches must be removed prior # installations of the same VERSION, thus the patches must be removed prior
# to being installed. It is simpler to remove the whole lib/ directory, as it # to being installed. It is simpler to remove the whole lib/ directory, as it
# is the goal of the install-lib rule to install the lib/ directory... # is the goal of the install-lib rule to install the lib/ directory...
install-lib: uninstall-lib $(DESTDIR)$(libdir) install-lib-main install-lib-samples install-lib: uninstall-lib \
$(DESTDIR)$(libdir) \
install-lib-main \
install-lib-samples
LIB_SUB_DIR := config contrib kconfig patches scripts LIB_SUB_DIR := config contrib patches scripts
$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir) $(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir)
@echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'" @echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \ @tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
@ -306,6 +327,13 @@ install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
done done
@$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk" @$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk"
KCONFIG_FILES := conf mconf nconf kconfig.mk
install-lib-kconfig: $(DESTDIR)$(libdir) install-lib-main
@echo " INST 'kconfig/'"
@for f in $(KCONFIG_FILES); do \
install -D "kconfig/$${f}" "$(DESTDIR)$(libdir)/kconfig/$${f}"; \
done
install-doc: $(DESTDIR)$(docdir) install-doc: $(DESTDIR)$(docdir)
@echo " INST 'docs/*.txt'" @echo " INST 'docs/*.txt'"
@for doc_file in docs/*.txt; do \ @for doc_file in docs/*.txt; do \

View File

@ -251,11 +251,27 @@ AC_HEADER_STDC
AC_FUNC_MALLOC AC_FUNC_MALLOC
AC_FUNC_REALLOC AC_FUNC_REALLOC
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
#----------------------------------------
# Check for gettext, for the kconfig frontends
AC_SUBST([gettext])
AC_CHECK_HEADERS(
[libintl.h],
[ac_ct_gettext_hdr=$ac_header; break])
AS_IF(
[test -n "$ac_ct_gettext_hdr"],
[AC_CHECK_DECL(
[gettext],gettext=y,,
[#include <$ac_ct_gettext_hdr>])])
#----------------------------------------
# Check for ncurses, for the kconfig frontends
AC_SUBST([ac_ct_curses_hdr])
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
[ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h], [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
[ac_ct_curses_hdr_found=yes; break]) [ac_ct_curses_hdr=$ac_header; break])
AS_IF( AS_IF(
[test -z "$ac_ct_curses_hdr_found"], [test -z "$ac_ct_curses_hdr"],
[AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])]) [AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])])
AC_SEARCH_LIBS( AC_SEARCH_LIBS(
[initscr], [initscr],

99
kconfig/Makefile Normal file
View File

@ -0,0 +1,99 @@
#-----------------------------------------------------------
# Hmmm! Cheesy build!
# Or: where I can unveil my make-fu... :-]
all: conf mconf nconf
@true # Just be silent, you fscking son of a fscking beach...
# Build flags
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
LDFLAGS =
# Compiler flags to use gettext
ifeq ($(gettext),)
INTL_CFLAGS = -DKBUILD_NO_NLS
endif
# Compiler and linker flags to use ncurses
NCURSES_CFLAGS = -DCURSES_LOC="\"$(curses_hdr)\""
NCURSES_LDFLAGS = $(LIBS)
# Common source files
COMMON_SRC = zconf.tab.c
COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS)
# lxdialog source files
LX_SRC = $(wildcard lxdialog/*.c)
LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
$(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
# What's needed to build 'conf'
conf_SRC = conf.c
conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
# What's needed to build 'mconf'
mconf_SRC = mconf.c
mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
$(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
mconf: LDFLAGS += $(NCURSES_LDFLAGS)
# What's needed to build 'nconf'
nconf_SRC = nconf.c nconf.gui.c
nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS)
nconf: LDFLAGS += -lmenu -lpanel -lncurses
# Under Cygwin, we need to auto-import some libs (which ones, exactly?)
# for mconf and nconf to lin properly.
ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
mconf: LDFLAGS += -Wl,--enable-auto-import
nconf: LDFLAGS += -Wl,--enable-auto-import
endif
# These are generated files:
ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
# Cheesy auto-dependencies
DEPS = $(COMMON_DEP)
DEPS += $(conf_DEP)
DEPS += $(mconf_DEP) $(LX_DEP)
DEPS += $(nconf_DEP)
-include $(DEPS)
# Build the dependency for C files
%.dep: %.c
@echo " DEP '$@'"
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
# Build C files
%.o: %.c
@echo " CC '$@'"
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
# Actual link
mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
@echo " LD '$@'"
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
nconf: $(COMMON_OBJ) $(nconf_OBJ)
@echo " LD '$@'"
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
conf: $(COMMON_OBJ) $(conf_OBJ)
@echo " LD '$@'"
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
#-----------------------------------------------------------
# Cleaning up the mess...
clean:
@echo " RM 'kconfig'"
@rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS)

View File

@ -2,9 +2,6 @@
# crosstool-NG configuration targets # crosstool-NG configuration targets
# These targets are used from top-level makefile # These targets are used from top-level makefile
# The place where the kconfig stuff lies
obj = kconfig
#----------------------------------------------------------- #-----------------------------------------------------------
# The configurators rules # The configurators rules
@ -13,17 +10,21 @@ PHONY += $(configurators)
$(configurators): config_files $(configurators): config_files
menuconfig: $(obj)/mconf CONF := $(CT_LIB_DIR)/kconfig/conf
@$(ECHO) " CONF $(KCONFIG_TOP)" MCONF := $(CT_LIB_DIR)/kconfig/mconf
$(SILENT)$< $(KCONFIG_TOP) NCONF := $(CT_LIB_DIR)/kconfig/nconf
nconfig: $(obj)/nconf menuconfig:
@$(ECHO) " CONF $(KCONFIG_TOP)" @$(ECHO) " CONF $(KCONFIG_TOP)"
$(SILENT)$< $(KCONFIG_TOP) $(SILENT)$(MCONF) $(KCONFIG_TOP)
oldconfig: $(obj)/conf .config nconfig:
@$(ECHO) " CONF $(KCONFIG_TOP)" @$(ECHO) " CONF $(KCONFIG_TOP)"
$(SILENT)$< --silent$@ $(KCONFIG_TOP) $(SILENT)$(NCONF) $(KCONFIG_TOP)
oldconfig: .config
@$(ECHO) " CONF $(KCONFIG_TOP)"
$(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP)
# Always be silent, the stdout an be >.config # Always be silent, the stdout an be >.config
extractconfig: extractconfig:
@ -48,155 +49,3 @@ help-config::
@echo ' oldconfig - Update current config using a provided .config as base' @echo ' oldconfig - Update current config using a provided .config as base'
@echo ' extractconfig - Extract to stdout the configuration items from a' @echo ' extractconfig - Extract to stdout the configuration items from a'
@echo ' build.log file piped to stdin' @echo ' build.log file piped to stdin'
#-----------------------------------------------------------
# Hmmm! Cheesy build!
# Or: where I can unveil my make-fu... :-]
# Oh! Files not here are there, in fact! :-)
vpath %.c $(CT_LIB_DIR)
vpath %.h $(CT_LIB_DIR)
# What is the compiler?
HOST_CC ?= gcc -funsigned-char
HOST_LD ?= gcc
# Helpers
check_gettext = $(CT_LIB_DIR)/kconfig/check.sh
check_lxdialog = $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh
# Build flags
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(CT_VERSION)\""
LDFLAGS =
# Compiler flags to use gettext
INTL_CFLAGS = $(shell $(SHELL) $(check_gettext) $(HOST_CC) $(EXTRA_CFLAGS))
# Compiler and linker flags to use ncurses
NCURSES_CFLAGS = $(shell $(SHELL) $(check_lxdialog) -ccflags)
NCURSES_LDFLAGS = $(shell $(SHELL) $(check_lxdialog) -ldflags $(HOST_CC))
# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
dochecklxdialog:
$(SILENT)$(SHELL) $(check_lxdialog) -check $(HOST_CC) $(NCURSES_CFLAGS) $(NCURSES_LDFLAGS)
# Common source files
COMMON_SRC = kconfig/zconf.tab.c
COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS)
# lxdialog source files
LX_SRC = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/kconfig/lxdialog/*.c))
LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
$(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
# What's needed to build 'conf'
conf_SRC = kconfig/conf.c
conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
# What's needed to build 'mconf'
mconf_SRC = kconfig/mconf.c
mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
$(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
$(obj)/mconf: LDFLAGS += $(NCURSES_LDFLAGS)
# What's needed to build 'nconf'
nconf_SRC = kconfig/nconf.c kconfig/nconf.gui.c
nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS)
$(obj)/nconf: LDFLAGS += -lmenu -lpanel -lncurses
# Under Cygwin, we need to auto-import some libs (which ones, exactly?)
# for mconf and nconf to lin properly.
ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
$(obj)/mconf: LDFLAGS += -Wl,--enable-auto-import
$(obj)/nconf: LDFLAGS += -Wl,--enable-auto-import
endif
# These are generated files:
ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
# Cheesy auto-dependencies
# Only parse the following if a configurator was called, to avoid building
# dependencies when not needed (eg. list-steps, list-samples...)
# We must be careful what we enclose, because we need some of the variable
# definitions for clean (and distclean) at least.
# Just protecting the "-include $(DEPS)" line should be sufficient.
# And in case we want menuconfig, we have to check that lxdialog
# can find a curses lib.
ifneq ($(strip $(MAKECMDGOALS)),)
ifneq ($(strip $(filter $(configurators),$(MAKECMDGOALS))),)
DEPS = $(COMMON_DEP)
ifneq ($(strip $(filter oldconfig,$(MAKECMDGOALS))),)
DEPS += $(conf_DEP)
endif
ifneq ($(strip $(filter menuconfig,$(MAKECMDGOALS))),)
DEPS += $(mconf_DEP) $(LX_DEP)
$(COMMON_OBJ) $(COMMON_DEP): |dochecklxdialog
$(LX_OBJ) $(LX_DEP): |dochecklxdialog
$(mconf_OBJ) $(mconf_DEP): |dochecklxdialog
endif
ifneq ($(strip $(filter nconfig,$(MAKECMDGOALS))),)
DEPS += $(nconf_DEP)
endif
-include $(DEPS)
endif # MAKECMDGOALS contains a configurator rule
endif # MAKECMDGOALS != ""
# Each .o or .dep *can not* directly depend on kconfig/, because kconfig can
# be touched during the build (who's touching it, btw?) so each .o or .dep
# would be re-built when it should not be.
# So manually check for presence of $(obj) (ie. kconfig), and only mkdir
# if needed. After all, that's not so bad...
# mkdir $(obj)/lxdialog, because we need it, and incidentally, that
# also creates $(obj).
define check_kconfig_dir
$(SILENT)if [ ! -d $(obj)/lxdialog ]; then \
$(ECHO) " MKDIR $(obj)"; \
mkdir -p $(obj)/lxdialog; \
fi
endef
# Build the dependency for C files
%.dep: %.c $(CT_LIB_DIR)/kconfig/kconfig.mk
$(check_kconfig_dir)
@$(ECHO) " DEP $@"
$(SILENT)$(HOST_CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
# Build C files
%.o: %.c $(CT_LIB_DIR)/kconfig/kconfig.mk
$(check_kconfig_dir)
@$(ECHO) " CC $@"
$(SILENT)$(HOST_CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
# Actual link
$(obj)/mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
@$(ECHO) ' LD $@'
$(SILENT)$(HOST_LD) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
$(obj)/nconf: $(COMMON_OBJ) $(nconf_OBJ)
@$(ECHO) ' LD $@'
$(SILENT)$(HOST_LD) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
$(obj)/conf: $(COMMON_OBJ) $(conf_OBJ)
@$(ECHO) ' LD $@'
$(SILENT)$(HOST_LD) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
#-----------------------------------------------------------
# Cleaning up the mess...
clean::
@$(ECHO) " CLEAN kconfig"
$(SILENT)rm -f kconfig/{,m,n}conf{,.exe} $(ALL_OBJS) $(ALL_DEPS)
$(SILENT)rmdir --ignore-fail-on-non-empty kconfig{/lxdialog,} 2>/dev/null || true