Browse Source

Convert configuration to new build system

Peter S. Mazinger 15 years ago
parent
commit
8852947daa
6 changed files with 153 additions and 144 deletions
  1. 4 10
      Makefile.in
  2. 2 1
      Makerules
  3. 4 22
      extra/Makefile
  4. 10 0
      extra/Makefile.in
  5. 4 111
      extra/config/Makefile
  6. 129 0
      extra/config/Makefile.in

+ 4 - 10
Makefile.in

@@ -35,11 +35,8 @@ include $(top_srcdir)extra/locale/Makefile.in
 # last included to catch all the objects added by others (locales/threads)
 include $(top_srcdir)libc/Makefile.in
 
-include/bits/uClibc_config.h: .config
+include/bits/uClibc_config.h: .config extra/config/conf
 	$(INSTALL) -d include/bits
-	@if [ ! -x extra/config/conf ] ; then \
-	    $(MAKE) -C extra/config conf; \
-	fi
 	@extra/config/conf -o $(top_srcdir)extra/Configs/Config.in
 
 # For the moment, we have to keep re-running this target 
@@ -251,11 +248,8 @@ endif # ifeq ($(HAVE_DOT_CONFIG),y)
 
 # configuration
 # ---------------------------------------------------------------------------
-extra/config/conf:
-	$(MAKE) -C extra/config conf
-
-extra/config/mconf:
-	$(MAKE) -C extra/config ncurses mconf
+extra/config/conf extra/config/mconf:
+	$(MAKE) -C extra/config $(notdir $@)
 
 menuconfig: extra/config/mconf
 	$(RM) -r include/bits
@@ -323,7 +317,7 @@ distclean: clean
 	-find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
 	$(RM) .config .config.old .config.cmd
 	$(RM) extra/locale/*.tgz
-	$(MAKE) -C extra/config clean
+	$(MAKE) -C extra/config config_clean
 
 dist release:
 	$(MAKE) -s distclean

+ 2 - 1
Makerules

@@ -89,7 +89,8 @@ define compile.u
 	$(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@))
 	$(STRIPTOOL) $(STRIP_FLAGS) $@
 endef
-hcompile.u = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(HOSTCFLAGS) $(HOSTCFLAGS-$(notdir $(^D))) $(HOSTCFLAGS-$(notdir $@))
+hcompile.u = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(HOSTCFLAGS) $(HOSTCFLAGS-$(notdir $(^D))) $(HOSTCFLAGS-$(notdir $@))
+hcompile.o = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -c -o $@ $(HOSTCFLAGS) $(HOSTCFLAGS-$(notdir $(^D))) $(HOSTCFLAGS-$(notdir $@))
 
 compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
 compile.E = $(cmd_compile.c:-c=-E)

+ 4 - 22
extra/Makefile

@@ -1,31 +1,13 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
 # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
+top_srcdir=../
 top_builddir=../
 include $(top_builddir)Rules.mak
-
-DIRS = 
-EXTRA_DIRS_TO_CLEAN = config
-
-all: subdirs
-
-tags:
-	ctags -R
-
-clean: subdirs_clean
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN))
-
-$(patsubst %, _dir_%, $(DIRS)) : dummy
-	$(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN)) : dummy
-	$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-
-.PHONY: dummy
+all: objs
+include Makefile.in
+include $(top_srcdir)Makerules

+ 10 - 0
extra/Makefile.in

@@ -0,0 +1,10 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+include $(top_srcdir)extra/locale/Makefile.in
+include $(top_srcdir)extra/config/Makefile.in

+ 4 - 111
extra/config/Makefile

@@ -5,116 +5,9 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
+top_srcdir=../../
 top_builddir=../../
 include $(top_builddir)Rules.mak
-
-all: ncurses conf mconf
-
-ifeq ($(shell uname),SunOS)
-LIBS = -lcurses
-else
-LIBS = -lncurses
-endif
-ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
-	HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
-else
-ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
-	HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
-else
-ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
-	HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
-else
-ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
-	HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
-else
-ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
-	HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
-else
-	HOSTNCURSES += -DCURSES_LOC="<curses.h>"
-endif
-endif
-endif
-endif
-endif
-
-CONF_SRC     = conf.c
-MCONF_SRC    = mconf.c
-LXD_SRC      = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
-               lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
-               lxdialog/msgbox.c
-SHARED_SRC   = zconf.tab.c
-SHARED_DEPS := lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
-CONF_OBJS    = $(patsubst %.c,%.o, $(CONF_SRC))
-MCONF_OBJS   = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
-SHARED_OBJS  = $(patsubst %.c,%.o, $(SHARED_SRC))
-
-conf: $(CONF_OBJS) $(SHARED_OBJS) 
-	$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
-
-mconf: $(MCONF_OBJS) $(SHARED_OBJS)
-	$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
-
-$(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
-
-$(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
-
-lkc_defs.h: lkc_proto.h
-	@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
-
-###
-# The following requires flex/bison
-# By default we use the _shipped versions, uncomment the 
-# following line if you are modifying the flex/bison src.
-#LKC_GENPARSER := 1
-
-ifdef LKC_GENPARSER
-
-%.tab.c %.tab.h: %.y
-	bison -t -d -v -b $* -p $(notdir $*) $<
-
-lex.%.c: %.l
-	flex -P$(notdir $*) -o$@ $<
-else
-
-lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
-
-lex.zconf.c: lex.zconf.c_shipped
-	cp lex.zconf.c_shipped lex.zconf.c
-
-zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
-
-zconf.tab.c: zconf.tab.c_shipped
-	cp zconf.tab.c_shipped zconf.tab.c
-
-zconf.tab.h: zconf.tab.h_shipped
-	cp zconf.tab.h_shipped zconf.tab.h
-endif
-
-.PHONY: ncurses
-
-ncurses:
-	@echo "main() {}" > lxtemp.c
-	@if $(HOSTCC) lxtemp.c $(LIBS) ; then \
-		$(RM) lxtemp.c a.out; \
-	else \
-		$(RM) lxtemp.c; \
-		echo -e "\007" ;\
-		echo ">> Unable to find the Ncurses libraries." ;\
-		echo ">>" ;\
-		echo ">> You must have Ncurses installed in order" ;\
-		echo ">> to use 'make menuconfig'" ;\
-		echo ">>" ;\
-		echo ">> Maybe you want to try 'make config', which" ;\
-		echo ">> doesn't depend on the Ncurses libraries." ;\
-		echo ;\
-		exit 1 ;\
-	fi
-
-clean:
-	$(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
-		conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
-
+all: objs
+include Makefile.in
+include $(top_srcdir)Makerules

+ 129 - 0
extra/config/Makefile.in

@@ -0,0 +1,129 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+ifeq ($(shell uname),SunOS)
+HOSTLIBNCURSES = -lcurses
+else
+HOSTLIBNCURSES = -lncurses
+endif
+ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
+	HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
+else
+ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
+	HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<curses.h>"
+else
+ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
+	HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
+else
+ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
+	HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<curses.h>"
+else
+ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
+	HOSTNCURSES = -DCURSES_LOC="<ncurses.h>"
+else
+	HOSTNCURSES = -DCURSES_LOC="<curses.h>"
+endif
+endif
+endif
+endif
+endif
+
+HOSTCFLAGS-config   := -I.
+
+HOSTCFLAGS-mconf.o  := $(HOSTNCURSES)
+HOSTCFLAGS-lxdialog := $(HOSTNCURSES)
+
+BUILD_LDFLAGS-mconf := $(HOSTLIBNCURSES)
+
+config_DIR := $(top_srcdir)extra/config
+config_OUT := $(top_builddir)extra/config
+
+config_SHIPPED_SRC := $(patsubst %,$(config_OUT)/%,lex.zconf.c zconf.tab.c zconf.tab.h)
+
+config_CONF_SRC    := conf.c
+config_MCONF_SRC   := mconf.c
+config_LXD_SRC := \
+		lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
+		lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
+		lxdialog/msgbox.c
+config_SHARED_SRC  := $(config_OUT)/zconf.tab.c
+config_SHARED_DEP1 := $(patsubst %,$(config_DIR)/%,lkc.h lkc_proto.h expr.h)
+config_SHARED_DEP2 := $(patsubst %,$(config_OUT)/%,lkc_defs.h zconf.tab.h)
+config_SHARED_DEPS := $(config_SHARED_DEP1) $(config_SHARED_DEP2)
+config_CONF_OBJS   := $(patsubst %.c,$(config_OUT)/%.o,$(config_CONF_SRC))
+config_MCONF_OBJS  := $(patsubst %.c,$(config_OUT)/%.o,$(config_MCONF_SRC) $(config_LXD_SRC))
+config_SHARED_OBJS := $(patsubst %.c,%.o,$(config_SHARED_SRC))
+
+objs: ncurses $(config_OUT)/conf $(config_OUT)/mconf
+
+conf $(config_OUT)/conf: $(config_CONF_OBJS) $(config_SHARED_OBJS)
+	$(hcompile.u)
+
+mconf $(config_OUT)/mconf: $(config_MCONF_OBJS) $(config_SHARED_OBJS) | ncurses
+	$(hcompile.u)
+
+$(config_CONF_OBJS) $(config_MCONF_OBJS): $(config_OUT)/%.o : $(config_DIR)/%.c | $(config_SHARED_DEPS)
+	$(hcompile.o)
+
+$(config_OUT)/lkc_defs.h: $(config_DIR)/lkc_proto.h
+	@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
+
+###
+# The following requires flex/bison
+# By default we use the _shipped versions, uncomment the 
+# following line if you are modifying the flex/bison src.
+#LKC_GENPARSER := 1
+
+ifdef LKC_GENPARSER
+
+%.tab.c %.tab.h: %.y
+	bison -t -d -v -b $* -p $(notdir $*) $<
+
+lex.%.c: %.l
+	flex -P$(notdir $*) -o$@ $<
+else
+
+$(config_OUT)/lex.zconf.o: $(config_OUT)/lex.zconf.c | $(config_SHARED_DEPS)
+	$(hcompile.o)
+
+$(config_SHIPPED_SRC): $(config_OUT)/% : $(config_DIR)/%_shipped
+	cp $< $@
+
+$(config_OUT)/zconf.tab.o: $(config_SHARED_SRC) | $(config_OUT)/lex.zconf.c $(patsubst %,$(config_DIR)/%,confdata.c expr.c symbol.c menu.c) $(config_SHARED_DEPS)
+	$(hcompile.o)
+
+endif
+
+.PHONY: ncurses
+
+ncurses:
+	@echo "main() {}" > $(config_OUT)/lxtemp.c
+	@if $(HOSTCC) $(config_OUT)/lxtemp.c -o $(config_OUT)/a.out $(HOSTLIBNCURSES) ; then \
+		$(RM) $(config_OUT)/{lxtemp.c,a.out}; \
+	else \
+		$(RM) $(config_OUT)/lxtemp.c; \
+		echo -e "\007" ;\
+		echo ">> Unable to find the Ncurses libraries." ;\
+		echo ">>" ;\
+		echo ">> You must have Ncurses installed in order" ;\
+		echo ">> to use 'make menuconfig'" ;\
+		echo ">>" ;\
+		echo ">> Maybe you want to try 'make config', which" ;\
+		echo ">> doesn't depend on the Ncurses libraries." ;\
+		echo ;\
+		exit 1 ;\
+	fi
+
+objclean-y += config_clean
+
+# to be removed after including into top Makefile.in
+clean: config_clean
+
+config_clean:
+	$(RM) $(config_OUT)/*.o $(config_SHIPPED_SRC) $(MCONF_OBJS) $(CONF_OBJS) \
+		conf mconf lkc_defs.h
+