On Thu, 4 Jun 1998, Michael Elizabeth Chastain wrote:
> Ion writes:
>
> > I have another patch waiting, it implements smart dependencies based on
> > Michael Chastain's 2.1 version. It's really convenient - it literally
> > saves hours of compile time - but since it touches so many files and could
> > potentially break stuff, it's better to wait for .35 before putting it in.
>
> It is convenient and it does save hours of compile time. But I think
> it's a new feature, and as a new feature, it doesn't belong in 2.0.XX.
>
> Of course I defer to Alan Cox as the arbiter of what belongs in 2.0.XX.
Absolutely, it's up to Alan to decide whether it belongs in the official
tree or not. At least I know that I will apply it to every single kernel
tree I use.. :-)
Since 2.0.34final is out, here comes the second patch. Michael deserves
all (or most) of the credit for it, I was just the humble porter to 2.0.
:)
Thanks,
Ion
-- It is better to keep your mouth shut and be thought a fool, than to open it and remove all doubt. ------------------------------------------------ diff -urN linux-2.0.34pre16/Makefile linux-2.0.34/Makefile --- linux-2.0.34pre16/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/Makefile Sat May 30 02:31:44 1998 @@ -39,6 +39,7 @@ NM =$(CROSS_COMPILE)nm STRIP =$(CROSS_COMPILE)strip MAKE =make +GENKSYMS=/sbin/genksyms all: do-it-all @@ -182,19 +183,24 @@ rm -f include/asm ( cd include ; ln -sf asm-$(ARCH) asm) -oldconfig: symlinks +oldconfig: symlinks scripts/split-include + $(MAKE) -C drivers/sound mkscript $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in + scripts/split-include include/linux/autoconf.h include/config -xconfig: symlinks +xconfig: symlinks scripts/split-include $(MAKE) -C scripts kconfig.tk wish -f scripts/kconfig.tk + scripts/split-include include/linux/autoconf.h include/config -menuconfig: include/linux/version.h symlinks +menuconfig: include/linux/version.h symlinks scripts/split-include $(MAKE) -C scripts/lxdialog all $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in + scripts/split-include include/linux/autoconf.h include/config -config: symlinks +config: symlinks scripts/split-include $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in + scripts/split-include include/linux/autoconf.h include/config linuxsubdirs: dummy set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done @@ -312,8 +318,9 @@ clean: archclean rm -f kernel/ksyms.lst include/linux/compile.h - rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print` - rm -f core `find . -type f -name 'core' -print` + rm -f `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print` + rm -f `find . -type f -name 'core' -print` + rm -f `find . -name '.*.flags' -print` rm -f vmlinux System.map rm -f .tmp* drivers/sound/configure rm -fr modules/* @@ -321,15 +328,16 @@ mrproper: clean rm -f include/linux/autoconf.h include/linux/version.h - rm -f drivers/sound/local.h drivers/sound/.defines + rm -f drivers/sound/local_config drivers/sound/.defines rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash rm -f .version .config* config.in config.old rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog rm -f .menuconfig .menuconfig.log rm -f include/asm + rm -rf include/config rm -f .depend `find . -name .depend -print` - rm -f .hdepend scripts/mkdep + rm -f .hdepend scripts/mkdep scripts/split-include rm -f $(TOPDIR)/include/linux/modversions.h rm -f $(TOPDIR)/include/linux/modules/* @@ -347,10 +355,9 @@ find . -type f -print | sort | xargs sum > .SUMS dep-files: scripts/mkdep archdep include/linux/version.h - scripts/mkdep init/*.c > .tmpdepend + scripts/mkdep init/*.c > .depend scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done - mv .tmpdepend .depend MODVERFILE := @@ -360,6 +367,9 @@ depend dep: dep-files $(MODVERFILE) +checkconfig: + perl -w scripts/checkconfig.pl `find $(FINDHPATH) $(SUBDIRS) -name '*.[hcS]' -print | sort` + ifdef CONFIGURATION ..$(CONFIGURATION): @echo @@ -388,3 +398,6 @@ scripts/mkdep: scripts/mkdep.c $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c + +scripts/split-include: scripts/split-include.c + $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c diff -urN linux-2.0.34pre16/Rules.make linux-2.0.34/Rules.make --- linux-2.0.34pre16/Rules.make Sat May 30 15:44:08 1998 +++ linux-2.0.34/Rules.make Sat May 30 14:34:39 1998 @@ -42,10 +42,15 @@ # %.s: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@ %.o: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $< + @ ( \ + echo 'ifeq ($(strip $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@)),$$(strip $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@)))' ; \ + echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ + echo 'endif' \ + ) > .$@.flags %.o: %.s $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $< @@ -60,30 +65,39 @@ # ifdef O_TARGET ALL_O = $(OX_OBJS) $(O_OBJS) -$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h +$(O_TARGET): $(ALL_O) rm -f $@ ifneq "$(strip $(ALL_O))" "" $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O) else $(AR) rcs $@ endif -endif + @ ( \ + echo 'ifeq ($(strip $(EXTRA_LDFLAGS) $(ALL_O)),$$(strip $$(EXTRA_LDFLAGS) $$(ALL_O)))' ; \ + echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ + echo 'endif' \ + ) > .$@.flags +endif # O_TARGET # # Rule to compile a set of .o files into one .a file # ifdef L_TARGET -$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h +$(L_TARGET): $(LX_OBJS) $(L_OBJS) rm -f $@ $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS) + @ ( \ + echo 'ifeq ($(strip $(EXTRA_ARFLAGS) $(LX_OBJS) $(L_OBJS)),$$(strip $$(EXTRA_ARFLAGS) $$(LX_OBJS) $$(L_OBJS)))' ; \ + echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ + echo 'endif' \ + ) > .$@.flags endif # # This make dependencies quickly # fastdep: dummy - if [ -n "$(wildcard *.[chS])" ]; then \ - $(TOPDIR)/scripts/mkdep *.[chS] > .depend; fi + $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend; ifdef ALL_SUB_DIRS set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done endif @@ -120,7 +134,7 @@ ifneq "$(strip $(ALL_MOBJS))" "" echo $(PDWN) cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \ - ln -sf ../$(PDWN)/$$i .; done + ln -sf ../$(PDWN)/$$i $$i; done endif # @@ -140,59 +154,105 @@ # Separate the object into "normal" objects and "exporting" objects # Exporting objects are: all objects that define symbol tables # -ifdef CONFIG_MODVERSIONS +ifdef CONFIG_MODULES + SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) + +ifdef CONFIG_MODVERSIONS ifneq "$(strip $(SYMTAB_OBJS))" "" MODINCL = $(TOPDIR)/include/linux/modules # The -w option (enable warnings) for /bin/genksyms will return here in 2.1 $(MODINCL)/%.ver: %.c - @if [ ! -x /sbin/genksyms ]; then echo "Please read: Documentation/modules.txt"; fi - $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms $(MODINCL) + @if [ ! -x $(GENKSYMS) ]; then echo "Please read: Documentation/modules.txt"; fi + $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | $(GENKSYMS) $(MODINCL) $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h $(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) @echo updating $(TOPDIR)/include/linux/modversions.h - @(echo "#ifdef MODVERSIONS";\ - echo "#undef CONFIG_MODVERSIONS";\ - echo "#define CONFIG_MODVERSIONS";\ - echo "#ifndef _set_ver";\ - echo "#define _set_ver(sym,vers) sym ## _R ## vers";\ - echo "#endif";\ - cd $(TOPDIR)/include/linux/modules; for f in *.ver;\ - do echo "#include <linux/modules/$${f}>"; done; \ - echo "#undef CONFIG_MODVERSIONS";\ - echo "#endif") \ - > $(TOPDIR)/include/linux/modversions.h - -$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h - $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c) - -$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h - $(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c) + @(echo "#ifndef _LINUX_MODVERSIONS_H";\ + echo "#define _LINUX_MODVERSIONS_H"; \ + echo "#include <linux/modsetver.h>"; \ + cd $(TOPDIR)/include/linux/modules; \ + for f in *.ver; do \ + if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \ + done; \ + echo "#endif"; \ + ) > $@ dep fastdep: $(TOPDIR)/include/linux/modversions.h -endif +endif # SYMTAB_OBJS + $(M_OBJS): $(TOPDIR)/include/linux/modversions.h ifdef MAKING_MODULES $(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h endif -# This is needed to ensure proper dependency for multipart modules such as -# fs/ext.o. (Otherwise, not all subobjects will be recompiled when -# version information changes.) + +else # CONFIG_MODVERSIONS + +$(TOPDIR)/include/linux/modversions.h: + @(echo "#ifndef _LINUX_MODVERSIONS_H";\ + echo "#define _LINUX_MODVERSIONS_H"; \ + echo "#include <linux/modsetver.h>"; \ + echo "#endif"; \ + ) > $@ + +endif # CONFIG_MODVERSIONS + +ifneq "$(strip $(SYMTAB_OBJS))" "" +$(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(SYMTAB_OBJS:.o=.c) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c) + @ ( \ + echo 'ifeq ($(strip $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB),$$(strip $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB))' ; \ + echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ + echo 'endif' \ + ) > .$@.flags endif +endif # CONFIG_MODULES + + # -# include dependency files they exist +# include dependency files if they exist # -ifeq (.depend,$(wildcard .depend)) +ifneq ($(wildcard .depend),) include .depend endif -ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend)) +ifneq ($(wildcard $(TOPDIR)/.hdepend),) include $(TOPDIR)/.hdepend +endif + + +# +# Find files whose flags have changed and force recompilation. +# For safety, this works in the converse direction: +# every file is forced, except those whose flags are positively up-to-date. +# +FILES_FLAGS_UP_TO_DATE := + +FILES_FLAGS_EXIST := $(wildcard .*.flags) +ifneq ($(FILES_FLAGS_EXIST),) +include $(FILES_FLAGS_EXIST) +endif + +FILES_FLAGS_CHANGED := $(strip \ + $(filter-out $(FILES_FLAGS_UP_TO_DATE), \ + $(O_TARGET) $(O_OBJS) $(OX_OBJS) \ + $(L_TARGET) $(L_OBJS) $(LX_OBJS) \ + $(M_OBJS) $(MX_OBJS) \ + )) + +# A kludge: .S files don't get flag dependencies (yet), +# because that will involve changing a lot of Makefiles. +FILES_FLAGS_CHANGED := $(strip \ + $(filter-out $(patsubst %.S, %.o, $(wildcard *.S)), \ + $(FILES_FLAGS_CHANGED))) + +ifneq ($(FILES_FLAGS_CHANGED),) +$(FILES_FLAGS_CHANGED): dummy endif diff -urN linux-2.0.34pre16/drivers/net/CONFIG linux-2.0.34/drivers/net/CONFIG --- linux-2.0.34pre16/drivers/net/CONFIG Sat May 30 15:44:08 1998 +++ linux-2.0.34/drivers/net/CONFIG Fri May 29 23:08:23 1998 @@ -86,16 +86,7 @@ # The 8390 drivers share the EI_DEBUG setting. # General options for Space.c -OPTS = # -DETH0_ADDR=0x300 -DETH0_IRQ=11 - -WD_OPTS = #-DWD_SHMEM=0xDD000 -EL2_OPTS = #-DEL2_AUI -NE_OPTS = -HP_OPTS = -PLIP_OPTS = -DEPCA_OPTS = -EWRK3_OPTS = -DE4X5_OPTS = -DDE4X5_AUTOSENSE=AUTO -DEFXX_OPTS = -ELP_OPTS = -TULIP_OPTS = +CONFIG_Space.o = # -DETH0_ADDR=0x300 -DETH0_IRQ=11 +CONFIG_3c503.o = # -DEL2_AUI +CONFIG_de4x5.o = -DDE4X5_AUTOSENSE=AUTO +CONFIG_wd.o = # -DWD_SHMEM=0xDD000 diff -urN linux-2.0.34pre16/drivers/net/Makefile linux-2.0.34/drivers/net/Makefile --- linux-2.0.34pre16/drivers/net/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/drivers/net/Makefile Fri May 29 23:08:23 1998 @@ -599,70 +599,3 @@ clean: rm -f core *.o *.a *.s - -wd.o: wd.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $< - -3c503.o: 3c503.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $< - -pi2.o: pi2.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $< - -3c505.o: 3c505.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(ELP_OPTS) -c $< - -de4x5.o: de4x5.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(DE4X5_OPTS) -c $< - -defxx.o: defxx.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFXX_OPTS) -c $< - -ewrk3.o: ewrk3.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(EWRK3_OPTS) -c $< - -depca.o: depca.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $< - -Space.o: Space.c ../../include/linux/autoconf.h CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(OPTS) -c $< - -net_init.o: ../../include/linux/autoconf.h - -ne.o: ne.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $< - -hp.o: hp.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $< - -plip.o: plip.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $< - -slip.o: slip.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< - -strip.o: strip.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< - -dummy.o: dummy.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< - -de600.o: de600.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $< - -de620.o: de620.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $< - -lance.o: lance.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(LANCE_OPTS) -c $< - -8390.o: 8390.c 8390.h CONFIG - -sdla.o: sdla.c CONFIG - -dlci.o: dlci.c CONFIG - -dgrs.o: dgrs.c dgrs.h CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -tulip.o: tulip.c CONFIG - $(CC) $(CPPFLAGS) $(CFLAGS) $(TULIP_OPTS) -c $< diff -urN linux-2.0.34pre16/drivers/scsi/Makefile linux-2.0.34/drivers/scsi/Makefile --- linux-2.0.34pre16/drivers/scsi/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/drivers/scsi/Makefile Fri May 29 23:12:06 1998 @@ -18,8 +18,11 @@ MOD_LIST_NAME := SCSI_MODULES SCSI_SRCS = $(wildcard $(L_OBJS:%.o=%.c)) -AHA152X = -DDEBUG_AHA152X -DAUTOCONF -GDTH = #-DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS +CFLAGS_aha152x.o = -DDEBUG_AHA152X -DAUTOCONF +CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS +CFLAGS_seagate.o = -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -DPARITY +CFLAGS_g_NCR5380.o = -DGENERIC_NCR5380_OVERRIDE="{{(NCR5380_map_type)0x350,5,0, BOARD_NCR53C400}};" + .SUFFIXES: .SUFFIXES: .c .o .h .a @@ -370,30 +373,12 @@ include $(TOPDIR)/Rules.make -aha152x.o: aha152x.c - $(CC) $(CFLAGS) $(AHA152X) -c aha152x.c - -gdth.o: gdth.c gdth.h gdth_proc.c gdth_proc.h - $(CC) $(CFLAGS) $(GDTH) -c gdth.c - -aic7xxx.o: aic7xxx.c aic7xxx_seq.h aic7xxx_reg.h - $(CC) $(CFLAGS) -c -o $@ aic7xxx.c - -seagate.o: seagate.c - $(CC) $(CFLAGS) -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -c seagate.c - -tmscsim.o : tmscsim.c - $(CC) $(CFLAGS) -c tmscsim.c - 53c8xx_d.h 53c8xx_u.h : 53c7,8xx.scr script_asm.pl ln -sf 53c7,8xx.scr fake.c $(CPP) -traditional -DCHIP=810 fake.c | grep -v '^#' | perl script_asm.pl mv script.h 53c8xx_d.h mv scriptu.h 53c8xx_u.h rm fake.c - -g_NCR5380.o: g_NCR5380.c - $(CC) $(CFLAGS) -DGENERIC_NCR5380_OVERRIDE="{{(NCR5380_map_type)0x350,5,0, BOARD_NCR53C400}};" -c g_NCR5380.c scsi_mod.o: $(MX_OBJS) hosts.o scsi.o scsi_ioctl.o constants.o \ scsicam.o scsi_proc.o diff -urN linux-2.0.34pre16/drivers/sound/Makefile linux-2.0.34/drivers/sound/Makefile --- linux-2.0.34pre16/drivers/sound/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/drivers/sound/Makefile Sat May 30 02:27:13 1998 @@ -40,12 +40,9 @@ cp sound.o $(MODULEDIR) endif -.c.o: - $(CC) $(CFLAGS) -c $< - ifeq ($(CONFIG_SOUND),y) -all: local.h sound.a +all: local_config sound.a OBJS += $(FIXEDOBJS) @@ -68,7 +65,6 @@ sound.a: $(OBJS) -rm -f sound.a $(AR) rcs sound.a $(OBJS) - sync clean: rm -f core core.* *.o *.a tmp_make *~ x y z *% @@ -78,7 +74,7 @@ indent: for n in *.c;do echo indent $$n;indent $$n;done -local.h: +local_config: $(MAKE) clean $(MAKE) setup-$(TARGET_OS) $(MAKE) oldconfig @@ -94,58 +90,73 @@ config: configure @$(MAKE) setup-$(TARGET_OS) - @./configure > local.h - @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h - @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h -# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null -# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null - @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + @./configure > local_config.new + @if ! cmp local_config local_config.new; then + @ rm -f local_config + @ mv local_config.new local_config + @ echo \#define SOUND_CONFIG_DATE \"`date`\" >> local_config + @ echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local_config +# @ echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local_config 2>/dev/null +# @ echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local_config 2>/dev/null + @ echo \#define SOUND_UNAME_A \"`uname -a`\" >> local_config + @else + @ rm -f local_config.new + @fi oldconfig: setup-$(TARGET_OS) configure - @./configure -o > local.h - @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h - @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h -# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null -# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null - @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + @./configure -o > local_config.new + @if ! cmp local_config local_config.new; then + @ rm -f local_config + @ mv local_config.new local_config + @ echo \#define SOUND_CONFIG_DATE \"`date`\" >> local_config + @ echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local_config +# @ echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local_config 2>/dev/null +# @ echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local_config 2>/dev/null + @ echo \#define SOUND_UNAME_A \"`uname -a`\" >> local_config + @else + @ rm -f local_config.new + @fi kernelconfig: setup-$(TARGET_OS) rm -f configure $(HOSTCC) -o configure configure.c - ./configure fixedlocal > local.h + ./configure fixedlocal > local_config.new ./configure fixeddefines > .defines - @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h - @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h -# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null -# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null - @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + @if ! cmp local_config local_config.new; then + @ rm -f local_config + @ mv local_config.new local_config + @ echo \#define SOUND_CONFIG_DATE \"`date`\" >> local_config + @ echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local_config +# @ echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local_config 2>/dev/null +# @ echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local_config 2>/dev/null + @ echo \#define SOUND_UNAME_A \"`uname -a`\" >> local_config + @else + @ rm -f local_config.new + @fi mkscript: setup-$(TARGET_OS) rm -f configure $(HOSTCC) -o configure configure.c ./configure script > Config.in cat lowlevel/Config.tmpl >> Config.in - ./configure fixedlocal > local.h + ./configure fixedlocal > local_config ./configure fixeddefines > .defines clrconf: - rm -f local.h .depend synth-ld.h trix_boot.h smw-midi0001.h maui_boot.h .defines + rm -f local_config .depend synth-ld.h trix_boot.h smw-midi0001.h maui_boot.h .defines configure: configure.c $(HOSTCC) -o configure configure.c @cat .blurb -dep: - $(CPP) -M *.c > .depend - setup-linux: @echo Compiling Sound Driver v $(VERSION) for Linux -sound.o: local.h $(FIXEDOBJS) sound.a +sound.o: local_config $(FIXEDOBJS) sound.a -rm -f sound.o $(LD) -r -o sound.o $(FIXEDOBJS) sound.a -modules: local.h sound.o +modules: local_config sound.o ln -fs `pwd`/sound.o $(TOPDIR)/modules/sound.o diff -urN linux-2.0.34pre16/drivers/sound/sound_config.h linux-2.0.34/drivers/sound/sound_config.h --- linux-2.0.34pre16/drivers/sound/sound_config.h Sat May 30 15:44:08 1998 +++ linux-2.0.34/drivers/sound/sound_config.h Sat May 30 02:28:09 1998 @@ -11,7 +11,7 @@ */ -#include "local.h" +#include "local_config" #include "os.h" #include "soundvers.h" diff -urN linux-2.0.34pre16/fs/ncpfs/Makefile linux-2.0.34/fs/ncpfs/Makefile --- linux-2.0.34pre16/fs/ncpfs/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/fs/ncpfs/Makefile Fri May 29 23:08:23 1998 @@ -12,10 +12,8 @@ M_OBJS := $(O_TARGET) # If you want debugging output, please uncomment the following line - # EXTRA_CFLAGS += -DDEBUG_NCP=1 -include $(TOPDIR)/Rules.make +CFLAGS_ncplib_kernel.o := -finline-functions -ncplib_kernel.o: ncplib_kernel.c ncplib_kernel.h - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -finline-functions -c -o $@ $< +include $(TOPDIR)/Rules.make diff -urN linux-2.0.34pre16/include/linux/config.h linux-2.0.34/include/linux/config.h --- linux-2.0.34pre16/include/linux/config.h Sat May 30 15:44:08 1998 +++ linux-2.0.34/include/linux/config.h Sat May 30 00:14:42 1998 @@ -3,30 +3,6 @@ #include <linux/autoconf.h> -/* - * Defines for what uname() should return - */ -#ifndef UTS_SYSNAME -#define UTS_SYSNAME "Linux" -#endif - -#ifndef UTS_MACHINE -#define UTS_MACHINE "unknown" -#endif - -#ifndef UTS_NODENAME -#define UTS_NODENAME "(none)" /* set by sethostname() */ -#endif - -#ifndef UTS_DOMAINNAME -#define UTS_DOMAINNAME "(none)" /* set by setdomainname() */ -#endif - -/* - * The definitions for UTS_RELEASE and UTS_VERSION are now defined - * in linux/version.h, and should only be used by linux/version.c - */ - /* Shouldn't these be defined somewhere in a i386 definition? */ /* Don't touch these, unless you really know what you're doing. */ diff -urN linux-2.0.34pre16/include/linux/modsetver.h linux-2.0.34/include/linux/modsetver.h --- linux-2.0.34pre16/include/linux/modsetver.h Wed Dec 31 19:00:00 1969 +++ linux-2.0.34/include/linux/modsetver.h Sat May 30 14:36:29 1998 @@ -0,0 +1,5 @@ +/* Symbol versioning nastiness. */ + +#ifndef _set_ver +#define _set_ver(sym,vers) sym ## _R ## vers +#endif diff -urN linux-2.0.34pre16/include/linux/uts.h linux-2.0.34/include/linux/uts.h --- linux-2.0.34pre16/include/linux/uts.h Wed Dec 31 19:00:00 1969 +++ linux-2.0.34/include/linux/uts.h Sat May 30 00:15:26 1998 @@ -0,0 +1,23 @@ +#ifndef _LINUX_UTS_H +#define _LINUX_UTS_H + +/* + * Defines for what uname() should return + */ +#ifndef UTS_SYSNAME +#define UTS_SYSNAME "Linux" +#endif + +#ifndef UTS_MACHINE +#define UTS_MACHINE "unknown" +#endif + +#ifndef UTS_NODENAME +#define UTS_NODENAME "(none)" /* set by sethostname() */ +#endif + +#ifndef UTS_DOMAINNAME +#define UTS_DOMAINNAME "(none)" /* set by setdomainname() */ +#endif + +#endif diff -urN linux-2.0.34pre16/init/version.c linux-2.0.34/init/version.c --- linux-2.0.34pre16/init/version.c Sat May 30 15:44:08 1998 +++ linux-2.0.34/init/version.c Sat May 30 00:15:48 1998 @@ -6,14 +6,10 @@ * May be freely distributed as part of Linux. */ -#include <linux/config.h> +#include <linux/uts.h> #include <linux/utsname.h> #include <linux/version.h> #include <linux/compile.h> - -/* make the "checkconfig" script happy: we really need to include config.h */ -#ifdef CONFIG_BOGUS -#endif #define version(a) Version_ ## a #define version_string(a) version(a) diff -urN linux-2.0.34pre16/kernel/Makefile linux-2.0.34/kernel/Makefile --- linux-2.0.34pre16/kernel/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/kernel/Makefile Sat May 30 00:16:16 1998 @@ -19,7 +19,6 @@ OX_OBJS = ksyms.o endif -include $(TOPDIR)/Rules.make +CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer -sched.o: sched.c - $(CC) $(CFLAGS) $(PROFILING) -fno-omit-frame-pointer -c $< +include $(TOPDIR)/Rules.make diff -urN linux-2.0.34pre16/scripts/Configure linux-2.0.34/scripts/Configure --- linux-2.0.34pre16/scripts/Configure Sat May 30 15:44:08 1998 +++ linux-2.0.34/scripts/Configure Fri May 29 23:08:23 1998 @@ -144,18 +144,20 @@ case "$2" in "y") echo "$1=y" >>$CONFIG - echo "#define $1 1" >>$CONFIG_H + echo "#define $1 1" >>$CONFIG_H + echo "#undef $1_MODULE" >>$CONFIG_H ;; "m") echo "$1=m" >>$CONFIG - echo "#undef $1" >>$CONFIG_H + echo "#undef $1" >>$CONFIG_H echo "#define $1_MODULE 1" >>$CONFIG_H ;; "n") echo "# $1 is not set" >>$CONFIG - echo "#undef $1" >>$CONFIG_H + echo "#undef $1" >>$CONFIG_H + echo "#undef $1_MODULE" >>$CONFIG_H ;; esac eval "$1=$2" diff -urN linux-2.0.34pre16/scripts/Makefile linux-2.0.34/scripts/Makefile --- linux-2.0.34pre16/scripts/Makefile Sat May 30 15:44:08 1998 +++ linux-2.0.34/scripts/Makefile Sat May 30 00:17:25 1998 @@ -38,15 +38,15 @@ ${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o tkparse.o: tkparse.c tkparse.h - $(HOSTCC) $(HOSTCFLAGS) -c -o tkparse.o tkparse.c tkcond.o: tkcond.c tkparse.h - $(HOSTCC) $(HOSTCFLAGS) -c -o tkcond.o tkcond.c tkgen.o: tkgen.c tkparse.h - $(HOSTCC) $(HOSTCFLAGS) -c -o tkgen.o tkgen.c + +tkparse.o tkcond.o tkgen.o: + $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c) clean: - rm -f *~ kconfig.tk *.o tkparse + rm -f *~ kconfig.tk *.o tkparse mkdep split-include include $(TOPDIR)/Rules.make diff -urN linux-2.0.34pre16/scripts/Menuconfig linux-2.0.34/scripts/Menuconfig --- linux-2.0.34pre16/scripts/Menuconfig Sat May 30 15:44:08 1998 +++ linux-2.0.34/scripts/Menuconfig Sat May 30 02:06:52 1998 @@ -19,17 +19,41 @@ # Portions of this script were borrowed from the original Configure # script. # -# Please send comments / questions / bug fixes to roadcapw@titus.org +# William Roadcap was the original author of Menuconfig. +# Michael Elizabeth Chastain (mec@shout.net) is the current maintainer. # -# 070498 Stepan Kasal <kasal@math.cas.cz> - one change borrowed -# from 2.1.x version: -# 131197 Michael Chastain (mec@shout.net) - output all lines for a -# choice list, not just the selected one. This makes the output -# the same as Configure output, which is important for smart config -# dependencies. -# It also fixes the bug when menuconfig sets CONFIG_M386=y every time -# it is ran. -#---------------------------------------------------------------------------- +# 070497 Bernhard Kaindl (bkaindl@netway.at) - get default values for +# new bool, tristate and dep_tristate parameters from the defconfig file. +# new configuration parameters are marked with '(NEW)' as in make config. +# +# 180697 Bernhard Kaindl (bkaindl@netway.at) - added the needed support +# for string options. They are handled like the int and hex options. +# +# 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error +# handling +# +# 131197 Michael Chastain (mec@shout.net) - output all lines for a +# choice list, not just the selected one. This makes the output +# the same as Configure output, which is important for smart config +# dependencies. +# +# 101297 Michael Chastain (mec@shout.net) - remove sound driver cruft. +# +# 221297 Michael Chastain (mec@shout.net) - make define_bool actually +# define its arguments so that later tests on them work right. +# +# 160198 Michael Chastain (mec@shout.net) - fix bug with 'c' command +# (complement existing value) when used on virgin uninitialized variables. +# +# 090398 Axel Boldt (boldt@math.ucsb.edu) - allow for empty lines in help +# texts. + + +# +# If you prefer all kernel options listed in a single menu rather than +# the standard menu hierarchy, set SINGLE_MENU_MODE to "TRUE" in your +# environment. +single_menu_mode="${SINGLE_MENU_MODE:-FALSE}" # # Make sure we're really running bash. @@ -41,14 +65,21 @@ # set -h +o posix - # -# If you prefer all kernel options listed in a single menu rather than -# the standard menu hierarchy, set SINGLE_MENU_MODE to "TRUE" in your -# environment. +# Converts "# xxx is not..." to xxx=n # -single_menu_mode="${SINGLE_MENU_MODE:-FALSE}" +parse_config () { + sed -e 's/# \(.*\) is not.*/\1=n/' +} +# +# Parses the defconfig file to set the default for a new parameter. +# +function get_def () { + parse_config < arch/$ARCH/defconfig | grep "^$1=" > /tmp/conf.$$ + . /tmp/conf.$$ + rm /tmp/conf.$$ +} # # Load the functions used by the config.in files. @@ -62,6 +93,19 @@ load_functions () { # +# Macro for setting the x and info varibles. get's default from defconfig +# file if it's a new parameter. +# +function set_x () { + eval x=\$$1 + if [ -z "$x" ]; then + get_def "$1" + eval x=\${$1:-'n'} INFO_$1="' (NEW)'" + fi + eval info="\$INFO_$1" +} + +# # Additional comments # function comment () { @@ -81,14 +125,14 @@ # which calls our local bool function. # function bool () { - eval $2=\${$2:-'n'} x=\$$2 + set_x "$2" case $x in y|m) flag="*" ;; n) flag=" " ;; esac - echo -ne "'$2' '[$flag] $1' " >>MCmenu + echo -ne "'$2' '[$flag] $1$info' " >>MCmenu echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists } @@ -104,7 +148,7 @@ then bool "$1" "$2" else - eval $2=\${$2:-'n'} x=\$$2 + set_x "$2" case $x in y) flag="*" ;; @@ -112,7 +156,7 @@ *) flag=" " ;; esac - echo -ne "'$2' '<$flag> $1' " >>MCmenu + echo -ne "'$2' '<$flag> $1$info' " >>MCmenu echo -e " function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists @@ -157,7 +201,7 @@ } # -# Add a menu item which will call our local int function. +# Add a menu item which will call our local hex function. # function hex () { eval $2=\${$2:-"$3"} x=\${$2##*[x,X]} @@ -168,6 +212,17 @@ } # +# Add a menu item which will call our local string function. +# +function string () { + eval $2=\${$2:-"$3"} x=\$$2 + + echo -ne "'$2' ' $1: \"$x\"' " >>MCmenu + + echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists +} + +# # Add a menu item which will call our local One-of-Many choice list. # function choice () { @@ -225,9 +280,11 @@ var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g') #now pick out the right help text: text=$(sed -n "/^$var[ ]*\$/,\${ - /^$var[ ]*\$/d - /^#.*/d - /^[ ]*\$/q + /^$var[ ]*\$/c\\ +${var}:\\ + + /^#/b + /^[^ ]/q s/^ // p }" Documentation/Configure.help) @@ -317,6 +374,7 @@ case $x in y) eval $1=n ;; n) eval $1=y ;; + *) eval $1=y ;; esac ;; *) eval $1=n ;; esac @@ -329,14 +387,14 @@ # Same as bool() except options are (Module/No) # function mod_bool () { - eval $2=\${$2:-'n'} x=\$$2 + set_x "$2" case $x in y|m) flag='M' ;; *) flag=' ' ;; esac - echo -ne "'$2' '<$flag> $1' " >>MCmenu + echo -ne "'$2' '<$flag> $1$info' " >>MCmenu echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists } @@ -360,6 +418,7 @@ case $x in m) eval $1=n ;; n) eval $1=m ;; + *) eval $1=m ;; esac ;; *) eval $1=n ;; esac @@ -384,6 +443,7 @@ y) eval $1=n ;; n) eval $1=m ;; m) eval $1=y ;; + *) eval $1=y ;; esac ;; *) eval $1=n ;; esac @@ -406,7 +466,8 @@ answer="`cat MCdialog.out`" answer="${answer:-$3}" - # Avoid problems with GNU vs POSIX expr semantics. + # Semantics of + and ? in GNU expr changed, so + # we avoid them: if expr "$answer" : '0$\|-[1-9][0-9]*$\|[1-9][0-9]*$' >/dev/null then eval $2="$answer" @@ -440,7 +501,6 @@ answer="${answer:-$3}" answer="${answer##*[x,X]}" - # Avoid problems with GNU vs POSIX expr semantics. if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null then eval $2="$answer" @@ -460,6 +520,34 @@ } # +# Create a dialog for entering a string into a kernel option. +# +function l_string () { + while true + do + if $DIALOG --title "$1" \ + --backtitle "$backtitle" \ + --inputbox "$inputbox_instructions_string" \ + 10 75 "$4" 2>MCdialog.out + then + answer="`cat MCdialog.out`" + answer="${answer:-$3}" + + # + # Someone may add a nice check for the entered + # string here... + # + eval $2=\"$answer\" + + break + fi + + help "$2" "$1" + done +} + + +# # Handle a one-of-many choice list. # function l_choice () { @@ -518,12 +606,18 @@ done } +# +# Call awk, and watch for error codes, etc. +# +function callawk () { +awk "$1" || echo "Awk died with error code $?. Giving up." || exit 1 +} # # A faster awk based recursive parser. (I hope) # function parser1 () { -awk ' +callawk ' BEGIN { menu_no = 0 comment_is_option = 0 @@ -576,7 +670,7 @@ # Secondary parser for single menu mode. # function parser2 () { -awk ' +callawk ' BEGIN { parser("'$CONFIG_IN'","MCmenu0") } @@ -587,7 +681,7 @@ if ($1 ~ /mainmenu_option|endmenu/) { printf("") >>menu } - else if ($0 ~ /^#|\$MAKE|mainmenu_name/) { + else if ($0 ~ /^#|$MAKE|mainmenu_name/) { printf("") >>menu } else if ($1 == "source") { @@ -635,9 +729,9 @@ # for i in MCmenu* do + echo -n "." source ./$i done - rm -f MCmenu* } @@ -659,13 +753,11 @@ then clear cat <<EOM - Menuconfig has encountered a possible error in one of the kernel's configuration files and is unable to continue. -Please report this to the author <roadcapw@titus.org>. You may also -send a problem report to linux-kernel@vger.rutgers.edu or post a -message to the linux.dev.kernel news group. +Please report this to the maintainer <mec@shout.net>. You may also +send a problem report to <linux-kernel@vger.rutgers.edu>. Please indicate the kernel version you are trying to configure and which menu you were trying to enter when this error occurred. @@ -711,7 +803,6 @@ stty sane clear cat <<EOM - There seems to be a problem with the lxdialog companion utility which is built prior to running Menuconfig. Usually this is an indicator that you have upgraded/downgraded your ncurses libraries and did not remove the @@ -726,8 +817,8 @@ "make clean all" command. If you have verified that your ncurses install is correct, you may email -the author <roadcapw@titus.org> or post a message on the linux.dev.kernel -news group for additional assistance. +the maintainer <mec@shout.net> or post a message to +<linux-kernel@vger.rutgers.edu> for additional assistance. EOM cleanup @@ -754,7 +845,7 @@ while true do - ALT_CONFIG="${ALT_CONFIG:-$_CONFIG}" + ALT_CONFIG="${ALT_CONFIG:-$DEFAULTS}" $DIALOG --backtitle "$backtitle" \ --inputbox "\ @@ -820,7 +911,6 @@ while true do - $DIALOG --backtitle "$backtitle" \ --inputbox "\ Enter a filename to which this configuration should be saved \ @@ -867,25 +957,38 @@ rm -f help.out MCdialog.out } - -# -# Load config file into the environment converting all -# "# OPTION is not set" lines to "OPTION=n". # -# The $ARCH defaults are loaded first so "new"/previously -# unconfigured parameters are assigned the proper defaults. +# Load config options from a file. +# Converts all "# OPTION is not set" lines to "OPTION=n" lines # function load_config_file () { - eval "`sed -e 's/# \(.*\) is not set.*/\1=n/' arch/$ARCH/defconfig $1`" -} + awk ' + /# .* is not set.*/ { printf("%s=n\n", $2) } + ! /# .* is not set.*/ { print } + ' $1 >.tmpconfig + source ./.tmpconfig + rm -f .tmpconfig +} # # Just what it says. # save_configuration () { - ${DIALOG} --backtitle "$backtitle" \ - --infobox "Saving your kernel configuration..." 3 40 + echo + echo -n "Saving your kernel configuration." + + # + # Macro for setting the newval varible. get's default from defconfig + # file if it's a new parameter and it has not been shown yet. + # + function set_newval () { + eval newval=\$$1 + if [ -z "$newval" ]; then + get_def "$1" + eval newval=\${$1:-'n'} + fi + } # # Now, let's redefine the configuration functions for final @@ -894,25 +997,27 @@ # Nested function definitions, YIPEE! # function bool () { - eval define_bool "$2" "\${$2:-n}" + set_newval "$2" + eval define_bool "$2" "$newval" } function tristate () { - eval define_bool "$2" "\${$2:-n}" + set_newval "$2" + eval define_bool "$2" "$newval" } function dep_tristate () { - eval x=\${$2:-n} + set_newval "$2" if eval [ "_$3" = "_m" ] then - if [ "$x" = "y" ] + if [ "$newval" = "y" ] then - x="m" + newval="m" fi fi - define_bool "$2" "$x" + define_bool "$2" "$newval" } function int () { @@ -927,6 +1032,12 @@ echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H } + function string () { + eval x=\${$2:-"$3"} + echo "$2=\"$x\"" >>$CONFIG + echo "#define $2 \"$x\"" >>$CONFIG_H + } + function define_bool () { eval $1="$2" @@ -1023,8 +1134,10 @@ fi } - DEF_CONFIG="${1:-$_CONFIG}" - DEF_CONFIG_H="$AUTOCONF_H" + echo -n "." + + DEF_CONFIG="${1:-.config}" + DEF_CONFIG_H="include/linux/autoconf.h" CONFIG=.tmpconfig CONFIG_H=.tmpconfig.h @@ -1036,16 +1149,14 @@ echo "/*" >$CONFIG_H echo " * Automatically generated by make menuconfig: don't edit" >>$CONFIG_H echo " */" >>$CONFIG_H + echo "#define AUTOCONF_INCLUDED" >> $CONFIG_H MAKE=: #To prevent sound Makefile from running. + echo -n "." if . $CONFIG_IN >>.menuconfig.log 2>&1 then - # - # Skip these steps if we are saving to an - # alternate configuration file. - # - if [ "$DEF_CONFIG" = "$_CONFIG" ] + if [ "$DEF_CONFIG" = ".config" ] then # # Create the sound driver's config files for cards @@ -1075,14 +1186,12 @@ fi } - # # Remove temporary files # cleanup () { cleanup1 cleanup2 - stty $S_TERMIO } cleanup1 () { @@ -1115,8 +1224,6 @@ ROWS=$((ROWS-4)) COLS=$((COLS-5)) } -S_TERMIO=`stty -g` - set_geometry `stty size 2>/dev/null` menu_instructions="\ @@ -1142,45 +1249,42 @@ Please enter a hexadecimal value. \ Use the <TAB> key to move from the input field to the buttons below it." +inputbox_instructions_string="\ +Please enter a string value. \ +Use the <TAB> key to move from the input field to the buttons below it." + DIALOG="${DIALOG:-./scripts/lxdialog/lxdialog}" kernel_version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" backtitle="Linux Kernel v$kernel_version Configuration" -trap "cleanup ; rm -f .menuconfig ; exit 1" 1 2 15 +trap "cleanup ; exit 1" 1 2 15 # # Locate default files. # -DEFAULTS="arch/$ARCH/defconfig" - CONFIG_IN="${1:-./config.in}" -_CONFIG="${2:-.config}" - -if [ -f "$_CONFIG" ]; then - DEFAULTS=$_CONFIG +DEFAULTS=arch/$ARCH/defconfig +if [ -f .config ]; then + DEFAULTS=.config fi -AUTOCONF_H="${3:-include/linux/autoconf.h}" - if [ -f $DEFAULTS ] then - echo echo "Using defaults found in" $DEFAULTS load_config_file $DEFAULTS else - echo echo "No defaults found" fi + # Fresh new log. >.menuconfig.log -$DIALOG --backtitle "$backtitle" \ - --infobox "Preparing configuration scripts..." 3 40 +echo -n "Preparing configuration scripts: version" # # Check kernel version of previous menuconfig build. @@ -1208,13 +1312,28 @@ fi # Load the functions used by the config.in files. +echo -n ", functions" load_functions +if [ ! -e $CONFIG_IN ] +then + echo "Your main config.in file ($CONFIG_IN) does not exist" + exit 1 +fi + +if [ ! -x $DIALOG ] +then + echo "Your lxdialog utility does not exist" + exit 1 +fi + # # Read config.in files and parse them into one shell function per menu. # +echo -n ", parsing" parse_config_files $CONFIG_IN +echo "done." # # Start the ball rolling from the top. # @@ -1230,27 +1349,12 @@ # if $DIALOG --backtitle "$backtitle" \ --yesno "Do you wish to save your new kernel configuration?" 5 60 - then save_configuration - stty $S_TERMIO - clear - - cat <<EOM - - -The linux kernel is now hopefully configured for your setup. -Check the top-level Makefile for additional configuration, -and do a 'make dep ; make clean' if you want to be sure all -the files are correctly re-made. - -EOM + echo + echo The linux kernel is now configured for your setup. else - clear - stty $S_TERMIO - echo -e "Your kernel configuration changes were NOT saved.\n" + echo + echo Your kernel configuration changes were NOT saved. fi - - exit 0 - diff -urN linux-2.0.34pre16/scripts/checkconfig.pl linux-2.0.34/scripts/checkconfig.pl --- linux-2.0.34pre16/scripts/checkconfig.pl Wed Dec 31 19:00:00 1969 +++ linux-2.0.34/scripts/checkconfig.pl Fri May 29 23:08:23 1998 @@ -0,0 +1,50 @@ +#! /usr/bin/perl +# +# checkconfig: find uses of CONFIG_* names without matching definitions. + +use integer; + +foreach $file (@ARGV) +{ + # Open this file. + open(FILE, $file) || die "Can't open $file: $!\n"; + + # Initialize variables. + my $fInComment = 0; + my $fUseConfig = 0; + my $iLinuxConfig = 0; + my %configList = (); + + LINE: while ( <FILE> ) + { + # Strip comments. + $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next); + m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1))); + + # Pick up definitions. + if ( m/^#/o ) + { + $iLinuxConfig = $. if m/^#\s*include\s+<linux\/config\.h>/o; + $configList{uc $1} = 1 if m/^#\s*include\s+<config\/(\S*)\.h>/o; + $configList{$1} = 1 if m/^#\s*define\s+CONFIG_(\w*)/o; + $configList{$1} = 1 if m/^#\s*undef\s+CONFIG_(\w*)/o; + } + + # Look for usages. + next unless m/CONFIG_/o; + WORD: while ( m/\bCONFIG_(\w*)/og ) + { + $fUseConfig = 1; + last LINE if $iLinuxConfig; + next WORD if exists $configList{$1}; + print "$file: $.: need CONFIG_$1.\n"; + $configList{$1} = 0; + } + } + + # Report superfluous includes. + if ( $iLinuxConfig && ! $fUseConfig ) + { print "$file: $iLinuxConfig: <linux/config.h> not needed.\n"; } + + close(FILE); +} diff -urN linux-2.0.34pre16/scripts/depend.awk linux-2.0.34/scripts/depend.awk --- linux-2.0.34pre16/scripts/depend.awk Sat May 30 15:44:44 1998 +++ linux-2.0.34/scripts/depend.awk Wed Dec 31 19:00:00 1969 @@ -1,154 +0,0 @@ -# This is an awk script which does dependencies. We do NOT want it to -# recursively follow #include directives. -# -# The HPATH environment variable should be set to indicate where to look -# for include files. The -I in front of the path is optional. - -# -# Surely there is a more elegant way to see if a file exists. Anyone know -# what it is? -# -function fileExists(f, TMP, dummy, result) { - if(result=FILEHASH[f]) { - if(result=="Yes") { - return "Yes" - } else {return ""} - } - ERRNO = getline dummy < f - if(ERRNO >= 0) { - close(f) - return FILEHASH[f]="Yes" - } else { - FILEHASH[f]="No" - return "" - } -} - -function endfile(f) { - if (hasconfig && !needsconfig) { - printf "%s doesn't need config\n",f > "/dev/stderr" - } - if (hasdep) { - print cmd - } -} - -BEGIN{ - hasdep=0 - hasconfig=0 - needsconfig=0 - incomment=0 - if(!(TOPDIR=ENVIRON["TOPDIR"])) { - print "Environment variable TOPDIR is not set" - exit 1 - } - split(ENVIRON["HPATH"],parray," ") - for(path in parray) { - sub("^-I","",parray[path]) - sub("[/ ]*$","",parray[path]) - } -} - -# eliminate comments -{ - # remove all comments fully contained on a single line - gsub("\\/\\*.*\\*\\/", "") - if (incomment) { - if ($0 ~ /\*\//) { - incomment = 0; - gsub(".*\\*\\/", "") - } else { - next - } - } else { - # start of multi-line comment - if ($0 ~ /\/\*/) - { - incomment = 1; - sub("\\/\\*.*", "") - } else if ($0 ~ /\*\//) { - incomment = 0; - sub(".*\\*\\/", "") - } - } -} - -/^[ ]*#[ ]*if.*[^A-Za-z_]CONFIG_/ { - needsconfig=1 - if (!hasconfig) { - printf "%s needs config but has not included config file\n",FILENAME > "/dev/stderr" - # only say it once per file.. - hasconfig = 1 - } -} - -/^[ ]*#[ ]*include[ ]*[<"][^ ]*[>"]/{ - found=0 - if(LASTFILE!=FILENAME) { - endfile(LASTFILE) - hasdep=0 - hasconfig=0 - needsconfig=0 - incomment=0 - cmd="" - LASTFILE=FILENAME - depname=FILENAME - relpath=FILENAME - sub("\\.c$",".o: ",depname) - sub("\\.S$",".o: ",depname) - if (depname==FILENAME) { - cmd="\n\t@touch "depname - } - sub("\\.h$",".h: ",depname) - if(relpath ~ "^\\." ) { - sub("[^/]*$","", relpath) - relpath=relpath"/" - sub("//","/", relpath) - } else { - relpath="" - } - } - fname=$0 - sub("^#[ ]*include[ ]*[<\"]","",fname) - sub("[>\"].*","",fname) - if (fname=="linux/config.h") { - hasconfig=1 - } - rfname=relpath""fname - if(fileExists(rfname)) { - found=1 - if (!hasdep) { - printf "%s", depname - } - hasdep=1 - printf " \\\n %s", rfname - if(fname ~ "^\\." ) { - fnd=0; - for(i in ARGV) { - if(ARGV[i]==rfname) { - fnd=1 - } - } - if(fnd==0) { - ARGV[ARGC]=rfname - ++ARGC - } - } - } else { - for(path in parray) { - if(fileExists(parray[path]"/"fname)) { - shortp=parray[path] - found=1 - if (!hasdep) { - printf "%s", depname - } - hasdep=1 - printf " \\\n %s", parray[path]"/"fname - } - } - } -} - -END{ - endfile(FILENAME) -} diff -urN linux-2.0.34pre16/scripts/header.tk linux-2.0.34/scripts/header.tk --- linux-2.0.34pre16/scripts/header.tk Sat May 30 15:44:10 1998 +++ linux-2.0.34/scripts/header.tk Sat May 30 00:20:27 1998 @@ -227,23 +227,23 @@ proc write_tristate { file1 file2 varname variable dep } { if { $variable == 0 } \ then { puts $file1 "# $varname is not set"; \ - puts $file2 "#undef $varname"} \ + puts $file2 "#undef $varname"; \ elseif { $variable == 2 || ($dep == 2 && $variable == 1) } \ then { puts $file1 "$varname=m"; \ - puts $file2 "#undef $varname"; \ + puts $file2 "#undef $varname"; \ puts $file2 "#define ${varname}_MODULE 1" } \ elseif { $variable == 1 && $dep != 2 } \ then { puts $file1 "$varname=y"; \ - puts $file2 "#define $varname 1" } \ + puts $file2 "#define $varname 1"; \ else { \ - error "Attempting to write value for variable that is not configured ($varname)." \ + error "Attempting to write value for unconfigured variable ($varname)." \ } } proc write_int { file1 file2 varname variable dep } { if { $dep == 0 } \ then { puts $file1 "# $varname is not set"; \ - puts $file2 "#undef $varname"} \ + puts $file2 "#undef $varname"} \ else { puts $file1 "$varname=$variable"; \ puts $file2 "#define $varname $variable"; \ @@ -253,7 +253,7 @@ proc write_hex { file1 file2 varname variable dep } { if { $dep == 0 } \ then { puts $file1 "# $varname is not set"; \ - puts $file2 "#undef $varname"} \ + puts $file2 "#undef $varname"} \ else { puts $file1 "$varname=$variable"; \ puts $file2 "#define $varname 0x$variable"; \ diff -urN linux-2.0.34pre16/scripts/hfiles.sh linux-2.0.34/scripts/hfiles.sh --- linux-2.0.34pre16/scripts/hfiles.sh Sat May 30 15:44:36 1998 +++ linux-2.0.34/scripts/hfiles.sh Wed Dec 31 19:00:00 1969 @@ -1,11 +0,0 @@ -#!/bin/sh -# -# This script looks to see if a directory contains .h files -# -for dir in $@; do - for hfile in $dir/*.h; do - if [ -f $hfile ]; then echo $dir; fi - break - done -done -exit 0 diff -urN linux-2.0.34pre16/scripts/mkdep.c linux-2.0.34/scripts/mkdep.c --- linux-2.0.34pre16/scripts/mkdep.c Sat May 30 15:44:14 1998 +++ linux-2.0.34/scripts/mkdep.c Sat May 30 00:37:42 1998 @@ -1,17 +1,31 @@ +/* + * Originally by Linus Torvalds. + * Smart CONFIG_* processing by Werner Almesberger, Michael Chastain. + * + * Usage: mkdep file ... + * + * Read source files and output makefile dependency lines for them. + * I make simple dependency lines for #include <*.h> and #include "*.h". + * I also find instances of CONFIG_FOO and generate dependencies + * like include/config/foo.h. + */ + +#include <ctype.h> #include <stdio.h> #include <stdlib.h> - #include <string.h> -#include <sys/types.h> -#include <sys/stat.h> #include <unistd.h> + #include <sys/fcntl.h> #include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> -char *filename, *command, __depname[256] = "\n\t@touch "; -int needsconfig, hasconfig, hasdep; + +char __depname[512] = "\n\t@touch "; #define depname (__depname+9) +int hasdep; struct path_struct { int len; @@ -21,19 +35,113 @@ { 0, "" } }; -static void handle_include(int type, char *name, int len) + + +/* + * This records all the configuration options seen. + * In perl this would be a hash, but here it's a long string + * of values separated by newlines. This is simple and + * extremely fast. + */ +char * str_config = NULL; +int size_config = 0; +int len_config = 0; + + + +/* + * Grow the configuration string to a desired length. + * Usually the first growth is plenty. + */ +void grow_config(int len) +{ + if (str_config == NULL) { + len_config = 0; + size_config = 4096; + str_config = malloc(4096); + if (str_config == NULL) + { perror("malloc"); exit(1); } + } + + while (len_config + len > size_config) { + str_config = realloc(str_config, size_config *= 2); + if (str_config == NULL) + { perror("malloc"); exit(1); } + } +} + + + +/* + * Lookup a value in the configuration string. + */ +int is_defined_config(const char * name, int len) +{ + const char * pconfig; + const char * plast = str_config + len_config - len; + for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) { + if (pconfig[ -1] == '\n' + && pconfig[len] == '\n' + && !memcmp(pconfig, name, len)) + return 1; + } + return 0; +} + + + +/* + * Add a new value to the configuration string. + */ +void define_config(int convert, const char * name, int len) +{ + grow_config(len + 1); + + memcpy(str_config+len_config, name, len); + + if (convert) { + int i; + for (i = 0; i < len; i++) { + char c = str_config[len_config+i]; + if (isupper(c)) c = tolower(c); + if (c == '_') c = '/'; + str_config[len_config+i] = c; + } + } + + len_config += len; + str_config[len_config++] = '\n'; +} + + + +/* + * Clear the set of configuration strings. + */ +void clear_config( ) +{ + len_config = 0; + define_config(0, "", 0); +} + + + +/* + * Handle an #include line. + */ +void handle_include(int type, const char * name, int len) { - int plen; struct path_struct *path = path_array+type; if (len == 14 && !memcmp(name, "linux/config.h", len)) - hasconfig = 1; + return; + + if (len >= 7 && !memcmp(name, "config/", 7)) + define_config(0, name+7, len-7-2); - plen = path->len; - memcpy(path->buffer+plen, name, len); - len += plen; - path->buffer[len] = '\0'; - if (access(path->buffer, F_OK)) + memcpy(path->buffer+path->len, name, len); + path->buffer[path->len+len] = '\0'; + if (access(path->buffer, F_OK) != 0) return; if (!hasdep) { @@ -43,15 +151,48 @@ printf(" \\\n %s", path->buffer); } -static void handle_config(void) + + +/* + * Record the use of a CONFIG_* word. + */ +void use_config(const char * name, int len) { - needsconfig = 1; - if (!hasconfig) - fprintf(stderr, - "%s needs config but has not included config file\n", - filename); + char *pc; + int i; + + pc = path_array[0].buffer + path_array[0].len; + memcpy(pc, "config/", 7); + pc += 7; + + for (i = 0; i < len; i++) { + char c = name[i]; + if (isupper(c)) c = tolower(c); + if (c == '_') c = '/'; + pc[i] = c; + } + pc[len] = '\0'; + + if (is_defined_config(pc, len)) + return; + + define_config(0, pc, len); + + if (!hasdep) { + hasdep = 1; + printf("%s: ", depname); + } + printf(" \\\n $(wildcard %s.h)", path_array[0].buffer); } + + +/* + * Macros for stunningly fast map-based character access. + * __buf is a register which holds the current word of the input. + * Thus, there is one memory access per sizeof(unsigned long) characters. + */ + #if defined(__alpha__) || defined(__i386__) #define LE_MACHINE #endif @@ -65,228 +206,283 @@ #endif #define GETNEXT { \ -next_byte(__buf); \ -if (!__nrbuf) { \ - __buf = *(unsigned long *) next; \ - __nrbuf = sizeof(unsigned long); \ - if (!__buf) \ - break; \ -} next++; __nrbuf--; } + next_byte(__buf); \ + if ((unsigned long) next % sizeof(unsigned long) == 0) { \ + __buf = * (unsigned long *) next; \ + if (!__buf) \ + break; \ + } \ + next++; \ +} + +/* + * State machine macros. + */ #define CASE(c,label) if (current == c) goto label #define NOTCASE(c,label) if (current != c) goto label -static void state_machine(register char *next) -{ - for(;;) { - register unsigned long __buf = 0; - register unsigned long __nrbuf = 0; - -normal: - GETNEXT -__normal: - CASE('/',slash); - CASE('"',string); - CASE('\'',char_const); - CASE('#',preproc); - goto normal; - -slash: - GETNEXT - CASE('*',comment); - goto __normal; - -string: - GETNEXT - CASE('"',normal); - NOTCASE('\\',string); - GETNEXT - goto string; - -char_const: - GETNEXT - CASE('\'',normal); - NOTCASE('\\',char_const); - GETNEXT - goto char_const; +/* + * Yet another state machine speedup. + */ +#define MAX2(a,b) ((a)>(b)?(a):(b)) +#define MIN2(a,b) ((a)<(b)?(a):(b)) +#define MAX5(a,b,c,d,e) (MAX2(a,MAX2(b,MAX2(c,MAX2(d,e))))) +#define MIN5(a,b,c,d,e) (MIN2(a,MIN2(b,MIN2(c,MIN2(d,e))))) -comment: - GETNEXT -__comment: - NOTCASE('*',comment); - GETNEXT - CASE('/',normal); - goto __comment; -preproc: - GETNEXT - CASE('\n',normal); - CASE(' ',preproc); - CASE('\t',preproc); - CASE('i',i_preproc); - GETNEXT -skippreproc: - CASE('\n',normal); - CASE('\\',skippreprocslash); - GETNEXT - goto skippreproc; - -skippreprocslash: - GETNEXT; - GETNEXT; - goto skippreproc; +/* + * The state machine looks for (approximately) these Perl regular expressions: + * + * m|\/\*.*?\*\/| + * m|'.*?'| + * m|".*?"| + * m|#\s*include\s*"(.*?)"| + * m|#\s*include\s*<(.*?>"| + * m|#\s*(?define|undef)\s*CONFIG_(\w*)| + * m|(?!\w)CONFIG_| + * + * About 98% of the CPU time is spent here, and most of that is in + * the 'start' paragraph. Because the current characters are + * in a register, the start loop usually eats 4 or 8 characters + * per memory read. The MAX5 and MIN5 tests dispose of most + * input characters with 1 or 2 comparisons. + */ +void state_machine(const char * map) +{ + const char * next = map; + const char * map_dot; + unsigned long __buf = 0; + + for (;;) { +start: + GETNEXT +__start: + if (current > MAX5('/','\'','"','#','C')) goto start; + if (current < MIN5('/','\'','"','#','C')) goto start; + CASE('/', slash); + CASE('\'', squote); + CASE('"', dquote); + CASE('#', pound); + CASE('C', cee); + goto start; -i_preproc: - GETNEXT - CASE('f',if_line); - NOTCASE('n',skippreproc); - GETNEXT - NOTCASE('c',skippreproc); - GETNEXT - NOTCASE('l',skippreproc); - GETNEXT - NOTCASE('u',skippreproc); +/* / */ +slash: GETNEXT - NOTCASE('d',skippreproc); + NOTCASE('*', __start); +slash_star_dot_star: GETNEXT - NOTCASE('e',skippreproc); - -/* "# include" found */ -include_line: +__slash_star_dot_star: + NOTCASE('*', slash_star_dot_star); GETNEXT - CASE('\n',normal); - CASE('<', std_include_file); - NOTCASE('"', include_line); + NOTCASE('/', __slash_star_dot_star); + goto start; -/* "local" include file */ -{ - char *incname = next; -local_include_name: - GETNEXT - CASE('\n',normal); - NOTCASE('"', local_include_name); - handle_include(1, incname, next-incname-1); - goto skippreproc; +/* '.*?' */ +squote: + GETNEXT + CASE('\'', start); + NOTCASE('\\', squote); + GETNEXT + goto squote; + +/* ".*?" */ +dquote: + GETNEXT + CASE('"', start); + NOTCASE('\\', dquote); + GETNEXT + goto dquote; + +/* #\s* */ +pound: + GETNEXT + CASE(' ', pound); + CASE('\t', pound); + CASE('i', pound_i); + CASE('d', pound_d); + CASE('u', pound_u); + goto __start; + +/* #\s*i */ +pound_i: + GETNEXT NOTCASE('n', __start); + GETNEXT NOTCASE('c', __start); + GETNEXT NOTCASE('l', __start); + GETNEXT NOTCASE('u', __start); + GETNEXT NOTCASE('d', __start); + GETNEXT NOTCASE('e', __start); + goto pound_include; + +/* #\s*include\s* */ +pound_include: + GETNEXT + CASE(' ', pound_include); + CASE('\t', pound_include); + map_dot = next; + CASE('"', pound_include_dquote); + CASE('<', pound_include_langle); + goto __start; + +/* #\s*include\s*"(.*)" */ +pound_include_dquote: + GETNEXT + CASE('\n', start); + NOTCASE('"', pound_include_dquote); + handle_include(1, map_dot, next - map_dot - 1); + goto start; + +/* #\s*include\s*<(.*)> */ +pound_include_langle: + GETNEXT + CASE('\n', start); + NOTCASE('>', pound_include_langle); + handle_include(0, map_dot, next - map_dot - 1); + goto start; + +/* #\s*d */ +pound_d: + GETNEXT NOTCASE('e', __start); + GETNEXT NOTCASE('f', __start); + GETNEXT NOTCASE('i', __start); + GETNEXT NOTCASE('n', __start); + GETNEXT NOTCASE('e', __start); + goto pound_define_undef; + +/* #\s*u */ +pound_u: + GETNEXT NOTCASE('n', __start); + GETNEXT NOTCASE('d', __start); + GETNEXT NOTCASE('e', __start); + GETNEXT NOTCASE('f', __start); + goto pound_define_undef; + +/* #\s*(define|undef)\s*CONFIG_(\w*) */ +pound_define_undef: + GETNEXT + CASE(' ', pound_define_undef); + CASE('\t', pound_define_undef); + + NOTCASE('C', __start); + GETNEXT NOTCASE('O', __start); + GETNEXT NOTCASE('N', __start); + GETNEXT NOTCASE('F', __start); + GETNEXT NOTCASE('I', __start); + GETNEXT NOTCASE('G', __start); + GETNEXT NOTCASE('_', __start); + + map_dot = next; +pound_define_undef_CONFIG_word: + GETNEXT + if (isalnum(current) || current == '_') + goto pound_define_undef_CONFIG_word; + define_config(1, map_dot, next - map_dot - 1); + goto __start; + +/* \<CONFIG_(\w*) */ +cee: + if (next >= map+2 && (isalnum(next[-2]) || next[-2] == '_')) + goto start; + GETNEXT NOTCASE('O', __start); + GETNEXT NOTCASE('N', __start); + GETNEXT NOTCASE('F', __start); + GETNEXT NOTCASE('I', __start); + GETNEXT NOTCASE('G', __start); + GETNEXT NOTCASE('_', __start); + + map_dot = next; +cee_CONFIG_word: + GETNEXT + if (isalnum(current) || current == '_') + goto cee_CONFIG_word; + use_config(map_dot, next - map_dot - 1); + goto __start; + } } -/* <std> include file */ -std_include_file: -{ - char *incname = next; -std_include_name: - GETNEXT - CASE('\n',normal); - NOTCASE('>', std_include_name); - handle_include(0, incname, next-incname-1); - goto skippreproc; -} -if_line: - if (needsconfig) - goto skippreproc; -if_start: - GETNEXT - CASE('C', config); - CASE('\n', normal); - CASE('_', if_middle); - if (current >= 'a' && current <= 'z') - goto if_middle; - if (current < 'A' || current > 'Z') - goto if_start; -config: - GETNEXT - NOTCASE('O', __if_middle); - GETNEXT - NOTCASE('N', __if_middle); - GETNEXT - NOTCASE('F', __if_middle); - GETNEXT - NOTCASE('I', __if_middle); - GETNEXT - NOTCASE('G', __if_middle); - GETNEXT - NOTCASE('_', __if_middle); - handle_config(); - goto skippreproc; - -if_middle: - GETNEXT -__if_middle: - CASE('\n', normal); - CASE('_', if_middle); - if (current >= 'a' && current <= 'z') - goto if_middle; - if (current < 'A' || current > 'Z') - goto if_start; - goto if_middle; - } -} -static void do_depend(void) +/* + * Generate dependencies for one file. + */ +void do_depend(const char * filename, const char * command) { - char *map; int mapsize; int pagesizem1 = getpagesize()-1; - int fd = open(filename, O_RDONLY); + int fd; struct stat st; + char * map; + fd = open(filename, O_RDONLY); if (fd < 0) { - perror("mkdep: open"); + perror(filename); return; } + fstat(fd, &st); + if (st.st_size == 0) { + fprintf(stderr,"%s is empty\n",filename); + close(fd); + return; + } + mapsize = st.st_size + 2*sizeof(unsigned long); mapsize = (mapsize+pagesizem1) & ~pagesizem1; map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); - if (-1 == (long)map) { + if ((long) map == -1) { perror("mkdep: mmap"); close(fd); return; } - close(fd); + if ((unsigned long) map % sizeof(unsigned long) != 0) + { + fprintf(stderr, "do_depend: map not aligned\n"); + exit(1); + } + + hasdep = 0; + clear_config(); state_machine(map); - munmap(map, mapsize); if (hasdep) puts(command); + + munmap(map, mapsize); + close(fd); } + + +/* + * Generate dependencies for all files. + */ int main(int argc, char **argv) { int len; - char * hpath; + char *hpath; hpath = getenv("HPATH"); if (!hpath) hpath = "/usr/src/linux/include"; len = strlen(hpath); memcpy(path_array[0].buffer, hpath, len); - if (len && hpath[len-1] != '/') { - path_array[0].buffer[len] = '/'; - len++; - } + if (len && hpath[len-1] != '/') + path_array[0].buffer[len++] = '/'; path_array[0].buffer[len] = '\0'; path_array[0].len = len; while (--argc > 0) { - int len; - char *name = *++argv; - - filename = name; - len = strlen(name); - memcpy(depname, name, len+1); - command = __depname; - if (len > 2 && name[len-2] == '.') { - switch (name[len-1]) { - case 'c': - case 'S': - depname[len-1] = 'o'; - command = ""; + const char * filename = *++argv; + const char * command = __depname; + len = strlen(filename); + memcpy(depname, filename, len+1); + if (len > 2 && filename[len-2] == '.') { + if (filename[len-1] == 'c' || filename[len-1] == 'S') { + depname[len-1] = 'o'; + command = ""; } } - needsconfig = hasconfig = hasdep = 0; - do_depend(); - if (hasconfig && !needsconfig) - fprintf(stderr, "%s doesn't need config\n", filename); + do_depend(filename, command); } return 0; } diff -urN linux-2.0.34pre16/scripts/split-include.c linux-2.0.34/scripts/split-include.c --- linux-2.0.34pre16/scripts/split-include.c Wed Dec 31 19:00:00 1969 +++ linux-2.0.34/scripts/split-include.c Sat May 30 00:37:48 1998 @@ -0,0 +1,226 @@ +/* + * split-include.c + * + * Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>. + * This is a C version of syncdep.pl by Werner Almesberger. + * + * This program takes autoconf.h as input and outputs a directory full + * of one-line include files, merging onto the old values. + * + * Think of the configuration options as key-value pairs. Then there + * are five cases: + * + * key old value new value action + * + * KEY-1 VALUE-1 VALUE-1 leave file alone + * KEY-2 VALUE-2A VALUE-2B write VALUE-2B into file + * KEY-3 - VALUE-3 write VALUE-3 into file + * KEY-4 VALUE-4 - write an empty file + * KEY-5 (empty) - leave old empty file alone + */ + +#include <sys/stat.h> +#include <sys/types.h> + +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define ERROR_EXIT(strExit) \ + { \ + const int errnoSave = errno; \ + fprintf(stderr, "%s: ", str_my_name); \ + errno = errnoSave; \ + perror((strExit)); \ + exit(1); \ + } + + + +int main(int argc, const char * argv []) +{ + const char * str_my_name; + const char * str_file_autoconf; + const char * str_dir_config; + + FILE * fp_config; + FILE * fp_target; + FILE * fp_find; + + int buffer_size; + + char * line; + char * old_line; + char * list_target; + char * ptarget; + + struct stat stat_buf; + + /* Check arg count. */ + if (argc != 3) + { + fprintf(stderr, "%s: wrong number of arguments.\n", argv[0]); + exit(1); + } + + str_my_name = argv[0]; + str_file_autoconf = argv[1]; + str_dir_config = argv[2]; + + /* Find a buffer size. */ + if (stat(str_file_autoconf, &stat_buf) != 0) + ERROR_EXIT(str_file_autoconf); + buffer_size = 2 * stat_buf.st_size + 4096; + + /* Allocate buffers. */ + if ( (line = malloc(buffer_size)) == NULL + || (old_line = malloc(buffer_size)) == NULL + || (list_target = malloc(buffer_size)) == NULL ) + ERROR_EXIT(str_file_autoconf); + + /* Open autoconfig file. */ + if ((fp_config = fopen(str_file_autoconf, "r")) == NULL) + ERROR_EXIT(str_file_autoconf); + + /* Make output directory if needed. */ + if (stat(str_dir_config, &stat_buf) != 0) + { + if (mkdir(str_dir_config, 0755) != 0) + ERROR_EXIT(str_dir_config); + } + + /* Change to output directory. */ + if (chdir(str_dir_config) != 0) + ERROR_EXIT(str_dir_config); + + /* Put initial separator into target list. */ + ptarget = list_target; + *ptarget++ = '\n'; + + /* Read config lines. */ + while (fgets(line, buffer_size, fp_config)) + { + const char * str_config; + int is_same; + int itarget; + + if (line[0] != '#') + continue; + if ((str_config = strstr(line, "CONFIG_")) == NULL) + continue; + + /* Make the output file name. */ + str_config += sizeof("CONFIG_") - 1; + for (itarget = 0; !isspace(str_config[itarget]); itarget++) + { + char c = str_config[itarget]; + if (isupper(c)) c = tolower(c); + if (c == '_') c = '/'; + ptarget[itarget] = c; + } + ptarget[itarget++] = '.'; + ptarget[itarget++] = 'h'; + ptarget[itarget++] = '\0'; + + /* Check for existing file. */ + is_same = 0; + if ((fp_target = fopen(ptarget, "r")) != NULL) + { + fgets(old_line, buffer_size, fp_target); + if (fclose(fp_target) != 0) + ERROR_EXIT(ptarget); + if (!strcmp(line, old_line)) + is_same = 1; + } + + if (!is_same) + { + /* Auto-create directories. */ + int islash; + for (islash = 0; islash < itarget; islash++) + { + if (ptarget[islash] == '/') + { + ptarget[islash] = '\0'; + if (stat(ptarget, &stat_buf) != 0 + && mkdir(ptarget, 0755) != 0) + ERROR_EXIT( ptarget ); + ptarget[islash] = '/'; + } + } + + /* Write the file. */ + if ((fp_target = fopen(ptarget, "w" )) == NULL) + ERROR_EXIT(ptarget); + fputs(line, fp_target); + if (ferror(fp_target) || fclose(fp_target) != 0) + ERROR_EXIT(ptarget); + } + + /* Update target list */ + ptarget += itarget; + *(ptarget-1) = '\n'; + } + + /* + * Close autoconfig file. + * Terminate the target list. + */ + if (fclose(fp_config) != 0) + ERROR_EXIT(str_file_autoconf); + *ptarget = '\0'; + + /* + * Fix up existing files which have no new value. + * This is Case 4 and Case 5. + * + * I re-read the tree and filter it against list_target. + * This is crude. But it avoids data copies. Also, list_target + * is compact and contiguous, so it easily fits into cache. + * + * Notice that list_target contains strings separated by \n, + * with a \n before the first string and after the last. + * fgets gives the incoming names a terminating \n. + * So by having an initial \n, strstr will find exact matches. + */ + + fp_find = popen("find * -type f -print", "r"); + if (fp_find == 0) + ERROR_EXIT( "find" ); + + line[0] = '\n'; + while (fgets(line+1, buffer_size, fp_find)) + { + if (strstr(list_target, line) == NULL) + { + /* + * This is an old file with no CONFIG_* flag in autoconf.h. + */ + + /* First strip the \n. */ + line[strlen(line)-1] = '\0'; + + /* Grab size. */ + if (stat(line+1, &stat_buf) != 0) + ERROR_EXIT(line); + + /* If file is not empty, make it empty and give it a fresh date. */ + if (stat_buf.st_size != 0) + { + if ((fp_target = fopen(line+1, "w")) == NULL) + ERROR_EXIT(line); + if (fclose(fp_target) != 0) + ERROR_EXIT(line); + } + } + } + + if (pclose(fp_find) != 0) + ERROR_EXIT("find"); + + return 0; +} diff -urN linux-2.0.34pre16/scripts/tkgen.c linux-2.0.34/scripts/tkgen.c --- linux-2.0.34pre16/scripts/tkgen.c Sat May 30 15:44:14 1998 +++ linux-2.0.34/scripts/tkgen.c Fri May 29 23:08:23 1998 @@ -50,6 +50,14 @@ * Avery Pennarun - Reduced flicker when creating windows, even with "update * idletasks" hack. * + * 1997 11 15 + * Michael Chastain - For choice buttons, write values for all options, + * not just the single chosen one. This is compatible + * with 'make config' and 'make oldconfig', and is + * needed so smart-config dependencies work if the + * user switches from one configuration method to + * another. + * * TO DO: * - clean up - there are useless ifdef's everywhere. * - better comments throughout - C code generating tcl is really cryptic. @@ -1031,9 +1039,10 @@ cfg1 != NULL && cfg1->tok == tok_choice; cfg1 = cfg1->next) { - printf("\tif { $%s == \"%s\" } then { write_tristate $cfg $autocfg %s 1 $notmod }\n", + printf("\tif { $%s == \"%s\" } then { write_tristate $cfg $autocfg %s 1 $notmod } else { write_tristate $cfg $autocfg %s 0 $notmod }\n", cfg->optionname, cfg1->label, + cfg1->optionname, cfg1->optionname); } }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu